Sha256: 860ef63b6cbc133a1c9c374dcc3649de0d47f1d808a0a890a0fba63e714f77b7

Contents?: true

Size: 768 Bytes

Versions: 1

Compression:

Stored size: 768 Bytes

Contents

require 'strava/strava_response'
require 'strava/v2/models/effort'

module Strava
  module V2
    class Segment < StravaResponse
      attr_reader :id, :efforts, :name, :climb_category, :start_latlng, :end_latlng, :average_grade

      # include the efforts in the segment, if applicable
      # jb - the json for the segment
      # ejb - the json for the efforts, in a list
      def initialize(jb, ejb)
        @id = jb["id"]
        @name = jb["name"]
        @climb_category = jb["climb_category"]
        @start_latlng = jb["start_latlng"]
        @end_latlng = jb["end_latlng"]
        @average_grade = jb["avg_grade"]
        @efforts = []
        ejb.each { |effort_json|
          @efforts.push(Effort.new(effort_json))
        }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
strava-api-v2-0.1 lib/strava/v2/models/segment.rb