Class: Strava::GroupEvent

Inherits:
Base
  • Object
show all
Defined in:
lib/strava/group_event.rb

Overview

Group events for Strava Clubs

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

#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

#deleteObject



29
30
31
# File 'lib/strava/group_event.rb', line 29

def delete
  res = client.delete(path_base).to_h
end

#get_detailsObject



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

#joinObject

"active"=>false



34
35
36
# File 'lib/strava/group_event.rb', line 34

def join
  res = client.post(path_rsvp).to_h
end

#leaveObject

"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