Module: Strava::V1::SegmentRequest
- Included in:
- Connection
- Defined in:
- lib/strava/v1/segments_request.rb
Constant Summary collapse
- SEGMENT_PARAMS_MAP =
{ :club_id => :clubId, :athlete_id => :athleteId, :athlete_name => :athleteName, :start_date => :startDate, :end_date => :endDate, :start_id => :startId, :best => :best }
Instance Method Summary collapse
Instance Method Details
#efforts_for_segment_path(id) ⇒ Object
16 17 18 |
# File 'lib/strava/v1/segments_request.rb', line 16 def efforts_for_segment_path(id) "segments/#{id}/efforts" end |
#segment_with_efforts(id, params = {}) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/strava/v1/segments_request.rb', line 20 def segment_with_efforts(id, params = {}) final_params = {} params.each_pair do |key, value| raise RequestError.new if SEGMENT_PARAMS_MAP[key].nil? final_params[SEGMENT_PARAMS_MAP[key]] = value end all_json = self.fetch(efforts_for_segment_path(id), final_params) Segment.new(all_json["segment"], all_json["efforts"]) end |