class SBF::Client::EventEndpoint
Public Instance Methods
get(id, year, with = {})
click to toggle source
Calls superclass method
SBF::Client::EntityEndpoint#get
# File lib/stbaldricks/endpoints/event.rb, line 6 def get(id, year, with = {}) super("#{id}/#{year}", with) end
invite(id, year, participant_data)
click to toggle source
# 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 = {})
click to toggle source
# 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 = {})
click to toggle source
Calls superclass method
SBF::Client::EntityEndpoint#update
# File lib/stbaldricks/endpoints/event.rb, line 22 def update(id, year, data, with = {}) super("#{id}/#{year}", data, with) end