Class: Typeform::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/typeform/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(api_key) ⇒ Client

Returns a new instance of Client.



11
12
13
# File 'lib/typeform/client.rb', line 11

def initialize(api_key)
  @conn = Connection.new(api_key)
end

Instance Method Details

#create_form_from_file(file) ⇒ Object



27
28
29
# File 'lib/typeform/client.rb', line 27

def create_form_from_file(file)
  create_form_from_json(JSON.parse(file.read))
end

#create_form_from_json(json) ⇒ Object



23
24
25
# File 'lib/typeform/client.rb', line 23

def create_form_from_json(json)
  @conn.post "/forms", json
end

#informationObject



15
16
17
# File 'lib/typeform/client.rb', line 15

def information
  @conn.get "/"
end

#show_form(id) ⇒ Object



19
20
21
# File 'lib/typeform/client.rb', line 19

def show_form(id)
  @conn.get "/forms/#{id}"
end