This gem provides a wrapper around the Strava API V3 - http://strava.github.io/api/
gem install 'strava-api-v3'
At this point you will need to have the user authorise your application using OAuth2.
@client = Strava::Api::V3::Client.new(:access_token => "MY_ACCESS_TOKEN")
Each method returns a JSON object - see http://strava.github.io/api/v3/activities/ for more info
@client.retrieve_an_activity(:some_id)
@client.list_athlete_activities
@client.list_friends_activities
@client.list_activity_zones(:some_id)
@client.list_activity_laps(:some_id)
Each method returns a JSON object of respective type - see http://strava.github.io/api/v3/comments/, http://strava.github.io/api/v3/kudos/ and http://strava.github.io/api/v3/photos/ for more info
@client.list_activity_comments(:activity_id)
@client.list_activity_kudos(:activity_id)
@client.list_activity_photos(:activity_id) # only if you created the activity...
Each method returns a JSON object - see http://strava.github.io/api/v3/athlete/ for more info
@client.retrieve_current_athlete # fetch the authenticated athlete
@client.retrieve_another_athlete(:some_id) # fetch another athlete by id
@client.list_athlete_segment_efforts(:some_id) # fetch K/QOMs/CRs for another athlete by id
@client.list_athlete_friends # fetch friends list
@client.list_specific_athlete_friends(:some_id) # fetch friends list another athlete by id
@client.totals_and_stats(:some_id) # fetch athlete totals and stats
Each method returns a JSON object - see http://strava.github.io/api/v3/clubs/ for more info
@client.retrieve_a_club(:some_id)
@client.list_athlete_clubs
@client.list_club_members(:some_id)
@client.list_club_activities(:some_id)
Each method returns a JSON object - see http://strava.github.io/api/v3/gear/ for more info
@client.retrieve_gear(:some_id)
Each method returns a JSON object - see http://strava.github.io/api/v3/routes/ for more info
@client.retrieve_a_route(:some_id)
@client.list_athlete_route
Each method returns a JSON object - see http://strava.github.io/api/v3/segments/ for more info
@client.retrieve_a_segment(:some_id)
@client.list_starred_segment
@client.segment_leaderboards(:some_id)
@client.segment_explorer
Each method returns a JSON object - see http://strava.github.io/api/v3/efforts/ for more info
@client.retrieve_a_segment_effort(:some_id)
Each method returns a JSON object - see http://strava.github.io/api/v3/streams/ for more info
@client.retrieve_activity_streams(:some_id)
@client.retrieve_effort_streams(:some_id)
@client.retrieve_route_streams(:some_id)
@client.retrieve_segment_streams(:some_id)
Support for uploading activity files (FIT, TCX and GPX file types are supported by Strava. See https://strava.github.io/api/v3/uploads/ for more info
# Prepare options for upload
options = {}
options[:activity_type] = 'ride'
options[:data_type] = 'tcx'
# Open the file from the file systems
options[:file] = File.new('myfile.tcx')
# Submit upload and get upload ID
status = @client.upload_an_activity(options)
upload_id = status['id']
# Re-poll for status
status = @client.retrieve_upload_status(upload_id)
- Jared Holdcroft
- James Chevalier