strava-ruby-client 3.1.0 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -0
  3. data/README.md +43 -978
  4. data/bin/strava-webhooks +50 -38
  5. data/lib/strava/api/pagination.rb +1 -2
  6. data/lib/strava/models/activity_total.rb +7 -0
  7. data/lib/strava/models/activity_zone.rb +7 -0
  8. data/lib/strava/models/club_event.rb +2 -2
  9. data/lib/strava/models/comment.rb +1 -1
  10. data/lib/strava/models/detailed_activity.rb +8 -1
  11. data/lib/strava/models/detailed_athlete.rb +2 -2
  12. data/lib/strava/models/detailed_photo.rb +3 -3
  13. data/lib/strava/models/detailed_photos.rb +7 -0
  14. data/lib/strava/models/detailed_segment.rb +9 -2
  15. data/lib/strava/models/detailed_segment_effort.rb +1 -1
  16. data/lib/strava/models/lap.rb +1 -1
  17. data/lib/strava/models/mixins/start_date_local.rb +1 -1
  18. data/lib/strava/models/model.rb +15 -0
  19. data/lib/strava/models/photos_summary.rb +7 -0
  20. data/lib/strava/models/route.rb +9 -2
  21. data/lib/strava/models/summary_activity.rb +8 -1
  22. data/lib/strava/models/summary_athlete.rb +2 -2
  23. data/lib/strava/models/summary_segment.rb +1 -1
  24. data/lib/strava/models/summary_segment_effort.rb +1 -1
  25. data/lib/strava/models/timed_zone_range.rb +14 -0
  26. data/lib/strava/models/zone_range.rb +14 -0
  27. data/lib/strava/version.rb +1 -1
  28. data/lib/strava/web/client.rb +1 -1
  29. data/lib/strava/web/config.rb +4 -0
  30. data/lib/strava/web/connection.rb +7 -2
  31. data/lib/strava/web/filter.rb +72 -0
  32. data/lib/strava/web/log_formatter.rb +20 -0
  33. data/lib/strava/web/raise_response_error.rb +26 -9
  34. data/lib/strava/web/response.rb +16 -33
  35. data/lib/strava/webhooks/models/event.rb +8 -0
  36. data/lib/strava/webhooks/models/subscription.rb +2 -2
  37. data/lib/strava-ruby-client.rb +2 -0
  38. metadata +7 -9
data/README.md CHANGED
@@ -6,74 +6,27 @@
6
6
 
7
7
  A complete Ruby client for the [Strava API v3](https://developers.strava.com).
8
8
 
9
- Unlike other clients, including [strava-api-v3](https://github.com/jaredholdcroft/strava-api-v3), provides complete OAuth refresh token flow support, webhooks support, a richer first class interface to Strava models, conversion helpers for distance, time and elevation, natively supports pagination, implements more consistent error handling and is built with thorough test coverage using actual Strava data.
9
+ It supports OAuth with refresh tokens, webhooks, pagination and rate limits, provides rich Strava models with distance, time and elevation helpers, and is tested with actual Strava data.
10
10
 
11
11
  ## Table of Contents<!-- omit in toc -->
12
12
 
13
13
  - [Installation](#installation)
14
14
  - [Usage](#usage)
15
- - [Activities](#activities)
16
- - [Create an Activity](#create-an-activity)
17
- - [Get Activity](#get-activity)
18
- - [List Activity Photos](#list-activity-photos)
19
- - [List Activity Comments](#list-activity-comments)
20
- - [List Activity Kudoers](#list-activity-kudoers)
21
- - [List Activity Laps](#list-activity-laps)
22
- - [List Athlete Activities](#list-athlete-activities)
23
- - [Get Activity Zones](#get-activity-zones)
24
- - [Update Activity](#update-activity)
25
- - [Athletes](#athletes)
26
- - [Get Authenticated Athlete](#get-authenticated-athlete)
27
- - [Get Zones](#get-zones)
28
- - [Get Athlete Stats](#get-athlete-stats)
29
- - [Update Athlete](#update-athlete)
30
- - [Clubs](#clubs)
31
- - [List Athlete Clubs](#list-athlete-clubs)
32
- - [Get Club](#get-club)
33
- - [List Club Events](#list-club-events)
34
- - [Gears](#gears)
35
- - [Get Equipment](#get-equipment)
36
- - [Routes](#routes)
37
- - [Export Route GPX](#export-route-gpx)
38
- - [Export Route TCX](#export-route-tcx)
39
- - [Get Route](#get-route)
40
- - [List Athlete Routes](#list-athlete-routes)
41
- - [Segment Efforts](#segment-efforts)
42
- - [List Segment Efforts](#list-segment-efforts)
43
- - [Get Segment Effort](#get-segment-effort)
44
- - [Segments](#segments)
45
- - [Explore Segments](#explore-segments)
46
- - [List Starred Segments](#list-starred-segments)
47
- - [Get Segment](#get-segment)
48
- - [Star Segment](#star-segment)
49
- - [Streams](#streams)
50
- - [Get Activity Streams](#get-activity-streams)
51
- - [Get Segment Effort Streams](#get-segment-effort-streams)
52
- - [Get Segment Streams](#get-segment-streams)
53
- - [Uploads](#uploads)
54
- - [Upload Activity](#upload-activity)
55
- - [Get Upload](#get-upload)
56
- - [Pagination](#pagination)
57
- - [OAuth](#oauth)
58
- - [OAuth Workflow](#oauth-workflow)
59
- - [Revoke](#revoke)
60
- - [Deauthorize](#deauthorize)
61
- - [Command Line OAuth Workflow](#command-line-oauth-workflow)
62
- - [Webhooks](#webhooks)
63
- - [Ratelimit](#ratelimit)
64
- - [Exceeded Ratelimit](#exceeded-ratelimit)
15
+ - [Get a Token](#get-a-token)
16
+ - [Make Requests](#make-requests)
17
+ - [Paginate](#paginate)
18
+ - [Handle Errors](#handle-errors)
19
+ - [More](#more)
65
20
  - [Configuration](#configuration)
66
21
  - [Web Client Options](#web-client-options)
67
22
  - [API Client Options](#api-client-options)
68
23
  - [OAuth Client Options](#oauth-client-options)
69
24
  - [Webhooks Client Options](#webhooks-client-options)
70
- - [Errors](#errors)
71
25
  - [Tools](#tools)
72
26
  - [Strava OAuth Token](#strava-oauth-token)
73
27
  - [Strava Refresh Token](#strava-refresh-token)
74
28
  - [Users](#users)
75
29
  - [Resources](#resources)
76
- - [Upgrading](#upgrading)
77
30
  - [Contributing](#contributing)
78
31
  - [Copyright and License](#copyright-and-license)
79
32
 
@@ -89,922 +42,56 @@ Run `bundle install`.
89
42
 
90
43
  ## Usage
91
44
 
92
- Use an access token obtained from [My API Application](https://www.strava.com/settings/api) in the Strava UI, the [strava-oauth-token tool](#strava-oauth-token) or the [OAuth Workflow](#oauth) in your application.
45
+ ### Get a Token
93
46
 
94
- ```ruby
95
- client = Strava::Api::Client.new(
96
- access_token: "12345678987654321"
97
- )
98
-
99
- client.athlete # => Strava::Models::DetailedAthlete
100
- ```
101
-
102
- Note that the token from the Strava website does not have enough permissions to retrieve your own activities. Use the [strava-oauth-token tool](#strava-oauth-token) to obtain a short lived with more access scopes.
47
+ Strava API calls require an OAuth access token. The token shown on [My API Application](https://www.strava.com/settings/api) can't read your activities, so use [strava-oauth-token](#strava-oauth-token) to obtain one with more scopes, or implement the [OAuth workflow](docs/USAGE.md#oauth) in your application.
103
48
 
104
49
  ```bash
105
- export STRAVA_CLIENT_ID=...
106
- export STRAVA_CLIENT_SECRET=...
107
-
108
- bundle exec ruby bin/strava-oauth-token
109
- ```
110
-
111
- Set `STRAVA_ACCESS_TOKEN` to the value of `access_token` from the browser window and save `refresh_token` in a secure location.
112
-
113
- ```bash
114
- export STRAVA_ACCESS_TOKEN=...
115
-
116
- bundle exec ruby bin/strava-activities.rb
117
- ```
118
-
119
- You can repeat the process above when the token expires, or use the `refresh_token`, which is faster.
120
-
121
- ```bash
122
- export STRAVA_CLIENT_ID=...
123
- export STRAVA_CLIENT_SECRET=...
124
- export STRAVA_API_REFRESH_TOKEN=...
125
-
126
- bundle exec ./bin/strava-refresh-token
127
- ```
128
-
129
- Set `STRAVA_ACCESS_TOKEN` to the value of `access_token`.
130
-
131
- ### Activities
132
-
133
- #### Create an Activity
134
-
135
- Creates a manual activity for an athlete.
136
-
137
- ```ruby
138
- activity = client.create_activity(
139
- name: 'Afternoon Run',
140
- sport_type: 'Run',
141
- start_date_local: Time.now,
142
- elapsed_time: 1234, # in seconds
143
- description: 'Test run.',
144
- distance: 1000 # in meters
145
- )
146
-
147
- activity.name # => 'Afternoon Run'
148
- activity.strava_url # => 'https://www.strava.com/activities/1982980795'
149
- ```
150
-
151
- See [Strava::Models::DetailedActivity](lib/strava/models/detailed_activity.rb) for all available properties.
152
-
153
- #### Get Activity
154
-
155
- Returns the given activity that is owned by the authenticated athlete.
156
-
157
- ```ruby
158
- activity = client.activity(1982980795)
159
-
160
- activity.name # => 'Afternoon Run'
161
- activity.strava_url # => 'https://www.strava.com/activities/1982980795'
162
- ```
163
-
164
- See [Strava::Models::DetailedActivity](lib/strava/models/detailed_activity.rb) for all available properties.
165
-
166
- Use `map.summary_polyline` and combine with [polylines](https://github.com/joshuaclayton/polylines) to parse the activity map and to construct a Google maps URL with start and end markers.
167
-
168
- ```ruby
169
- require 'cgi'
170
- require 'polylines'
171
-
172
- map = activity.map # => Strava::Models::Map
173
-
174
- decoded_summary_polyline = Polylines::Decoder.decode_polyline(map.summary_polyline)
175
- start_latlng = decoded_summary_polyline[0]
176
- end_latlng = decoded_summary_polyline[-1]
177
-
178
- # Google Maps Static API
179
- google_maps_api_key = ENV['GOOGLE_STATIC_MAPS_API_KEY']
180
- google_image_url = "https://maps.googleapis.com/maps/api/staticmap?maptype=roadmap&path=enc:#{CGI.escape(map.summary_polyline)}&size=800x800&markers=color:yellow|label:S|#{start_latlng[0]},#{start_latlng[1]}&markers=color:green|label:F|#{end_latlng[0]},#{end_latlng[1]}&key=#{google_maps_api_key}"
181
-
182
- # MapBox Static API
183
- mapbox_access_token = ENV['MAPBOX_ACCESS_TOKEN']
184
- mapbox_image_url = "https://api.mapbox.com/styles/v1/mapbox/streets-v11/static/path-5+787af2-1.0(#{CGI.escape(map.summary_polyline)}),pin-s-s+e5b22e(#{start_latlng[1]},#{start_latlng[0]}),pin-s-f+89ae00(#{end_latlng[1]},#{end_latlng[0]})/auto/800x800?access_token=#{mapbox_access_token}"
185
- ```
186
-
187
- See [Strava::Models::Map](lib/strava/models/map.rb) for all available properties.
188
-
189
- #### List Activity Photos
190
-
191
- Returns the photos on the given activity. This API is undocumented in Strava's docs. But there is a discussion in the [strava community hub](https://communityhub.strava.com/t5/developer-discussions/download-all-photos-of-my-own-activities/m-p/11262).
192
-
193
- ```ruby
194
- photos = client.activity_photos(1982980795) # => Array[Strava::Models::DetailedPhoto]
195
- # in order to request a certain size (by default it will return the biggest size possible):
196
- # photos = client.activity_photos(1982980795, {size: 1920}) # => Array[Strava::Models::DetailedPhoto]
197
-
198
- photo = photos.first # => Strava::Models::DetailedPhoto
199
-
200
- photo.id # => nil
201
- photo.unique_id # => '65889142-538D-4EE5-96F5-3DC3B773B1E3'
202
- photo.urls # => { '0' => 'https://dgtzuqphqg23d.cloudfront.net/eb4DMJ2hJW3k_g9URZEMfaJ8rZfHagrNlZRuEZz0osU-29x64.jpg' }
203
- photo.athlete_id # => 26_462_176
204
- photo.activity_id # => 1_946_417_534
205
- photo.activity_name # => 'TCS NYC Marathon 2018'
206
- photo.created_at # => Time
207
- photo.uploaded_at # => Time
208
- photo.sizes # => { '0' => [29, 64] }
209
- photo.default_photo # => false
210
- ```
211
-
212
- See [Strava::Models::DetailedPhoto](lib/strava/models/detailed_photo.rb) for all available properties.
213
-
214
- #### List Activity Comments
215
-
216
- Returns the comments on the given activity.
217
-
218
- ```ruby
219
- comments = client.activity_comments(1982980795) # => Array[Strava::Models::Comment]
220
-
221
- comment = comments.first # => Strava::Models::Comment
222
-
223
- comment.text # => 'Молодчина!'
224
- comment.athlete.username # => 'zolotov'
225
- ```
226
-
227
- See [Strava::Models::Comment](lib/strava/models/comment.rb) for all available properties.
228
-
229
- #### List Activity Kudoers
230
-
231
- Returns the athletes who kudoed an activity identified by an identifier.
232
-
233
- ```ruby
234
- kudoers = client.activity_kudos(1982980795) # => Array[Strava::Models::SummaryAthlete]
235
-
236
- kodoer = kudoers.first # => Strava::Models::SummaryAthlete
237
-
238
- kudoer.username # => 'zolotov'
239
- ```
240
-
241
- See [Strava::Models::SummaryAthlete](lib/strava/models/summary_athlete.rb) for all available properties.
242
-
243
- #### List Activity Laps
244
-
245
- Returns the laps of an activity identified by an identifier.
246
-
247
- ```ruby
248
- laps = client.activity_laps(1982980795) # => Array[Strava::Models::Lap]
249
-
250
- lap = laps.first # => Strava::Models::Lap
251
-
252
- lap.name # => 'Lap 1'
253
- ```
254
-
255
- See [Strava::Models::Lap](lib/strava/models/lap.rb) for all available properties.
256
-
257
- #### List Athlete Activities
258
-
259
- Returns the currently logged-in athlete's activities.
260
-
261
- ```ruby
262
- activities = client.athlete_activities # => Array[Strava::Models::SummaryActivity]
263
-
264
- activity = activities.first # => Strava::Models::SummaryActivity
265
-
266
- activity.name # => 'NYC TCS Marathon 2018'
267
- activity.strava_url # => 'https://www.strava.com/activities/1477353766'
268
- activity.sport_type_emoji # => '🏃'
269
- activity.distance_s # => '42.2km'
270
- activity.moving_time_in_hours_s # => '3h38m5s'
271
- activity.elapsed_time_in_hours_s # => '3h42m13s'
272
- activity.pace_s # => '5m15s/km'
273
- activity.pace_per_mile_s # => '8m28s/mi'
274
- activity.average_speed_s # => '11.4km/h'
275
- activity.average_speed_miles_per_hour_s # => '7.1mph'
276
- activity.total_elevation_gain_s # => '270.9m'
277
- activity.total_elevation_gain_in_feet_s # => '888.8ft'
278
- ```
279
-
280
- See [Strava::Models::SummaryActivity](lib/strava/models/summary_activity.rb), [Strava::Models::Mixins::Distance](lib/strava/models/mixins/distance.rb), [Strava::Models::Mixins::TotalElevationGain](lib/strava/models/mixins/total_elevation_gain.rb), [Strava::Models::Mixins::ElapsedTime](lib/strava/models/mixins/elapsed_time.rb) and [Strava::Models::Mixins::MovingTime](lib/strava/models/mixins/moving_time.rb) for all available properties.
281
-
282
- #### Get Activity Zones
283
-
284
- Returns the zones of a given activity.
285
-
286
- ```ruby
287
- zones = client.activity_zones(1982980795) # => Array[Strava::Models::ActivityZone]
288
-
289
- zone = zones.first # => Strava::Models::ActivityZone
290
- zones.type # => 'heartrate'
291
-
292
- distribution_buckets = activity_zone.distribution_buckets # => Array[Strava::Models::TimedZoneRange]
293
-
294
- distribution_bucket = distribution_buckets.first # => Strava::Models::TimedZoneRange
295
-
296
- distribution_bucket.min # => 0
297
- distribution_bucket.max # => 123
298
- distribution_bucket.time # => 20
299
- ```
300
-
301
- See [Strava::Models::ActivityZone](lib/strava/models/activity_zone.rb) and [Strava::Models::TimedZoneRange](lib/strava/models/timed_zone_range.rb) for all available properties.
302
-
303
- #### Update Activity
304
-
305
- Update an activity.
306
-
307
- ```ruby
308
- activity = client.update_activity(
309
- id: 1982980795,
310
- name: 'Afternoon Run (Updated)',
311
- sport_type: 'Run',
312
- description: 'It was cold.'
313
- )
314
-
315
- activity.name # => 'Afternoon Run (Updated)'
316
- activity.strava_url # => 'https://www.strava.com/activities/1982980795'
317
- ```
318
-
319
- ### Athletes
320
-
321
- #### Get Authenticated Athlete
322
-
323
- Returns the currently authenticated athlete.
324
-
325
- ```ruby
326
- client.athlete # => Strava::Models::DetailedAthlete
327
- ```
328
-
329
- See [Strava::Models::DetailedAthlete](lib/strava/models/detailed_athlete.rb) for all available properties.
330
-
331
- #### Get Zones
332
-
333
- Returns the the authenticated athlete's heart rate and power zones.
334
-
335
- ```ruby
336
- athlete_zones = client.athlete_zones # => Strava::Models::Zones
337
-
338
- heart_rate = athlete_zones.heart_rate # => Strava::Models::HeartRateZoneRanges
339
- heart_rate.custom_zone # => false
340
-
341
- zone = heart_rate.zones.first # => Strava::Models::ZoneRange
342
- zone.min # => 0
343
- zone.max # => 123
344
- ```
345
-
346
- See [Strava::Models::Zones](lib/strava/models/zones.rb), [Strava::Models::HeartRateZoneRanges](lib/strava/models/heart_rate_zone_ranges.rb), [Strava::Models::PowerZoneRanges](lib/strava/models/power_zone_ranges.rb) and [Strava::Models::ZoneRange](lib/strava/models/zone_range.rb) for all available properties.
347
-
348
- #### Get Athlete Stats
349
-
350
- Returns the activity stats of an athlete.
351
-
352
- ```ruby
353
- athlete_stats = client.athlete_stats(26462176) # => Strava::Models::ActivityStats
354
-
355
- recent_run_totals = athlete_stats.recent_ride_totals # => Strava::Models::ActivityTotal
356
-
357
- recent_run_totals.count # => 7
358
- recent_run_totals.distance # => 78049.90087890625
359
- recent_run_totals.distance_s # => '78.05km'
360
- recent_run_totals.moving_time # => 25647
361
- recent_run_totals.moving_time_in_hours_s # => '7h7m27s'
362
- recent_run_totals.elapsed_time # => 26952
363
- recent_run_totals.elapsed_time_in_hours_s # => '7h29m12s'
364
- recent_run_totals.elevation_gain # => 595.4644241333008
365
- recent_run_totals.total_elevation_gain_s # => '595.5m'
366
- recent_run_totals.achievement_count # => 19
367
- ```
368
-
369
- See [Strava::Models::ActivityStats](lib/strava/models/activity_stats.rb) and [Strava::Models::ActivityTotal](lib/strava/models/activity_total.rb) for all available properties.
370
-
371
- #### Update Athlete
372
-
373
- Update the currently authenticated athlete.
374
-
375
- ```ruby
376
- athlete = client.update_athlete(weight: 90.1) # => Strava::Models::Athlete
377
- ```
378
-
379
- See [Strava::Models::DetailedAthlete](lib/strava/models/detailed_athlete.rb) for all available returned properties.
380
-
381
- ### Clubs
382
-
383
- Strava removed the Club Activities, Club Members, and Club Admins endpoints on September 1, 2026 (see the [Strava API changelog](https://developers.strava.com/docs/changelog/)). The corresponding `club_activities`, `club_members`, and `club_admins` methods have been removed from this gem.
384
-
385
- #### List Athlete Clubs
386
-
387
- Returns a list of the clubs whose membership includes the authenticated athlete.
388
-
389
- ```ruby
390
- clubs = client.athlete_clubs # => Array[Strava::Models::SummaryClub]
391
-
392
- club = clubs.first # => Strava::Models::SummaryClub
393
-
394
- activity.name # => 'NYRR'
395
- activity.strava_url # => 'https://www.strava.com/clubs/nyrr'
396
- ```
397
-
398
- See [Strava::Models::SummaryClub](lib/strava/models/summary_club.rb) for all available properties.
399
-
400
- #### Get Club
401
-
402
- Returns a given club using its identifier.
403
-
404
- ```ruby
405
- club = client.club(108605) # => Strava::Models::DetailedClub
406
-
407
- club.name # => 'NYRR'
408
- ```
409
-
410
- See [Strava::Models::DetailedClub](lib/strava/models/detailed_club.rb) for all available properties.
411
-
412
- #### List Club Events
413
-
414
- Retrieve recent Events from a specific club.
415
-
416
- ```ruby
417
- events = client.club_events(108605) # => Array[Strava::Models::ClubEvent]
418
-
419
- event = events.first # => Strava::Models::ClubEvent
420
-
421
- event.title # => 'First Group Event Ever! Yippieh!'
422
- ```
423
-
424
- See [Strava::Models::ClubEvent](lib/strava/models/club_event.rb) for all available properties.
425
-
426
- ### Gears
427
-
428
- #### Get Equipment
429
-
430
- Returns an equipment using its identifier.
431
-
432
- ```ruby
433
- gear = client.gear(id: 'b2338517') # => Strava::Models::DetailedGear
434
-
435
- gear.id # => 'b2338517'
436
- gear.name # => 'Trek'
437
- gear.distance # => 380939.0
438
- gear.distance_s # => '380.94km'
439
- gear.brand_name # => 'Trek'
440
- gear.model_name # => 'Madone'
441
- gear.description # => 'white'
442
- gear.primary # => 'false'
443
- gear.frame_type # => '3'
444
- gear.weight # => '9'
445
- gear.retired # => 'false'
446
- ```
447
-
448
- See [Strava::Models::DetailedGear](lib/strava/models/detailed_gear.rb) for all available properties.
449
-
450
- ### Routes
451
-
452
- #### Export Route GPX
453
-
454
- Returns [GPS Exchange Format](https://en.wikipedia.org/wiki/GPS_Exchange_Format) (GPX) data of the route. Combine with [multi_xml](https://github.com/sferik/multi_xml) or [gpx](https://github.com/dougfales/gpx) to parse it.
455
-
456
- ```ruby
457
- data = client.export_route_gpx(16341573) # => String
458
-
459
- require 'multi_xml'
460
- xml = MultiXml.parse(data) # => parsed GPX
461
-
462
- require 'gpx'
463
- gpx = GPX::GPXFile.new(gpx_data: data) # => GPX::GPXFile
464
-
465
- gpx.name # => 'Lower Manhattan Loop'
466
- gpx.description # => 'My usual long run when I am too lazy to go to Central Park.'
467
- gpx.tracks # => Array[GPX::Track]
468
- ```
469
-
470
- #### Export Route TCX
471
-
472
- Returns a [Training Center XML](https://en.wikipedia.org/wiki/Training_Center_XML) (TCX) data of the route. Combine with [multi_xml](https://github.com/sferik/multi_xml) or [tcx](https://github.com/dblock/tcx) to parse it.
473
-
474
- ```ruby
475
- data = client.export_route_tcx(16341573) # => String
476
-
477
- require 'multi_xml'
478
- xml = MultiXml.parse(data) # => parsed TCX
479
-
480
- require 'tcx'
481
- tcx = Tcx.load(data) # => Tcx::Database
482
-
483
- tcx.courses.first.name # => 'Lower Manhattan'
484
- ```
485
-
486
- #### Get Route
487
-
488
- Returns a route using its identifier.
489
-
490
- ```ruby
491
- route = client.route(16341573) # => Strava::Models::Route
492
-
493
- route.name # => 'Lower Manhattan Loop'
494
- route.description # => 'My usual long run when I am too lazy to go to Central Park.'
495
- ```
496
-
497
- See [Strava::Models::Route](lib/strava/models/route.rb) for all available properties.
498
-
499
- #### List Athlete Routes
500
-
501
- Returns a list of the routes by athlete ID.
502
-
503
- ```ruby
504
- routes = client.athlete_routes(26462176) # => Array[Strava::Models::Route]
505
-
506
- route = routes.first # => Strava::Models::Route
507
-
508
- route.name # => 'Lower Manhattan Loop'
509
- route.description # => 'My usual long run when I am too lazy to go to Central Park.'
510
- route.moving_time_in_hours_s # => '1h21m5s'
511
- ```
512
-
513
- See [Strava::Models::Route](lib/strava/models/route.rb) for all available properties.
514
-
515
- ### Segment Efforts
516
-
517
- #### List Segment Efforts
518
-
519
- Returns a set of the authenticated athlete's segment efforts for a given segment.
520
-
521
- ```ruby
522
- segment_efforts = client.segment_efforts(1109718)
523
-
524
- segment_effort = segment_efforts.first # => Strava::Models::DetailedSegmentEffort
525
-
526
- segment_effort.name # => 'E 14th St Climb'
527
- segment_effort.activity # => Strava::Models::Activity
528
- segment_effort.athlete # => Strava::Models::Athlete
529
- segment_effort.elapsed_time # => 116
530
- segment_effort.distance # => 398.6
531
- segment_effort.distance_s # => '0.4km'
532
- segment_effort.average_heartrate # => 152.2
533
- segment_effort.max_heartrate # => 158.0
534
-
535
- segment_effort.achievements # => Enumerable
536
-
537
- achievement = segment_effort.achievements.first # => Strava::Models::Achievement
538
- achievement.rank # => 1
539
- achievement.type # => 'pr'
540
- achievement.type_id # => 3
541
- ```
542
-
543
- See [Strava::Models::DetailedSegmentEffort](lib/strava/models/detailed_segment_effort.rb) and [Strava::Models::Achievement](lib/strava/models/achievement.rb) for all available properties.
544
-
545
- #### Get Segment Effort
546
-
547
- Returns a segment effort from an activity that is owned by the authenticated athlete.
548
-
549
- ```ruby
550
- segment_effort = client.segment_effort(41494197089) # => Strava::Models::DetailedSegmentEffort
551
-
552
- segment_effort.name # => 'E 14th St Climb'
553
- segment_effort.activity # => Strava::Models::Activity
554
- segment_effort.elapsed_time # => 116
555
-
556
- segment_stats = segment_effort.athlete_segment_stats # => Strava::Models::SummaryPRSegmentEffort
557
- segment_stats.pr_elapsed_time # => 116
558
- segment_stats.elapsed_time_in_hours_s # => '1m56s'
559
- segment_stats.pr_date # => Date
560
- segment_stats.effort_count # => 3
561
- ```
562
-
563
- See [Strava::Models::DetailedSegmentEffort](lib/strava/models/detailed_segment_effort.rb) and [Strava::Models::SummaryPRSegmentEffort](lib/strava/models/summary_pr_segment_effort.rb) for all available properties.
564
-
565
- ### Segments
566
-
567
- #### Explore Segments
568
-
569
- Returns the top 10 segments matching a specified query.
570
-
571
- ```ruby
572
- segments = client.explore_segments(bounds: [36.372975, -94.220234, 36.415949, -94.183670], activity_type: 'running')
573
-
574
- segment = segments.first # => Strava::Models::ExplorerSegment
575
- segment.name # => 'Compton Gardens hill'
576
- segment.avg_grade # => 4.6
577
- segment.start_latlng # => [36.377702, -94.207242]
578
- segment.end_latlng # => [36.375948, -94.207689]
579
- segment.elev_difference # => 9.6
580
- ```
581
-
582
- See [Strava::Models::ExplorerSegment](lib/strava/models/explorer_segment.rb) for all available properties.
583
-
584
- #### List Starred Segments
585
-
586
- List of the authenticated athlete's starred segments.
587
-
588
- ```ruby
589
- segments = client.starred_segments
590
-
591
- segment = segments.first # => Strava::Models::SummarySegment
592
-
593
- segment.pr_time # => 256
594
- segment.elapsed_time_in_hours_s # => '4m16s'
595
- segment.starred_date # => Time
596
- segment.athlete_segment_stats # => Strava::Models::SummarySegmentEffort
597
- segment.athlete_pr_effort # => Strava::Models::SummaryPRSegmentEffort
598
- ```
599
-
600
- See [Strava::Models::Segment](lib/strava/models/segment.rb), [Strava::Models::SummarySegmentEffort](lib/strava/models/summary_segment_effort.rb) and [Strava::Models::SummaryPRSegmentEffort](lib/strava/models/summary_pr_segment_effort.rb) for all available properties.
601
-
602
- #### Get Segment
603
-
604
- Returns the specified segment.
605
-
606
- ```ruby
607
- segment = client.segment(1109718) # => Strava::Models::DetailedSegment
608
-
609
- segment.name # => 'E 14th St Climb'
610
- segment.city # => 'New York'
611
- segment.state # => 'NY'
612
- segment.country # => 'United States'
613
- segment.map # => Strava::Models::Map
614
- segment.effort_count # => 750
615
- segment.athlete_count # => 206
616
- segment.star_count # => 1
617
- segment.athlete_segment_stats # => Strava::Models::SummarySegmentEffort
618
- ```
619
-
620
- See [Strava::Models::DetailedSegment](lib/strava/models/detailed_segment.rb) for all available properties.
621
-
622
- #### Star Segment
623
-
624
- Stars/unstars the given segment for the authenticated athlete.
625
-
626
- ```ruby
627
- segment = client.star_segment(50272077110, starred: true) # => Strava::Models::DetailedSegment
628
-
629
- segment.name # => 'E 14th St Climb'
630
- segment.starred # => true
631
- ```
632
-
633
- See [Strava::Models::DetailedSegment](lib/strava/models/detailed_segment.rb) for all available properties.
634
-
635
- ### Streams
636
-
637
- Stream APIs can return various streams by key(s).
638
-
639
- ```ruby
640
- streams = client.segment_streams(1109718, keys: %w[distance latlng altitude]) # => Strava::Models::StrewamSet
641
-
642
- streams.distance # => Strava::Models::Stream
643
- streams.latlng # => Strava::Models::Stream
644
- streams.altitude # => Strava::Models::Stream
645
- ```
646
-
647
- The Strava API doesn't return a total elevation loss (descent) property for streams, but it can be computed from an altitude stream's data.
648
-
649
- ```ruby
650
- streams = client.activity_streams(1946417534, keys: %w[altitude]) # => Strava::Models::StreamSet
651
-
652
- streams.altitude.total_elevation_gain # => 725.3
653
- streams.altitude.total_elevation_loss # => 680.1
654
- streams.altitude.total_elevation_gain_s # => "725.3m"
655
- streams.altitude.total_elevation_loss_s # => "680.1m"
656
- ```
657
-
658
- #### Get Activity Streams
659
-
660
- Returns the given activity's streams.
661
-
662
- ```ruby
663
- streams = client.activity_streams(1946417534) # => Strava::Models::StreamSet
664
-
665
- distance = streams.distance # => Strava::Models::Stream
666
- distance.original_size # => 13_129
667
- distance.resolution # => 'high'
668
- distance.series_type # => 'distance'
669
- distance.data # => Array[Float]
50
+ STRAVA_CLIENT_ID=... STRAVA_CLIENT_SECRET=... strava-oauth-token
670
51
  ```
671
52
 
672
- See [Strava::Models::StreamSet](lib/strava/models/stream_set.rb) and [Strava::Models::Stream](lib/strava/models/stream.rb) for all available properties.
673
-
674
- #### Get Segment Effort Streams
53
+ Save the `refresh_token` in a secure location and use [strava-refresh-token](#strava-refresh-token) to get a new access token when it expires.
675
54
 
676
- Returns a set of streams for a segment effort completed by the authenticated athlete.
55
+ ### Make Requests
677
56
 
678
57
  ```ruby
679
- streams = client.segment_effort_streams(41494197089)
58
+ client = Strava::Api::Client.new(access_token: ENV['STRAVA_ACCESS_TOKEN'])
680
59
 
681
- distance = streams.distance # => Strava::Models::Stream
682
- distance.original_size # => 117
683
- distance.resolution # => 'high'
684
- distance.series_type # => 'distance'
685
- distance.data # => Array[Float]
686
- ```
60
+ athlete = client.athlete # => Strava::Models::DetailedAthlete
61
+ athlete.firstname # => 'Daniel'
687
62
 
688
- See [Strava::Models::StreamSet](lib/strava/models/stream_set.rb) and [Strava::Models::Stream](lib/strava/models/stream.rb) for all available properties.
689
-
690
- #### Get Segment Streams
691
-
692
- Returns the given segment's streams.
693
-
694
- ```ruby
695
- streams = client.segment_streams(1109718) # => Strava::Models::StreamSet
696
-
697
- distance = streams.distance # => Strava::Models::Stream
698
- distance.original_size # => 32
699
- distance.resolution # => 'high'
700
- distance.series_type # => 'distance'
701
- distance.data # => Array[Float]
63
+ activity = client.activity(1946417534) # => Strava::Models::DetailedActivity
64
+ activity.name # => 'TCS NYC Marathon 2018'
65
+ activity.distance_in_miles_s # => '26.26mi'
66
+ activity.strava_url # => 'https://www.strava.com/activities/1946417534'
702
67
  ```
703
68
 
704
- See [Strava::Models::StreamSet](lib/strava/models/stream_set.rb) and [Strava::Models::Stream](lib/strava/models/stream.rb) for all available properties.
705
-
706
- ### Uploads
69
+ ### Paginate
707
70
 
708
- #### Upload Activity
709
-
710
- Uploads a new data file to create an activity from. To check the processing status of the uploaded file, see [Get Upload](#get-upload).
711
-
712
- ```ruby
713
- upload = client.create_upload(
714
- file: Faraday::UploadIO.new('17611540601.tcx', 'application/tcx+xml'),
715
- name: 'Uploaded Activity',
716
- description: 'Uploaded by strava-ruby-client.',
717
- data_type: 'tcx',
718
- external_id: 'strava-ruby-client-upload-1'
719
- ) # => Strava::Models::Upload
720
-
721
- upload.id # => 2136460097
722
- upload.external_id # => 'strava-ruby-client-upload-1.tcx'
723
- upload.error # => nil
724
- upload.status # => 'Your activity is still being processed.'
725
- upload.activity_id # => nil
726
- ```
727
-
728
- See [Strava::Models::Upload](lib/strava/models/upload.rb) for all available properties.
729
-
730
- #### Get Upload
731
-
732
- Returns an upload for a given identifier. Raises `Strava::Errors::UploadError` if the upload was faulty and did not result in a created activity. `Strava::Errors::UploadError#upload` contains `Strava::Models::Upload` for further inspection.
733
-
734
- ```ruby
735
- # happy path
736
- upload = client.upload(2136460097) # => Strava::Models::Upload
737
-
738
- upload.id # => 2_136_460_097
739
- upload.external_id # => 'strava-ruby-client-upload-1.tcx'
740
- upload.error # => nil
741
- upload.status # => 'Your activity is ready.'
742
- upload.activity_id # => 1_998_557_443
743
- ```
71
+ List APIs return one page by default. Pass `per_page` to retrieve all pages, `limit` to stop after a number of items, or a block to process items as pages arrive.
744
72
 
745
73
  ```ruby
746
- # with error after upload
747
- upload = client.upload(2136460097)
748
- begin
749
- while upload.processing?
750
- sleep 1
751
- upload = client.upload(2136460097)
752
- end
753
- rescue Strava::Errors::UploadError => upload_error
754
- upload_error.status # => 200
755
- upload_error.error_status # => 'There was an error processing your activity.'
756
- upload_error.message # => '17611540601.tcx duplicate of activity 8309312818'
757
-
758
- upload_error.upload.external_id # => nil
759
- upload_error.upload.activity_id # => nil
760
- upload_error.upload.status # => 'There was an error processing your activity.'
761
- upload_error.upload.error # => '17611540601.tcx duplicate of activity 8309312818'
762
- upload_error.upload.class # => Strava::Models::UploadFailed
74
+ client.athlete_activities(per_page: 30, limit: 50) do |activity|
75
+ activity # => Strava::Models::SummaryActivity
763
76
  end
764
77
  ```
765
78
 
766
- See [Strava::Models::Upload](lib/strava/models/upload.rb) for all available properties.
767
- See [Strava::Errors::UploadError](lib/strava/errors/upload_failed_error.rb) for all available properties.
768
-
769
- ### Pagination
79
+ ### Handle Errors
770
80
 
771
- Some Strava APIs, including [athlete-activities](#list-athlete-activities) support pagination when supplying an optional `page` and `per_page` parameter. By default the client retrieves one page of data, which Strava currently defaults to 30 items. If you supply `per_page`, the client will retrieve all pages. You can paginate through items incrementally by supplying a block. Use `limit` to limit the number of items returned. The underlying implementation makes page-sized calls and increments the `page` argument.
81
+ HTTP errors raise [Strava::Errors::Fault](lib/strava/errors/fault.rb), and exceeding rate limits raises [Strava::Errors::RatelimitError](lib/strava/errors/ratelimit_error.rb). Every response exposes rate limits.
772
82
 
773
83
  ```ruby
774
- client.athlete_activities(per_page: 30) do |activity|
775
- activity # => Strava::Models::Activity
776
- end
777
- ```
778
-
779
- ```ruby
780
- client.athlete_activities(per_page: 30) # => [Strava::Models::Activity], all pages
781
- client.athlete_activities(per_page: 30, limit: 50) # => [Strava::Models::Activity], all pages, stop at 50 items
782
- ```
783
-
784
- Some Strava APIs, including [activity-comments](#list-activity-comments) support cursor-based pagination when supplying optional `after_cursor` and `page_size` parameters. By default the client retrieves one page of data, which Strava currently defaults to 30 items. If you supply `page_size`, the client will retrieve all pages. You can paginate through items incrementally by supplying a block. Use `limit` to limit the number of items returned. The underlying implementation makes page-sized calls and uses the returned `cursor` as `after_cursor`.
785
-
786
- ```ruby
787
- client.activity_comments(id: 1982980795, page_size: 30) do |comment|
788
- comment # => Strava::Models::Comment
84
+ begin
85
+ athlete = client.athlete
86
+ athlete.http_response.ratelimit.fifteen_minutes_remaining # => 590
87
+ rescue Strava::Errors::Fault => e
88
+ e.message # => 'Authorization Error'
789
89
  end
790
90
  ```
791
91
 
792
- ```ruby
793
- client.activity_comments(id: 1982980795, page_size: 30) # => [Strava::Models::Comment], all pages
794
- client.activity_comments(id: 1982980795, page_size: 30, limit: 100) # => [Strava::Models::Comment], paginated, stop at 100 items
795
- ```
796
-
797
- ### OAuth
798
-
799
- #### OAuth Workflow
800
-
801
- Obtain a redirect URL using an instance of `Strava::OAuth::Client`.
802
-
803
- ```ruby
804
- client = Strava::OAuth::Client.new(
805
- client_id: "12345",
806
- client_secret: "12345678987654321"
807
- )
808
-
809
- redirect_url = client.authorize_url(
810
- redirect_uri: 'https://example.com/oauth',
811
- approval_prompt: 'force',
812
- response_type: 'code',
813
- scope: 'activity:read_all',
814
- state: 'magic'
815
- )
816
- ```
817
-
818
- Once the user is redirected to your application, perform a token exchange to obtain a refresh and access token.
819
-
820
- ```ruby
821
- response = client.oauth_token(code: '1234556789901234567890')
822
-
823
- response # => Strava::Models::Token
824
-
825
- response.access_token # access token
826
- response.refresh_token # refresh token
827
- response.expires_at # timestamp when the access token expires
828
- response.athlete # => Strava::Models::SummaryAthlete
829
- ```
830
-
831
- See [Strava authentication documentation](https://developers.strava.com/docs/authentication/), [Strava::Models::Token](lib/strava/models/token.rb) and [Strava::Models::SummaryAthlete](lib/strava/models/summary_athlete.rb) for all available properties in the response.
832
-
833
- If the access token is expired, refresh it before making any requests. You will get back all new tokens.
834
-
835
- ```ruby
836
- response = client.oauth_token(
837
- refresh_token: '...',
838
- grant_type: 'refresh_token'
839
- )
840
-
841
- response.access_token # => String, new access token
842
- response.refresh_token # => String, new refresh token
843
- response.expires_at # => Time, new timestamp when the access token expires
844
- ```
845
-
846
- #### Revoke
847
-
848
- Revoke access to an athlete's data using an instance of `Strava::API::Client`.
849
-
850
- ```ruby
851
- authorization = client.revoke
852
-
853
- authorization.access_token # => String, access token being revoked
854
- ```
855
-
856
- #### Deauthorize
857
-
858
- Revoke access to an athlete's data using an instance of `Strava::API::Client`.
859
-
860
- ```ruby
861
- authorization = client.deauthorize
862
-
863
- authorization.access_token # => String, access token being revoked
864
- ```
865
-
866
- _Deprecated: use [`revoke`](#revoke) instead. The `oauth/deauthorize` endpoint will be retired on June 1, 2027 in favor of `oauth/revoke`._
867
-
868
- #### Command Line OAuth Workflow
869
-
870
- The OAuth process is web-based and you cannot obtain a token from a Strava client ID and secret without user intervention. You can, however, start a local web server to handle the OAuth redirect and open a browser from the command-line.
871
-
872
- See [strava-oauth-token](/bin/strava-oauth-token) or [strava-ruby-cli](https://github.com/dblock/strava-ruby-cli) for an example.
873
-
874
- ### Webhooks
875
-
876
- Strava provides a [Webhook Event API](https://developers.strava.com/docs/webhooks/).
877
-
878
- A complete example that handles subscription creation, deletion and handling can be found in [strava-webhooks](bin/strava-webhooks). Run `strava-webhooks` to see current registrations, `strava-webhooks handle` to run an HTTP server that handles both challenges and event data, `strava-webhooks create [url]` to create a new subscription and `strava-webhooks delete [id]` to delete it.
879
-
880
- Before creating a webhook subscription you must implement and run an HTTP server that will handle a `GET` challenge at the subscription URL.
881
-
882
- ```ruby
883
- challenge = Strava::Webhooks::Models::Challenge.new(request.query)
884
- raise 'Bad Request' unless challenge.verify_token == 'token'
885
- response.content_type = 'application/json'
886
- response.body = challenge.response.to_json
887
- ```
888
-
889
- See [Strava::Webhooks::Models::Challenge](lib/strava/webhooks/models/challenge.rb) for details.
890
-
891
- An existing subscription must be handled in the same HTTP server's `POST` request to the subscription URL.
892
-
893
- ```ruby
894
- event = Strava::Webhooks::Models::Event.new(JSON.parse(request.body))
895
-
896
- event # => Strava::Webhooks::Models::Event
897
- event.object_type # => 'activity'
898
- event.id # => 1991813808
899
- event.aspect_type # => 'update'
900
- event.updates # => { 'sport_type' => 'Walk' }
901
- event.owner_id # => 29323238
902
- event.subscription_id # => 131302
903
- event.event_time # => DateTime
904
- ```
905
-
906
- See [Strava::Webhooks::Models::Event](lib/strava/webhooks/models/event.rb) for details.
907
-
908
- Subscriptions can be created, listed and deleted.
909
-
910
- Create a client.
911
-
912
- ```ruby
913
- client = Strava::Webhooks::Client.new(
914
- client_id: "12345",
915
- client_secret: "12345678987654321"
916
- )
917
- ```
918
-
919
- Create a subscription.
920
-
921
- ```ruby
922
- subscription = client.create_push_subscription(callback_url: 'http://example.com/strava', verify_token: 'token')
923
-
924
- subscription # => Strava::Webhooks::Models::Subscription
925
- subscription.id # => 131300
926
- subscription.callback_url # => 'http://example.com/strava'
927
- ```
928
-
929
- See [Strava::Webhooks::Models::Subscription](lib/strava/webhooks/models/subscription.rb) for details.
930
-
931
- List an existing subscription. Strava seems to only allow one.
932
-
933
- ```ruby
934
- subscriptions = client.push_subscriptions
935
-
936
- subscription = subscriptions.first # => Strava::Webhooks::Models::Subscription
937
- subscription.id # => 131300
938
- subscription.callback_url # => 'http://example.com/strava'
939
- ```
940
-
941
- Delete an existing subscription.
942
-
943
- ```ruby
944
- client.delete_push_subscription(131300) # => nil
945
- ```
946
-
947
- ### Ratelimit
948
-
949
- Every API call's HTTP Reponse Content, be it a single Model or a list (via pagination), can be accessed by using `#http_response`.
950
-
951
- `client.athlete` #=> `Strava::Models::Athlete#http_response`
952
-
953
- `client.activity_comments(id: 1234567)` #=> `Array<Strava::Models::Comment>#http_response`
954
-
955
- `http_response` itself is a `Strava::Web::ApiResponse` class. Ratelimits are accessed via this class using `Strava::Web::ApiResponse#ratelimit`. See the examples given below:
956
-
957
- ```ruby
958
- comments = client.activity_comments(id: 123_456_789)
959
-
960
- # comments == Array<Strava::Models::Comment>
961
- comments.http_response.ratelimit.to_h
962
- ```
963
-
964
- ```ruby
965
- athlete = client.athlete # => Strava::Models::Athlete
966
- athlete.http_response.ratelimit
967
- ```
92
+ ### More
968
93
 
969
- The following properties are available on [Strava::Api::Ratelimit](lib/strava/api/ratelimit.rb).
970
-
971
- - `limit`
972
- - `limit?`
973
- - `usage`
974
- - `fifteen_minutes`
975
- - `fifteen_minutes_usage`
976
- - `fifteen_minutes_remaining`
977
- - `total_day`
978
- - `total_day_usage`
979
- - `total_day_remaining`
980
- - `to_h`
981
- - `to_s`
982
-
983
- You can access the Hash containing all limits by calling `to_h`.
984
-
985
- ```ruby
986
- # athlete.http_response.ratelimit.to_h
987
- {
988
- limit: limit,
989
- usage: usage,
990
- total_day: total_day,
991
- total_day_usage: total_day_usage,
992
- total_day_remaining: total_day_remaining,
993
- fifteen_minutes: fifteen_minutes,
994
- fifteen_minutes_usage: fifteen_minutes_usage,
995
- fifteen_minutes_remaining: fifteen_minutes_remaining
996
- }
997
- ```
998
-
999
- #### Exceeded Ratelimit
1000
-
1001
- Strava answers with HTTP status code 429, when ratelimits are exceeded. This will in return raise `Strava::Errors::RatelimitError`.
1002
-
1003
- ```ruby
1004
- error.is_a?(Strava::Errors::RatelimitError) #=> true
1005
- error.ratelimit.is_a?(Strava::Api::Ratelimit) #=> true
1006
- # see Strava::Api::Ratelimit
1007
- ```
94
+ See [docs/USAGE.md](docs/USAGE.md) for all APIs, including activities, athletes, clubs, gear, routes, segments, streams, uploads, OAuth, webhooks, pagination, rate limits and errors.
1008
95
 
1009
96
  ## Configuration
1010
97
 
@@ -1020,15 +107,17 @@ end
1020
107
 
1021
108
  The following settings are supported.
1022
109
 
1023
- | setting | description |
1024
- | ------------ | ----------------------------------------------------- |
1025
- | user_agent | User-agent, defaults to _Strava Ruby Client/version_. |
1026
- | proxy | Optional HTTP proxy. |
1027
- | ca_path | Optional SSL certificates path. |
1028
- | ca_file | Optional SSL certificates file. |
1029
- | logger | Optional `Logger` instance that logs HTTP requests. |
1030
- | timeout | Optional open/read timeout in seconds. |
1031
- | open_timeout | Optional connection open timeout in seconds. |
110
+ | setting | description |
111
+ | ------------------ | --------------------------------------------------------------------------------- |
112
+ | user_agent | User-agent, defaults to _Strava Ruby Client/version_. |
113
+ | proxy | Optional HTTP proxy. |
114
+ | ca_path | Optional SSL certificates path. |
115
+ | ca_file | Optional SSL certificates file. |
116
+ | logger | Optional `Logger` instance that logs HTTP requests. |
117
+ | timeout | Optional open/read timeout in seconds. |
118
+ | open_timeout | Optional connection open timeout in seconds. |
119
+ | log_formatter | Optional `Faraday::Logging::Formatter` class, e.g. `Strava::Web::LogFormatter`. |
120
+ | filter_credentials | Filter client secrets, tokens and codes from logs and errors, defaults to `true`. |
1032
121
 
1033
122
  ### API Client Options
1034
123
 
@@ -1108,26 +197,6 @@ The following settings are supported.
1108
197
  | client_secret | Application client secret. |
1109
198
  | endpoint | Defaults to `https://www.strava.com/api/v3`. |
1110
199
 
1111
- ## Errors
1112
-
1113
- All errors that return HTTP codes 400-600 result in either `Faraday::ResourceNotFound`, `Faraday::ConnectionFailed` or [Strava::Errors::Fault](lib/strava/errors/fault.rb) exceptions.
1114
-
1115
- ```ruby
1116
- begin
1117
- client.oauth_token(code: 'invalid')
1118
- rescue Strava::Errors::Fault => e
1119
- e.message # => Bad Request
1120
- e.errors # => [{ 'code' => 'invalid', 'field' => 'code', 'resource' => 'RequestToken' }]
1121
- e.headers # => { "status" => "403 Bad Request", "x-ratelimit-limit" => "600,30000", "x-ratelimit-usage" => "314,27536" }
1122
- end
1123
- ```
1124
-
1125
- 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`.
1126
-
1127
- ```ruby
1128
- Strava::Web::RaiseResponseError::DEFAULT_OPTIONS = { include_request: false }
1129
- ```
1130
-
1131
200
  ## Tools
1132
201
 
1133
202
  For a complete set of command-line tools, check out [strava-ruby-cli](https://github.com/dblock/strava-ruby-cli) built on top of this gem.
@@ -1163,13 +232,9 @@ STRAVA_CLIENT_ID=... STRAVA_CLIENT_SECRET=... STRAVA_API_REFRESH_TOKEN=... strav
1163
232
  - [Auto-Publishing Strava Runs to Github Pages](https://code.dblock.org/2018/02/17/auto-publishing-strava-runs-to-github-pages.html)
1164
233
  - [Strava Command-Line Client](https://github.com/dblock/strava-ruby-cli)
1165
234
 
1166
- ## Upgrading
1167
-
1168
- See [UPGRADING](UPGRADING.md).
1169
-
1170
235
  ## Contributing
1171
236
 
1172
- See [CONTRIBUTING](CONTRIBUTING.md).
237
+ See [CONTRIBUTING](CONTRIBUTING.md), [CHANGELOG](CHANGELOG.md), [UPGRADING](UPGRADING.md) and [RELEASING](RELEASING.md).
1173
238
 
1174
239
  ## Copyright and License
1175
240