class Quovo::Api::Challenges
Public Instance Methods
answer!(challenge_id, answer)
click to toggle source
# File lib/quovo/api/challenges.rb, line 34 def answer!(challenge_id, answer) challenge_id.require!(as: 'challenge_id') answer.require!(as: 'answer') params = { answer: answer.to_json } api(:put, "/challenges/#{challenge_id}", params) .fetch('challenge') .cast(Challenge) end
answers!(account_id, answers)
click to toggle source
# File lib/quovo/api/challenges.rb, line 14 def answers!(account_id, answers) account_id.require!(as: 'account_id') answers.require!(as: 'answers') answers.each do |answer| answer.require!(:answer, :question) end params = { questions: answers.to_json } api(:put, "/accounts/#{account_id}/challenges", params) .fetch('challenges') .cast(Challenge) end
find(challenge_id)
click to toggle source
# File lib/quovo/api/challenges.rb, line 27 def find(challenge_id) challenge_id.require!(as: 'challenge_id') api(:get, "/challenges/#{challenge_id}") .fetch('challenge') .cast(Challenge) end
for_account(id)
click to toggle source
# File lib/quovo/api/challenges.rb, line 7 def for_account(id) id.require!(as: :id) api(:get, "/accounts/#{id}/challenges") .fetch('challenges') .cast(Challenge) end