module Strava::Api::Endpoints::Activities
Public Instance Methods
Get activity.
@option options [String] :id
Activity id.
# File lib/strava/api/endpoints/activities.rb, line 18 def activity(id_or_options, options = {}) id, options = parse_args(id_or_options, options) Strava::Models::Activity.new(get("activities/#{id}", options)) end
List activity comments.
@option options [String] :id
Activity id.
@option options [Integer] :page
Page number.
@option options [Integer] :per_page
Number of items per page. Defaults to 30
# File lib/strava/api/endpoints/activities.rb, line 33 def activity_comments(id_or_options, options = {}, &block) id, options = parse_args(id_or_options, options) paginate "activities/#{id}/comments", options, Strava::Models::Comment, &block end
List activity kudoers.
@option options [String] :id
Activity id.
@option options [Integer] :page
Page number.
@option options [Integer] :per_page
Number of items per page. Defaults to 30
# File lib/strava/api/endpoints/activities.rb, line 63 def activity_kudos(id_or_options, options = {}, &block) id, options = parse_args(id_or_options, options) paginate "activities/#{id}/kudos", options, Strava::Models::Athlete, &block end
Get activity laps.
@option options [String] :id
Activity id.
# File lib/strava/api/endpoints/activities.rb, line 74 def activity_laps(id_or_options, options = {}) id, options = parse_args(id_or_options, options) get("activities/#{id}/laps", options).map do |row| Strava::Models::Lap.new(row) end end
List activity photos.
@option options [String] :id
Activity id.
@option options [Integer] :page
Page number.
@option options [Integer] :per_page
Number of items per page. Defaults to 30
# File lib/strava/api/endpoints/activities.rb, line 48 def activity_photos(id_or_options, options = {}, &block) id, options = parse_args(id_or_options, options) paginate "activities/#{id}/photos", options, Strava::Models::Photo, &block end
Get activity zones.
@option options [String] :id
Activity id.
# File lib/strava/api/endpoints/activities.rb, line 106 def activity_zones(id_or_options, options = {}) id, options = parse_args(id_or_options, options) get("activities/#{id}/zones", options).map do |row| Strava::Models::ActivityZone.new(row) end end
List logged-in athlete activities.
@option options [Integer] :before
An epoch timestamp to use for filtering activities that have taken place before a certain time.
@option options [Integer] :after
An epoch timestamp to use for filtering activities that have taken place after a certain time.
@option options [Integer] :page
Page number.
@option options [Integer] :per_page
Number of items per page. Defaults to 30
# File lib/strava/api/endpoints/activities.rb, line 93 def athlete_activities(options = {}, &block) options = options.dup if options.key?(:after) || options.key?(:before) options[:after] = options[:after].to_i if options[:after] options[:before] = options[:before].to_i if options[:before] paginate 'athlete/activities', options, Strava::Models::Activity, &block end
Create an activity.
# File lib/strava/api/endpoints/activities.rb, line 8 def create_activity(options = {}) Strava::Models::Activity.new(post('activities', options)) end
Update an activity.
@option options [String] :id
Activity id.
@option options [Boolean] :commute
Whether this activity is a commute.
@option options [Boolean] :trainer
Whether this activity was recorded on a training machine.
@option options [String] :description
The description of the activity.
@option options [String] :name
The name of the activity.
@option options [String] :type
Activity type.
@option options [String] :gear_id
Identifier for the gear associated with the activity. Specifying "none" clears gear from activity.
# File lib/strava/api/endpoints/activities.rb, line 131 def update_activity(id_or_options, options = {}) id, options = parse_args(id_or_options, options) Strava::Models::Activity.new(put("activities/#{id}", options)) end