Class: Quovo::Api::Challenges
- Inherits:
-
Base
- Object
- Base
- Quovo::Api::Challenges
show all
- Defined in:
- lib/quovo/api/challenges.rb
Instance Attribute Summary
Attributes inherited from Base
#token
Instance Method Summary
collapse
Methods inherited from Base
#api, #initialize
Methods included from Request
#request
Instance Method Details
#answers!(account_id, answers) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
|
# 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
|
#for_account(id) ⇒ Object
7
8
9
10
11
12
|
# 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
|