Class: Strava::Route
- Inherits:
-
Base
- Object
- Base
- Strava::Route
show all
- Defined in:
- lib/strava/route.rb
Instance Attribute Summary
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 Method Details
#get_details ⇒ Object
22
23
24
25
26
27
|
# File 'lib/strava/route.rb', line 22
def get_details
return self if detailed?
res = client.get(path_base).to_h
update(res)
res
end
|
#get_streams(**params) ⇒ Object
29
30
31
32
|
# File 'lib/strava/route.rb', line 29
def get_streams(**params)
res = client.get(path_streams, **params).to_a
@streams.update(res)
end
|
#path_base ⇒ Object
34
35
36
|
# File 'lib/strava/route.rb', line 34
def path_base
"routes/#{id}"
end
|
#path_streams ⇒ Object
38
39
40
|
# File 'lib/strava/route.rb', line 38
def path_streams
"#{path_base}/streams/"
end
|
#set_ivars ⇒ Object
6
7
8
|
# File 'lib/strava/route.rb', line 6
def set_ivars
@streams = StreamSet.new
end
|
#streams(**params) ⇒ Object
17
18
19
20
|
# File 'lib/strava/route.rb', line 17
def streams(**params)
get_streams(**params) if @streams.empty?
@streams
end
|
#update(data, **opts) ⇒ Object
10
11
12
13
14
15
|
# File 'lib/strava/route.rb', line 10
def update(data, **opts)
@response = data
@id = data["id"]
@resource_state = data['resource_state']
self
end
|