survey-gizmo-ruby 6.2.0 → 6.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/survey_gizmo/api/answer.rb +3 -3
- data/lib/survey_gizmo/api/response.rb +5 -4
- data/lib/survey_gizmo/version.rb +1 -1
- data/spec/resource_spec.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: ab1eb13371249cc2f26137bbe0323478da4fd207
|
4
|
+
data.tar.gz: 3cb470de80d38514bd94d63d5c32722d29ead07a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21d0913d8ba602e29f298b7a657f579930e05b77d07aa71d49463d939987658032e4c6e25f49d94aa8cd7f1798d11a99c60b0487561fc6bb4fa28fd4148fe41b
|
7
|
+
data.tar.gz: 24aa16c01024c4853e2b77bd8825a4e52dc84d92096badcf0c4e68bef9cb55f6814e5cfe0266d28171a9b986fcc40c9a07737ed18aa51a916cb592a6f5e48033
|
@@ -17,11 +17,11 @@ module SurveyGizmo::API
|
|
17
17
|
self.attributes = attrs
|
18
18
|
|
19
19
|
case key
|
20
|
-
when /\[question\((\d+)\),\s*option\((\d
|
20
|
+
when /\[question\((\d+)\),\s*option\((\d+|"\d+-other")\)\]/
|
21
21
|
self.question_id, self.option_id = $1, $2
|
22
22
|
|
23
|
-
if option_id =~
|
24
|
-
option_id
|
23
|
+
if option_id =~ /-other/
|
24
|
+
option_id.delete!('-other"')
|
25
25
|
self.other_text = value
|
26
26
|
end
|
27
27
|
when /\[question\((\d+)\),\s*question_pipe\("(.*)"\)\]/
|
@@ -36,17 +36,18 @@ module SurveyGizmo::API
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def parsed_answers
|
39
|
-
answers.select do |k,v|
|
39
|
+
filtered_answers = answers.select do |k,v|
|
40
40
|
next false unless v.is_a?(FalseClass) || v.present?
|
41
41
|
|
42
42
|
# Strip out "Other" answers that don't actually have the "other" text (they come back as two responses - one
|
43
43
|
# for the "Other" option_id, and then a whole separate response for the text given as an "Other" response.
|
44
|
-
if
|
45
|
-
!answers.keys.any? { |key| key =~ /\[question\((#{
|
44
|
+
if /\[question\((?<question_id>\d+)\),\s*option\((?<option_id>\d+)\)\]/ =~ k
|
45
|
+
!answers.keys.any? { |key| key =~ /\[question\((#{question_id})\),\s*option\("(#{option_id})-other"\)\]/ }
|
46
46
|
else
|
47
47
|
true
|
48
48
|
end
|
49
|
-
end
|
49
|
+
end
|
50
|
+
filtered_answers.map { |k,v| Answer.new(children_params.merge(key: k, value: v, answer_text: v, submitted_at: submitted_at)) }
|
50
51
|
end
|
51
52
|
end
|
52
53
|
end
|
data/lib/survey_gizmo/version.rb
CHANGED
data/spec/resource_spec.rb
CHANGED
@@ -249,7 +249,7 @@ describe 'Survey Gizmo Resource' do
|
|
249
249
|
let(:timestamp) { '2015-01-02'.to_time(:utc) }
|
250
250
|
let(:answers) do
|
251
251
|
{
|
252
|
-
"[question(3), option(
|
252
|
+
"[question(3), option(\"10021-other\")]" => "Some other text field answer",
|
253
253
|
"[question(3), option(10021)]" => "Other (required)",
|
254
254
|
"[question(5)]" => "VERY important",
|
255
255
|
"[question(6)]" => nil,
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: survey-gizmo-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.2.
|
4
|
+
version: 6.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kabari Hendrick
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2016-06-
|
14
|
+
date: 2016-06-30 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|