Class: Strava::SegmentEffort
- Inherits:
-
Base
- Object
- Base
- Strava::SegmentEffort
show all
- Defined in:
- lib/strava/segment_effort.rb
Instance Attribute Summary collapse
Attributes inherited from Base
#client, #id, #response
Instance Method Summary
collapse
Methods inherited from Base
#detailed?, #initialize, #resource_state, resource_states, #summary?
Constructor Details
This class inherits a constructor from Strava::Base
Instance Attribute Details
#segment ⇒ Object
5
6
7
|
# File 'lib/strava/segment_effort.rb', line 5
def segment
@segment
end
|
Instance Method Details
#get_details ⇒ Object
23
24
25
26
27
28
|
# File 'lib/strava/segment_effort.rb', line 23
def get_details
return self if detailed?
res = client.get(path_base).to_h
update(res)
res
end
|
#get_streams(types = '', **params) ⇒ Object
30
31
32
33
|
# File 'lib/strava/segment_effort.rb', line 30
def get_streams(types = '', **params)
res = client.get(path_streams + types.join(','), **params).to_a
@streams.update(res)
end
|
#path_base ⇒ Object
34
35
36
|
# File 'lib/strava/segment_effort.rb', line 34
def path_base
"segment_efforts/#{id}"
end
|
#path_streams ⇒ Object
37
38
39
|
# File 'lib/strava/segment_effort.rb', line 37
def path_streams
"#{path_base}/streams/"
end
|
#set_ivars ⇒ Object
7
8
9
|
# File 'lib/strava/segment_effort.rb', line 7
def set_ivars
@streams = StreamSet.new
end
|
#streams(types = [:time, :distance, :latlng], **params) ⇒ Object
18
19
20
21
|
# File 'lib/strava/segment_effort.rb', line 18
def streams(types = [:time, :distance, :latlng], **params)
get_streams(types, **params) if @streams.empty?
@streams
end
|
#update(data, **opts) ⇒ Object
11
12
13
14
15
16
|
# File 'lib/strava/segment_effort.rb', line 11
def update(data, **opts)
@response = data
@id = data["id"]
@resource_state = data['resource_state']
@segment = Segment.new(data['segment'], client: @client) if data['segment']
end
|