Class: SBF::Client::EventEndpoint
Instance Attribute Summary
#orig_target_class
Instance Method Summary
collapse
#aggregate, #create, #delete, #find, #find_first, #initialize
Instance Method Details
#get(id, year, with = {}) ⇒ Object
6
7
8
|
# File 'lib/stbaldricks/endpoints/event.rb', line 6
def get(id, year, with = {})
super("#{id}/#{year}", with)
end
|
#invite(id, year, participant_data) ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/stbaldricks/endpoints/event.rb', line 26
def invite(id, year, participant_data)
event_data = {id: id, year: year}
participant_data.store(:event, event_data)
response = SBF::Client::Api::Request.post_request("#{base_uri}/invite", participant_data)
unless ok?(response)
parsed_response_body = JSON.parse(response.body).symbolize!
error = SBF::Client::ErrorEntity.new(parsed_response_body)
end
SBF::Client::Api::Response.new(http_code: response.code, data: nil, error: error)
end
|
#save(entity_or_hash, with = {}) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/stbaldricks/endpoints/event.rb', line 10
def save(entity_or_hash, with = {})
if entity_or_hash.is_a?(SBF::Client::BaseEntity)
return create(entity_or_hash, with) if entity_or_hash.id.nil?
update(entity_or_hash.id, entity_or_hash.year, entity_or_hash.dirty_data, with)
else
return create(entity_or_hash, with) if entity_or_hash[:id].nil?
update(entity_or_hash[:id], entity_or_hash[:year], entity_or_hash, with)
end
end
|
#update(id, year, data, with = {}) ⇒ Object
22
23
24
|
# File 'lib/stbaldricks/endpoints/event.rb', line 22
def update(id, year, data, with = {})
super("#{id}/#{year}", data, with)
end
|