Module: Strava::Api::Endpoints::Routes

Included in:
Client
Defined in:
lib/strava/api/endpoints/routes.rb

Overview

API endpoints for Strava routes.

Routes are manually-created paths on Strava that can be used for planning. Routes can be exported in GPX or TCX format and can include waypoints, elevation data, and other metadata.

Instance Method Summary collapse

Instance Method Details

#athlete_routes(id_or_options, options = {}, &block) ⇒ Object

Returns a list of the routes created by the authenticated athlete using their athlete ID.

Parameters:

  • id_or_options (String, Integer, Hash)

    Either an athlete ID or a hash of options including :id

  • options (Hash) (defaults to: {})

    Additional options (if first parameter is an ID)

Options Hash (options):

  • :page (Integer)

    Page number

  • :per_page (Integer)

    Number of items per page. Defaults to 30



57
58
59
60
# File 'lib/strava/api/endpoints/routes.rb', line 57

def athlete_routes(id_or_options, options = {}, &block)
  id, options = parse_args(id_or_options, options)
  paginate "athletes/#{id}/routes", options, Strava::Models::Route, &block
end

#export_route_gpx(id_or_options, options = {}) ⇒ Object

Returns a GPX file of the route.

Parameters:

  • id_or_options (String, Integer, Hash)

    Either a route ID or a hash of options including :id

  • options (Hash) (defaults to: {})

    Additional options (if first parameter is an ID)



22
23
24
25
# File 'lib/strava/api/endpoints/routes.rb', line 22

def export_route_gpx(id_or_options, options = {})
  id, options = parse_args(id_or_options, options)
  get("routes/#{id}/export_gpx", options).response
end

#export_route_tcx(id_or_options, options = {}) ⇒ Object

Returns a TCX file of the route.

Parameters:

  • id_or_options (String, Integer, Hash)

    Either a route ID or a hash of options including :id

  • options (Hash) (defaults to: {})

    Additional options (if first parameter is an ID)



33
34
35
36
# File 'lib/strava/api/endpoints/routes.rb', line 33

def export_route_tcx(id_or_options, options = {})
  id, options = parse_args(id_or_options, options)
  get("routes/#{id}/export_tcx", options).response
end

#route(id_or_options, options = {}) ⇒ Object

Returns a route using its identifier.

Parameters:

  • id_or_options (String, Integer, Hash)

    Either a route ID or a hash of options including :id

  • options (Hash) (defaults to: {})

    Additional options (if first parameter is an ID)



44
45
46
47
# File 'lib/strava/api/endpoints/routes.rb', line 44

def route(id_or_options, options = {})
  id, options = parse_args(id_or_options, options)
  Strava::Models::Route.new(get("routes/#{id}", options))
end