Class: Typeform::Api::Form

Inherits:
Client
  • Object
show all
Defined in:
lib/typeform/api/form.rb

Overview

users

Class Method Summary collapse

Methods inherited from Client

#connection, connection, connection=, parse

Class Method Details

.create_form(params) ⇒ Object



21
22
23
24
# File 'lib/typeform/api/form.rb', line 21

def create_form(params)
  res = connection.post("forms", params.to_json)
  return JSON.parse(res.body.force_encoding("UTF-8"))["id"]
end

.retrieve_form(form_id) ⇒ Object

retrieve a form by a form_id



17
18
19
# File 'lib/typeform/api/form.rb', line 17

def retrieve_form(form_id)
  parse(JSON.parse(connection.get("forms/#{form_id}").body))
end

.retrieve_forms(workspace_id, page_size: 200, template: "Template") ⇒ Object

retrieve forms def retrieve_forms(page_size: 200)

parse(JSON.parse(connection.get("forms?page_size=#{page_size}").body))

end



12
13
14
# File 'lib/typeform/api/form.rb', line 12

def retrieve_forms(workspace_id, page_size: 200, template: "Template")
  parse(JSON.parse(connection.get("forms?page_size=#{page_size}&workspace_id=#{workspace_id}&search=#{template}").body))
end