Class: Strava::V2::Segment

Inherits:
StravaResponse show all
Defined in:
lib/strava/v2/models/segment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(jb, ejb) ⇒ Segment

include the efforts in the segment, if applicable jb - the json for the segment ejb - the json for the efforts, in a list



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/strava/v2/models/segment.rb', line 12

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

Instance Attribute Details

#average_gradeObject (readonly)

Returns the value of attribute average_grade.



7
8
9
# File 'lib/strava/v2/models/segment.rb', line 7

def average_grade
  @average_grade
end

#climb_categoryObject (readonly)

Returns the value of attribute climb_category.



7
8
9
# File 'lib/strava/v2/models/segment.rb', line 7

def climb_category
  @climb_category
end

#effortsObject (readonly)

Returns the value of attribute efforts.



7
8
9
# File 'lib/strava/v2/models/segment.rb', line 7

def efforts
  @efforts
end

#end_latlngObject (readonly)

Returns the value of attribute end_latlng.



7
8
9
# File 'lib/strava/v2/models/segment.rb', line 7

def end_latlng
  @end_latlng
end

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/strava/v2/models/segment.rb', line 7

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/strava/v2/models/segment.rb', line 7

def name
  @name
end

#start_latlngObject (readonly)

Returns the value of attribute start_latlng.



7
8
9
# File 'lib/strava/v2/models/segment.rb', line 7

def start_latlng
  @start_latlng
end