typeform-ruby 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/example/example.json +12 -5
- data/example/example.rb +24 -16
- data/lib/typeform/choice.rb +13 -0
- data/lib/typeform/client.rb +1 -0
- data/lib/typeform/form.rb +1 -1
- data/lib/typeform/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df911a9835b60faafcd392086a96243b34cde88e
|
4
|
+
data.tar.gz: e20ae66e9fe1943511acee024e4a1336edf47db8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b1bf2db5c664c85c7fe25d7aa856dca488cd63254a5cc2f2c3bf79a6f1f44370d763f5de57f30aaa78544e4d3e6a095de3d2939d11e8456c14dea17d874d313
|
7
|
+
data.tar.gz: 02a4cac139638e66bc309c516934be46c8a8780ef9448b49796d2fa8c9409cc3679a1e459291b39b76050628fd95efebb2a1af7a2fc27a5796f1ee91d591d283
|
data/example/example.json
CHANGED
@@ -1,10 +1,17 @@
|
|
1
1
|
{
|
2
|
-
"title": "
|
2
|
+
"title": "Sandbox - Example #1",
|
3
3
|
"fields": [
|
4
4
|
{
|
5
|
-
"type": "
|
6
|
-
"question": "
|
5
|
+
"type": "multiple_choice",
|
6
|
+
"question": "How do you normally get to work?",
|
7
|
+
"choices": [
|
8
|
+
{
|
9
|
+
"label": "Metro"
|
10
|
+
},
|
11
|
+
{
|
12
|
+
"label": "Car"
|
13
|
+
}
|
14
|
+
]
|
7
15
|
}
|
8
|
-
]
|
9
|
-
"webhook_submit_url": "https://webhook_submit_url.com"
|
16
|
+
]
|
10
17
|
}
|
data/example/example.rb
CHANGED
@@ -6,25 +6,33 @@ typeform_api_key = ENV['TYPEFORM_API_KEY']
|
|
6
6
|
client = Typeform::Client.new(typeform_api_key)
|
7
7
|
|
8
8
|
# information
|
9
|
-
pp client.information
|
9
|
+
# pp client.information.body
|
10
10
|
|
11
11
|
# show form
|
12
|
-
pp client.show_form("tPvxO8qyP6gIzg")
|
12
|
+
# pp client.show_form("tPvxO8qyP6gIzg")
|
13
13
|
|
14
14
|
# create_form_from_json
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
15
|
+
choice1 = Typeform::Choice.new
|
16
|
+
choice1.label = "Metro"
|
17
|
+
choice2 = Typeform::Choice.new
|
18
|
+
choice2.label = "Car"
|
19
|
+
|
20
|
+
field1 = Typeform::Field.new
|
21
|
+
field1.type = "multiple_choice"
|
22
|
+
field1.question = "How do you normally get to work?"
|
23
|
+
field1.description = "On most days..."
|
24
|
+
field1.required = false
|
25
|
+
field1.choices = [choice1, choice2]
|
26
|
+
|
27
|
+
form = Typeform::Form.new
|
28
|
+
form.title = "title"
|
29
|
+
form.fields = [field1]
|
30
|
+
form.webhook_submit_url = "http://webhook_submit_url.com"
|
31
|
+
|
32
|
+
pp form.as_json
|
33
|
+
|
34
|
+
pp client.create_form_from_json(form.as_json).body
|
27
35
|
|
28
36
|
# create_form_from_file
|
29
|
-
file = File.open("example/example.json")
|
30
|
-
pp client.create_form_from_file(file)
|
37
|
+
# file = File.open("example/example.json")
|
38
|
+
# pp client.create_form_from_file(file)
|
data/lib/typeform/client.rb
CHANGED
data/lib/typeform/form.rb
CHANGED
data/lib/typeform/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: typeform-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kentaro Takiguchi
|
@@ -155,6 +155,7 @@ files:
|
|
155
155
|
- example/example.rb
|
156
156
|
- example/index.html
|
157
157
|
- lib/typeform.rb
|
158
|
+
- lib/typeform/choice.rb
|
158
159
|
- lib/typeform/client.rb
|
159
160
|
- lib/typeform/connection.rb
|
160
161
|
- lib/typeform/field.rb
|