Class: StravaApi::Ride

Inherits:
HashBasedStore show all
Defined in:
lib/strava-api/ride.rb

Overview

"timeZoneOffset":-8.0,
"elevationGain":1441.02,
"location":"San Francisco, CA",
"elapsedTime":14579,
"description":null,
"name":"02/28/10 San Francisco, CA",
"movingTime":12748,
"averageSpeed":23260.8064010041,
"athlete":{"username":"julianbill","name":"Julian Bill","id":1139,
"distance":82369.1,
"startDate":"2010-02-28T16:31:35Z",
"averageWatts":175.112,
"bike":Legend Ti","id":903,
"startDateLocal":"2010-02-28T08:31:35Z",
"id":77563,
"maximumSpeed":64251.72

}}

Constant Summary collapse

ATTRIBUTE_MAP =
{
  "timeZoneOffset" => :time_zone_offset,
  "elevationGain" => :elevation_gain, 
  "location" => :location,
  "elapsedTime" => :elapsed_time,
  "description" => :description,
  "name" => :name,
  "movingTime" => :moving_time,
  "averageSpeed" => :average_speed,
  "distance" => :distance,
  "startDate" => :start_date,
  "averageWatts" => :average_watts,
  "startDateLocal" => :start_date_local,
  "id" => :id,
  "maximumSpeed" => :maximum_speed,
  "athlete" => :athlete, 
  "bike" => :bike
}
NESTED_CLASS_MAP =
{ :athlete => Member, :bike => Bike }

Instance Method Summary collapse

Methods inherited from HashBasedStore

#[], #id, #merge, #method_missing, #to_s

Constructor Details

#initialize(connection, options = {}) ⇒ Ride

Returns a new instance of Ride.



42
43
44
# File 'lib/strava-api/ride.rb', line 42

def initialize(connection, options = {})
  super(connection, ATTRIBUTE_MAP, NESTED_CLASS_MAP, options)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class StravaApi::HashBasedStore

Instance Method Details

#effortsObject



51
52
53
# File 'lib/strava-api/ride.rb', line 51

def efforts
  @connection.ride_efforts(self.id)
end

#showObject



46
47
48
49
# File 'lib/strava-api/ride.rb', line 46

def show
  self.merge(@connection.ride_show(self.id))
  self
end

#streamsObject



55
56
57
# File 'lib/strava-api/ride.rb', line 55

def streams
  @connection.ride_streams(self.id)
end