Module: Strava::Api::Endpoints::Activities
- Included in:
- Client
- Defined in:
- lib/strava/api/endpoints/activities.rb
Instance Method Summary collapse
-
#activity(id_or_options, options = {}) ⇒ Object
Get activity.
-
#activity_comments(id_or_options, options = {}, &block) ⇒ Object
List activity comments.
-
#activity_kudos(id_or_options, options = {}, &block) ⇒ Object
List activity kudoers.
-
#activity_laps(id_or_options, options = {}) ⇒ Object
Get activity laps.
-
#activity_photos(id_or_options, options = {}, &block) ⇒ Object
List activity photos.
-
#activity_zones(id_or_options, options = {}) ⇒ Object
Get activity zones.
-
#athlete_activities(options = {}, &block) ⇒ Object
List logged-in athlete activities.
-
#create_activity(options = {}) ⇒ Object
Create an activity.
-
#update_activity(id_or_options, options = {}) ⇒ Object
Update an activity.
Instance Method Details
#activity(id_or_options, options = {}) ⇒ Object
Get activity.
20 21 22 23 |
# File 'lib/strava/api/endpoints/activities.rb', line 20 def activity(, = {}) id, = parse_args(, ) Strava::Models::DetailedActivity.new(get("activities/#{id}", )) end |
#activity_comments(id_or_options, options = {}, &block) ⇒ Object
List activity comments.
38 39 40 41 |
# File 'lib/strava/api/endpoints/activities.rb', line 38 def activity_comments(, = {}, &block) id, = parse_args(, ) paginate_with_cursor "activities/#{id}/comments", , Strava::Models::Comment, &block end |
#activity_kudos(id_or_options, options = {}, &block) ⇒ Object
List activity kudoers.
69 70 71 72 |
# File 'lib/strava/api/endpoints/activities.rb', line 69 def activity_kudos(, = {}, &block) id, = parse_args(, ) paginate "activities/#{id}/kudos", , Strava::Models::SummaryAthlete, &block end |
#activity_laps(id_or_options, options = {}) ⇒ Object
Get activity laps.
80 81 82 83 84 85 |
# File 'lib/strava/api/endpoints/activities.rb', line 80 def activity_laps(, = {}) id, = parse_args(, ) get("activities/#{id}/laps", ).map do |row| Strava::Models::Lap.new(row) end end |
#activity_photos(id_or_options, options = {}, &block) ⇒ Object
List activity photos.
53 54 55 56 57 |
# File 'lib/strava/api/endpoints/activities.rb', line 53 def activity_photos(, = {}, &block) id, = parse_args(, ) [:size] = 5000 unless [:size] # to retrieve full size photos paginate "activities/#{id}/photos", , Strava::Models::DetailedPhoto, &block end |
#activity_zones(id_or_options, options = {}) ⇒ Object
Get activity zones.
112 113 114 115 116 117 |
# File 'lib/strava/api/endpoints/activities.rb', line 112 def activity_zones(, = {}) id, = parse_args(, ) get("activities/#{id}/zones", ).map do |row| Strava::Models::ActivityZone.new(row) end end |
#athlete_activities(options = {}, &block) ⇒ Object
List logged-in athlete activities.
99 100 101 102 103 104 |
# File 'lib/strava/api/endpoints/activities.rb', line 99 def athlete_activities( = {}, &block) = .dup if .key?(:after) || .key?(:before) [:after] = [:after].to_i if [:after] [:before] = [:before].to_i if [:before] paginate 'athlete/activities', , Strava::Models::SummaryActivity, &block end |
#create_activity(options = {}) ⇒ Object
Create an activity.
10 11 12 |
# File 'lib/strava/api/endpoints/activities.rb', line 10 def create_activity( = {}) Strava::Models::DetailedActivity.new(post('activities', )) end |
#update_activity(id_or_options, options = {}) ⇒ Object
Update an activity.
137 138 139 140 |
# File 'lib/strava/api/endpoints/activities.rb', line 137 def update_activity(, = {}) id, = parse_args(, ) Strava::Models::DetailedActivity.new(put("activities/#{id}", )) end |