Class: StravaApi::Effort

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

Overview

"id"=>688432, 
"elapsedTime"=>598, 
"segment"=>{"name"=>"Panoramic to Pan Toll","id"=>156,

"athlete"=>Bill", "username"=>"jbill", "id"=>1139,
"averageSpeed"=>14317.7658862876,
"startDate"=>"2010-02-28T18:10:07Z", 
"timeZoneOffset"=>-8.0, 
"maximumSpeed"=>18894.384, 
"averageWatts"=>287.765, 
"elevationGain"=>151.408, 
"ride"=>San Francisco, CA", "id"=>77563, 
"movingTime"=>598, 
"distance"=>2344.82, 

"rank" => 1

}

Constant Summary collapse

ATTRIBUTE_MAP =
{
  "id" => :id,
  "elapsedTime" => :elapsed_time,
  "segment" => :segment,

  "athlete" => :athlete,
  "averageSpeed" => :average_speed,
  "startDate" => :start_date,
  "timeZoneOffset" => :time_zone_offset,
  "maximumSpeed" => :maximum_speed,
  "averageWatts"=> :average_watts,
  "elevationGain"=> :elevation_gain,
  "ride" => :ride,
  "movingTime" => :moving_time,
  "distance"=> :distance,
  "rank" => :rank
}
NESTED_CLASS_MAP =
{ :segment => Segment, :athlete => Member, :ride => Ride }

Instance Method Summary collapse

Methods inherited from HashBasedStore

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

Constructor Details

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

Returns a new instance of Effort.



41
42
43
# File 'lib/strava-api/effort.rb', line 41

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

#showObject



45
46
47
48
# File 'lib/strava-api/effort.rb', line 45

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