Module: Strava::Api::Endpoints::Segments
- Included in:
- Client
- Defined in:
- lib/strava/api/endpoints/segments.rb
Instance Method Summary collapse
-
#explore_segments(options = {}) ⇒ Object
Returns the top 10 segments matching a specified query.
-
#segment(id_or_options, options = {}) ⇒ Object
Returns the specified segment.
-
#star_segment(id_or_options, options = {}) ⇒ Object
Stars/Unstars the given segment for the authenticated athlete.
-
#starred_segments(options = {}, &block) ⇒ Object
List of the authenticated athlete’s starred segments.
Instance Method Details
#explore_segments(options = {}) ⇒ Object
Returns the top 10 segments matching a specified query.
19 20 21 22 23 24 25 26 |
# File 'lib/strava/api/endpoints/segments.rb', line 19 def explore_segments( = {}) throw ArgumentError.new('Required argument :bounds missing') if [:bounds].nil? bounds = [:bounds] bounds = bounds.map(&:to_s).join(',') if bounds.is_a?(Array) get('segments/explore', .merge(bounds: bounds))['segments'].map do |row| Strava::Models::ExplorerSegment.new(row) end end |
#segment(id_or_options, options = {}) ⇒ Object
Returns the specified segment.
46 47 48 49 |
# File 'lib/strava/api/endpoints/segments.rb', line 46 def segment(, = {}) id, = parse_args(, ) Strava::Models::Segment.new(get("segments/#{id}", )) end |
#star_segment(id_or_options, options = {}) ⇒ Object
Stars/Unstars the given segment for the authenticated athlete.
59 60 61 62 63 |
# File 'lib/strava/api/endpoints/segments.rb', line 59 def star_segment(, = {}) id, = parse_args(, ) throw ArgumentError.new('Required argument :starred missing') if [:starred].nil? Strava::Models::Segment.new(put("segments/#{id}/starred", )) end |