The 3.0 version introduces numerous improvements along with several breaking changes.
The models have been updated and now closer align to the API documentation.
Activitywas renamed toDetailedActivity, andSummaryActivity,ClubActivityandMetaActivitywere addedAthletewas renamed toDetailedAthlete, andSummaryAthlete, andMetaAthletewere addedClubwas renamed toDetailedClub, andSummaryClub, andMetaClubwere addedGearwas renamed toDetailedGearandSummaryGearwas addedPhotowas renamed toDetailedPhoto, andPhotoswas renamed toDetailedPhotos,PhotosSummaryandPhotosSummaryPrimarywere addedSegmentwas renamed toDetailedSegment,SummarySegmentwas added andSegmentStatswas removedSegmentEffortwas renamed toDetailedSegmentEffortandSummarySegmentEffortwas addedClubMemberwas renamed toClubAthlete, andClubAdminwas removedBaseStream,StatsVisibility,SummaryPRSegmentEffort,UpdatableActivity,Xoms,Destination,LocalLegendandWaypointwere addedRunningRacewas removed
-
Activities:
create_activity()now returnsDetailedActivityinstead ofActivityactivity()now returnsDetailedActivityinstead ofActivityactivity_photos()now returnsDetailedPhotoinstead ofPhotoactivity_kudos()now returnsSummaryAthleteinstead ofAthlete
-
Athletes:
athlete()now returnsDetailedAthleteinstead ofAthleteupdate_athlete()now returnsDetailedAthleteinstead ofAthlete
-
Clubs:
club_activities()now returnsClubActivityinstead ofActivityclub_admins()now returnsClubAthleteinstead ofClubAdminclub()now returnsDetailedClubinstead ofClubclub_members()now returnsClubAthleteinstead ofClubMember
-
Gears:
gear()now returnsDetailedGearinstead ofGear
-
Segment Efforts:
segment_effort()now returnsDetailedSegmentEffortinstead ofSegmentEffortsegment_efforts()now returnsDetailedSegmentEffortinstead ofSegmentEffort
-
Segments:
starred_segments()now returnsSummarySegmentinstead ofSegmentsegment()now returnsDetailedSegmentinstead ofSegmentstar_segment()now returnsDetailedSegmentinstead ofSegment
-
Running Races:
running_race(id)has been removed
See #96 for details.
Properties, such as DetailedActivity#start_latlng are now of the Strava::Models::LatLng type.
activity.start_latlng # Strava::Models::LatLng
activity.start_latlng.to_a # [36.377702, -94.207242]
activity.start_latlng.lat # 36.377702
activity.start_latlng.lng # -94.207242See #98 for details.
The Strava Photos API returns unique_id and does not return id. The latter has been removed.
See #94 for details.
The Strava::Webhooks::Models::Event model has been refactored to map the object_id field to id for consistency and to resolve Hashie::Trash serialization warnings.
If you're using webhooks and accessing the object_id property, you must now use id instead.
Before (v2.x):
event = Strava::Webhooks::Models::Event.new(JSON.parse(request.body))
event.object_id # => 1991813808After (v3.0.0):
event = Strava::Webhooks::Models::Event.new(JSON.parse(request.body))
event.id # => 1991813808This change fixes the Hashie::Trash serialization warning that occurred when using object_id due to conflicts with Ruby's built-in Object#object_id method.
See #92 for details.
The client will always paginate data if per_page or page_size are provided.
Before (v2.x):
# one request for a page of 10 items
client.activity_comments(id: 1982980795, page_size: 10) # => [Strava::Models::Comment]After (v3.0.0):
# all pages, multiple requests, potentially more than 10 items
client.activity_comments(id: 1982980795, page_size: 10) # => [Strava::Models::Comment]Use limit in combination with page_size to both paginate and retrieve a certain number of items.
# all pages, 10 items per page, no more than 20 items
client.activity_comments(id: 1982980795, page_size: 10, limit: 20) # => [Strava::Models::Comment]See #99 for details.
Faraday can optionally exclude HTTP method, path and query params from the errors raised. The client implementation options will now default to Faraday::Response::RaiseError::DEFAULT_OPTIONS with include_request set to true. You can change this behavior by setting Strava::Web::RaiseResponseError::DEFAULT_OPTIONS.
Strava::Web::RaiseResponseError::DEFAULT_OPTIONS = { include_request: false }See #91 for details.
Support for Ruby 2.x has been dropped. The minimum required Ruby version is now 3.0.0.
The change in #80 removes default values for Faraday's SSL settings ca_file and ca_path.
If you previously relied on OpenSSL::X509::DEFAULT_CERT_FILE or OpenSSL::X509::DEFAULT_CERT_DIR to set these values, you must now do so explicitly.
Strava::Web::Client.configure do |config|
config.ca_file = OpenSSL::X509::DEFAULT_CERT_FILE
config.ca_path = OpenSSL::X509::DEFAULT_CERT_DIR
endor
client = Strava::Api::Client.new(ca_file: OpenSSL::X509::DEFAULT_CERT_FILE, ca_path: OpenSSL::X509::DEFAULT_CERT_DIR)- Dropping
Activityattributetypeandtype_emojiin favor ofsport_typeandsport_type_emoji. Creating or updating anActivityrequires you to usesport_typeinstead oftype, as refered in the README. For details visit the official Strava docs: Create Activity and the entry from June 15, 2022 in Strava's V3 API Changelog. - Uploading a file using
create_uploadrequires you to check its process, usingclient.updload('your-unique-upload-id'). A successful upload does just mean, that the file was accepted. The Processing of the file is an independent process on Strava's side. From now on,client.updload('your-unique-upload-id')will raiseStrava::Errors::UploadError, if Strava failed processing the file, e.g. it being a duplicate. - Exceeded Ratelimits (HTTP Status: 429) do now raise a customized Error
Strava::Errors::RatelimitError. You can use theStrava::Api::Ratelimitobject coming with the error, for further inspection of your current ratelimits. - The method
Client#activity_photosto retrieve an activity's photos has been removed. The Strava API offers no official support for this. See #76 for details. - The method
Client#activity_photosto retrieve an activity's photos has been added back. The Strava API does actually offer undocumented support for this. It's just finicky. See this discussion for details.
- API request will now raise
Strava::Web::RaiseResponseErrorinstead of::Strava::Web::Response::RaiseError - Using
get,post,put,deletedirectly, changed fromFaraday::ResponsetoStrava::Web::Responseas return value.
In order to access theFaraday::ReponseorFaraday::Reponse#bodyyou need to call.responseor.response.body. - Paginated API paths now return
Strava::Api::Pagination, which is a new wrapper class for the returned collection of entries.
The library was upgraded to require Faraday 1.0 or newer. Change all references to Faraday::Error::ResourceNotFound or Faraday::Error::ConnectionFailed to Faraday::ConnectionFailed and Faraday::ResourceNotFound respectively.
See #30 for details.