typeform_data 4.0.0 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/lib/typeform_data/typeform.rb +20 -1
- data/lib/typeform_data/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53983bf174d6a2657b1217c31b012e0c9001ae84
|
4
|
+
data.tar.gz: 78235d80e83fbc5621e921a3b7be9dcb1ff225d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5a863780ad0471d0c7064217ea6fa410b487d42173279635e567759338b0ee04ce3170409f53a0361dd7641d854a84b7c822f645da8fd556648200bd9bbc60a
|
7
|
+
data.tar.gz: 3b90e57b69fe8a8b793af87c56354ae4bc3d393b10f11db7a392181a6c6114dfd44ec0e0b97d0216d4cfba480df6064ef6bdef1627c9b686e26089e765f0d1d5
|
data/README.md
CHANGED
@@ -49,7 +49,9 @@ typeform.responses.first.answers.map { |answer| [answer.field_text, answer.value
|
|
49
49
|
|
50
50
|
### Serialization & deserialization
|
51
51
|
|
52
|
-
|
52
|
+
TypeformData supports serialization via both Marshal and JSON. In either case, your API key will not be serialized, and we throw an error if you attempt to serialize a `TypeformData::Client` instance.
|
53
|
+
|
54
|
+
When using Marshal, `TypeformData::Client#dump` is just a pass-through to `Marshal#dump`, but `Client#load` will re-set your API key on each of the deserialized objects-- this ensures the object graph stays intact through the serialization and deserialization process.
|
53
55
|
|
54
56
|
```
|
55
57
|
serialized = client.dump(responses)
|
@@ -62,6 +64,8 @@ deserialized = client.load(serialized)
|
|
62
64
|
=> true
|
63
65
|
```
|
64
66
|
|
67
|
+
We do not yet support this sort of 'round-trip' serialization for JSON. PRs are welcome!
|
68
|
+
|
65
69
|
### Error-handling
|
66
70
|
|
67
71
|
Unless you've encountered a bug, all exceptions raised by this gem should extend from `TypeformData::Error`. For the full exception hierarchy, see `lib/typeform_data/errors`.
|
@@ -30,7 +30,26 @@ module TypeformData
|
|
30
30
|
set_questions(response['questions'])
|
31
31
|
|
32
32
|
response['responses'].map { |api_hash|
|
33
|
-
Response.new(
|
33
|
+
Response.new(
|
34
|
+
config,
|
35
|
+
|
36
|
+
api_hash.dup.tap { |hash|
|
37
|
+
hash[:typeform_id] = id
|
38
|
+
|
39
|
+
# Sadly, the API returns [] if there aren't any Hidden Fields, and { ... } if there
|
40
|
+
# are.
|
41
|
+
unless hash['hidden'].is_a?(Hash)
|
42
|
+
unless hash['hidden'] == []
|
43
|
+
config.logger.error "Received an unexpected value for a responses's hidden fields "\
|
44
|
+
"from the API: #{hash['hidden']}. Using {} instead. The full hash is:\n"\
|
45
|
+
"#{api_hash}"
|
46
|
+
end
|
47
|
+
hash['hidden'] = {}
|
48
|
+
end
|
49
|
+
},
|
50
|
+
|
51
|
+
fields,
|
52
|
+
)
|
34
53
|
}
|
35
54
|
end
|
36
55
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: typeform_data
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max Wallace
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-07-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|