class SBF::Client::ParticipantEndpoint
Public Instance Methods
delete_role(participant_id, role)
click to toggle source
# File lib/stbaldricks/endpoints/participant.rb, line 49 def delete_role(participant_id, role) response = SBF::Client::Api::Request.post_request("#{base_uri}/delete_role", participant_id: participant_id, role: role) error = SBF::Client::ErrorEntity.new(JSON.parse(response.body).symbolize!) unless ok?(response) SBF::Client::Api::Response.new(http_code: response.code, data: nil, error: error) end
join_team(participant_id, new_team_id)
click to toggle source
# File lib/stbaldricks/endpoints/participant.rb, line 6 def join_team(participant_id, new_team_id) response = SBF::Client::Api::Request.post_request("#{base_uri}/move_to_different_team", id: participant_id, new_team_id: new_team_id) if ok?(response) data = SBF::Client::FullParticipant.new(JSON.parse(response.body).symbolize!) else error = SBF::Client::ErrorEntity.new(JSON.parse(response.body).symbolize!) end SBF::Client::Api::Response.new(http_code: response.code, data: data, error: error) end
leave_team(participant_id)
click to toggle source
# File lib/stbaldricks/endpoints/participant.rb, line 37 def leave_team(participant_id) response = SBF::Client::Api::Request.post_request("#{base_uri}/move_to_different_team", id: participant_id, new_team_id: 0) if ok?(response) data = SBF::Client::FullParticipant.new(JSON.parse(response.body).symbolize!) else error = SBF::Client::ErrorEntity.new(JSON.parse(response.body).symbolize!) end SBF::Client::Api::Response.new(http_code: response.code, data: data, error: error) end
move_to_different_event(participant_id, new_event_id)
click to toggle source
# File lib/stbaldricks/endpoints/participant.rb, line 57 def move_to_different_event(participant_id, new_event_id) response = SBF::Client::Api::Request.post_request("#{base_uri}/move_to_different_event", id: participant_id, new_event_id: new_event_id) error = SBF::Client::ErrorEntity.new(JSON.parse(response.body).symbolize!) unless ok?(response) SBF::Client::Api::Response.new(http_code: response.code, data: nil, error: error) end
start_team(participant_id, team_name, fundraising_goal)
click to toggle source
# File lib/stbaldricks/endpoints/participant.rb, line 18 def start_team(participant_id, team_name, fundraising_goal) response = SBF::Client::Api::Request.post_request( "#{base_uri}/move_to_different_team", id: participant_id, new_team_id: 0, team_name: team_name, goal: fundraising_goal, how_created: SBF::Client::Team::HowCreated::WEBSITE ) if ok?(response) data = SBF::Client::FullParticipant.new(JSON.parse(response.body).symbolize!) else error = SBF::Client::ErrorEntity.new(JSON.parse(response.body).symbolize!) end SBF::Client::Api::Response.new(http_code: response.code, data: data, error: error) end