Class: SBF::Client::ParticipantEndpoint
Instance Attribute Summary
#orig_target_class
Instance Method Summary
collapse
#aggregate, #create, #delete, #find, #find_first, #get, #initialize, #save, #update
Instance Method Details
#join_team(participant_id, new_team_id) ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
|
# 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) ⇒ Object
#move_to_different_event(participant_id, new_event_id) ⇒ Object
49
50
51
52
53
54
55
56
|
# File 'lib/stbaldricks/endpoints/participant.rb', line 49
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) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# 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
|