Class: BlockScore::QuestionSets

Inherits:
Object
  • Object
show all
Defined in:
lib/blockscore/question_sets.rb

Constant Summary collapse

PATH =
'/question_sets'

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ QuestionSets

Returns a new instance of QuestionSets.



5
6
7
# File 'lib/blockscore/question_sets.rb', line 5

def initialize(client)
  @client = client
end

Instance Method Details

#all(count = nil, offset = nil, options = {}) ⇒ Object

‘/question_sets’ GET



40
41
42
43
44
45
46
47
# File 'lib/blockscore/question_sets.rb', line 40

def all(count = nil, offset = nil, options = {})
  body = (options.include? :body) ? options[:body] : {}

  body[:count] = count
  body[:offset] = offset

  @client.get PATH, body
end

#create(person_id, options = {}) ⇒ Object



9
10
11
12
13
14
# File 'lib/blockscore/question_sets.rb', line 9

def create(person_id, options = {})
  body = (options.include? :body) ? options[:body] : {}
  body[:person_id] = person_id

  response = @client.post PATH, body
end

#retrieve(id) ⇒ Object

/question_sets/:id GET

id -



31
32
33
34
35
# File 'lib/blockscore/question_sets.rb', line 31

def retrieve(id)
  body = Hash.new

  response = @client.get "#{PATH}/#{id.to_s}", body
end

#score(id, answers) ⇒ Object

‘/question_sets/:id/score’ POST

answers -



20
21
22
23
24
25
# File 'lib/blockscore/question_sets.rb', line 20

def score(id, answers)
  body = {}
  body[:answers] = answers

  response = @client.post "#{PATH}/#{id.to_s}/score", body
end