Module: StravaApi::Rides

Included in:
Base
Defined in:
lib/strava-api/rides.rb

Instance Method Summary collapse

Instance Method Details

#ride_efforts(id) ⇒ Object

returns all efforts, don’t need an offset



33
34
35
36
37
# File 'lib/strava-api/rides.rb', line 33

def ride_efforts(id)
  result = call("rides/#{id}/efforts", "efforts", {})

  result["efforts"].collect {|effort| Effort.new(self, effort)}
end

#ride_show(id) ⇒ Object



26
27
28
29
30
# File 'lib/strava-api/rides.rb', line 26

def ride_show(id)
  result = call("rides/#{id}", "ride", {})

  Ride.new(self, result["ride"])
end

#ride_streams(id) ⇒ Object



39
40
41
42
# File 'lib/strava-api/rides.rb', line 39

def ride_streams(id)
  result = call("streams/#{id}", nil, {})
  Streams.new(self, result.to_hash)
end

#rides(options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/strava-api/rides.rb', line 3

def rides(options = {})
  options_map = {
    :club_id => 'clubId',
    :athlete_id => 'athleteId',
    :athlete_name => 'athleteName',
    :start_date => 'startDate',
    :end_date => 'endDate',
    :start_id => 'startId',
    :offset => 'offset'
  }
  
  #convert between rails format names and camel case
  filtered_options = {}
  options_map.each_pair do |key, converted|
    filtered_options[converted] = options[key] if options[key]
  end

  raise StravaApi::CommandError if filtered_options.empty?

  result = call("rides", "rides", filtered_options)
  result["rides"].collect {|item| Ride.new(self, item)}
end