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_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::Activity.new(get("activities/#{id}", )) end |
#activity_comments(id_or_options, options = {}, &block) ⇒ Object
List activity comments.
35 36 37 38 |
# File 'lib/strava/api/endpoints/activities.rb', line 35 def activity_comments(, = {}, &block) id, = parse_args(, ) paginate "activities/#{id}/comments", , Strava::Models::Comment, &block end |
#activity_kudos(id_or_options, options = {}, &block) ⇒ Object
List activity kudoers.
50 51 52 53 |
# File 'lib/strava/api/endpoints/activities.rb', line 50 def activity_kudos(, = {}, &block) id, = parse_args(, ) paginate "activities/#{id}/kudos", , Strava::Models::Athlete, &block end |
#activity_laps(id_or_options, options = {}) ⇒ Object
Get activity laps.
61 62 63 64 65 66 |
# File 'lib/strava/api/endpoints/activities.rb', line 61 def activity_laps(, = {}) id, = parse_args(, ) get("activities/#{id}/laps", ).map do |row| Strava::Models::Lap.new(row) end end |
#activity_zones(id_or_options, options = {}) ⇒ Object
Get activity zones.
93 94 95 96 97 98 |
# File 'lib/strava/api/endpoints/activities.rb', line 93 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.
80 81 82 83 84 85 |
# File 'lib/strava/api/endpoints/activities.rb', line 80 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::Activity, &block end |