strava-ruby-client icon indicating copy to clipboard operation
strava-ruby-client copied to clipboard

Strava V3 deprecates attribute `type` for Activities

Open simonneutert opened this issue 3 years ago • 5 comments

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.

simonneutert avatar Jul 29 '22 06:07 simonneutert

Thanks, care to PR an update?

dblock avatar Jul 29 '22 17:07 dblock

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 avatar Jul 31 '22 07:07 simonneutert

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 vcr_cassettes are @dblock

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

simonneutert avatar Jul 31 '22 10:07 simonneutert

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.

dblock avatar Jul 31 '22 14:07 dblock

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

I will put the elbow grease in 🤝

simonneutert avatar Jul 31 '22 16:07 simonneutert

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

dblock avatar Dec 29 '22 03:12 dblock

@dblock we could as a next step:

  • [x] remove type as an attribute from the code base
  • [x] add an entry to Upgrading.md
  • [x] update Readme.md where needed

simonneutert avatar Dec 29 '22 09:12 simonneutert

That works! Please?

dblock avatar Dec 29 '22 17:12 dblock

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

dblock avatar Jan 25 '23 02:01 dblock