Class: TeneoClient::Questionnaire

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/teneo_client/questionnaire.rb

Class Method Summary collapse

Class Method Details

.create(questionnaire) ⇒ Object



26
27
28
29
30
31
# File 'lib/teneo_client/questionnaire.rb', line 26

def create(questionnaire)
  init
  res = post("/questionnaires.xml", payload(questionnaire))
  raise "Error" if res.headers['status'].first != "201"
  res
end

.find(id) ⇒ Object



13
14
15
16
17
# File 'lib/teneo_client/questionnaire.rb', line 13

def find(id)
  init
  q = get("/questionnaires/#{id}.xml")["questionnaire"]
  HashWithIndifferentAccess.new(q)
end

.listObject



7
8
9
10
11
# File 'lib/teneo_client/questionnaire.rb', line 7

def list
  init
  q = get("/questionnaires.xml")
  HashWithIndifferentAccess.new(q)
end

.update(id, questionnaire) ⇒ Object



19
20
21
22
23
24
# File 'lib/teneo_client/questionnaire.rb', line 19

def update(id, questionnaire)
  init
  res = put("/questionnaires/#{id}.xml", payload(questionnaire))
  raise "Error" if res.headers['status'].first != "200"
  res
end