Sha256: e71c8c8695b480a2147a67d037274de884becaffc096664ad98a2aacd179d862

Contents?: true

Size: 542 Bytes

Versions: 1

Compression:

Stored size: 542 Bytes

Contents

require 'strava/v2/models/segment'

module Strava
  module V2
    module SegmentsRequest
      def segments_and_efforts_for_ride_path(ride_id)
        "rides/#{ride_id}/efforts"
      end

      def segments_and_efforts_for_ride(ride_id)
        all_json = self.fetch(segments_and_efforts_for_ride_path(ride_id), {})
        all_segments = []
        all_json["efforts"].each { |effort_json|
          all_segments.push(Segment.new(effort_json["segment"], [effort_json["effort"]]))
        }
        all_segments
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
strava-api-v2-0.1 lib/strava/v2/segments_request.rb