Sha256: e1c986b2ccd93cf5a43d81e445eaf54e00053d65bc5c82a224370b3512e47868
Contents?: true
Size: 857 Bytes
Versions: 1
Compression:
Stored size: 857 Bytes
Contents
require 'strava/v1/models/segment' module Strava module V1 module SegmentRequest SEGMENT_PARAMS_MAP = { :club_id => :clubId, :athlete_id => :athleteId, :athlete_name => :athleteName, :start_date => :startDate, :end_date => :endDate, :start_id => :startId, :best => :best } def efforts_for_segment_path(id) "segments/#{id}/efforts" end 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 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
strava-api-v2-0.1 | lib/strava/v1/segments_request.rb |