dblock / strava-ruby-client

A complete Ruby client for the Strava API v3.
https://code.dblock.org/2018/11/27/writing-a-new-strava-api-ruby-client.html
MIT License
97 stars 22 forks source link

Strava V3 deprecates attribute `type` for Activities #62

Closed simonneutert closed 1 year ago

simonneutert commented 2 years ago

The replacing attribute will be sport_type.

https://developers.strava.com/docs/changelog/

June 15, 2022

Introduction of activity sport_type. This is the preferred field to use moving forward, as opposed to type, which is now considered deprecated. Please note: this change is backward compatible and type will still be supported. The SportType enumeration is distinct from ActivityType in that it includes new types (e.g. MountainBikeRide). In requests where both type and sport_type are present, type will be ignored.

dblock commented 2 years ago

Thanks, care to PR an update?

simonneutert commented 2 years ago

I'll start a draft :v:


API Docs for SportType

An enumeration of the sport types an activity may have. Distinct from ActivityType in that it has new types (e.g. MountainBikeRide)

May be one of the following values: AlpineSki, BackcountrySki, Canoeing, Crossfit, EBikeRide, Elliptical, EMountainBikeRide, Golf, GravelRide, Handcycle, Hike, IceSkate, InlineSkate, Kayaking, Kitesurf, MountainBikeRide, NordicSki, Ride, RockClimbing, RollerSki, Rowing, Run, Sail, Skateboard, Snowboard, Snowshoe, Soccer, StairStepper, StandUpPaddling, Surfing, Swim, TrailRun, Velomobile, VirtualRide, VirtualRun, Walk, WeightTraining, Wheelchair, Windsurf, Workout, Yoga


Details taken from the Strava Support Page: https://support.strava.com/hc/en-us/articles/216919407-Supported-Sport-Types-on-Strava (2022-07-31 at 09-40-45)

Screenshot 2022-07-31 at 09-40-45 Supported Sport Types on Strava

simonneutert commented 2 years ago

I made some good progress and the new attribute comes in for older activities as expected.

Here's a shortened JSON response for an activity.

{
  "resource_state": 3,
  "athlete": { "id": 24776507, "resource_state": 1 },
  "name": "Pimmel Party Buddytag der Tarmac Boys",
  "distance": 92137.5,
  "moving_time": 13297,
  "elapsed_time": 15395,
  "total_elevation_gain": 138.0,
  "type": "Ride",
  "sport_type": "Ride",
  "workout_type": 10,
  // ...
}

If you so wish I would put in the effort and write all cassette based checks from scratch 🥵
or you let me add the sport_type next to type for Activity cassettes 💪

please, check the little work (link below), before I open a PR and let me know what your expectations for the _vcrcassettes are @dblock

https://github.com/dblock/strava-ruby-client/compare/master...simonneutert:strava-ruby-client:62-adds-sport_type-for-v3-specs

dblock commented 2 years ago

I think we definitely need at least some new K7s that show a complete new response, but I don't think you need to try and update all of them from scratch unless you feel super motivated.

simonneutert commented 2 years ago

Cheers, sometimes work needs to be done, whether it's fun or not.

I will put the elbow grease in 🤝

dblock commented 1 year ago

@simonneutert Anything else needed here after https://github.com/dblock/strava-ruby-client/pull/63?

simonneutert commented 1 year ago

@dblock we could as a next step:

dblock commented 1 year ago

That works! Please?

dblock commented 1 year ago

Closed via https://github.com/dblock/strava-ruby-client/pull/68