Class: Strava::GroupEvent
Overview
Group events for Strava Clubs
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #athletes(per_page: nil, page: nil) ⇒ Object
- #delete ⇒ Object
- #get_details ⇒ Object
-
#join ⇒ Object
"active"=>false.
-
#leave ⇒ Object
"active"=>true, "membership"=>"member".
- #update(data, **opts) ⇒ Object
Methods inherited from Base
#detailed?, #initialize, #resource_state, resource_states, #summary?
Constructor Details
This class inherits a constructor from Strava::Base
Instance Method Details
#athletes(per_page: nil, page: nil) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/strava/group_event.rb', line 20 def athletes(per_page: nil, page: nil) if page || per_page get_athletes(per_page: per_page, page: page) else get_athletes if @athletes.empty? @athletes.values end end |
#delete ⇒ Object
29 30 31 |
# File 'lib/strava/group_event.rb', line 29 def delete res = client.delete(path_base).to_h end |
#get_details ⇒ Object
13 14 15 16 17 18 |
# File 'lib/strava/group_event.rb', line 13 def get_details return self if detailed? res = client.get(path_base).to_h update(res) res end |
#join ⇒ Object
"active"=>false
34 35 36 |
# File 'lib/strava/group_event.rb', line 34 def join res = client.post(path_rsvp).to_h end |
#leave ⇒ Object
"active"=>true, "membership"=>"member"
39 40 41 |
# File 'lib/strava/group_event.rb', line 39 def leave res = client.delete(path_rsvp).to_h end |
#update(data, **opts) ⇒ Object
7 8 9 10 11 |
# File 'lib/strava/group_event.rb', line 7 def update(data, **opts) @response = data @id = data["id"] @resource_state = data['resource_state'] end |