survey-gizmo-ruby 6.2.0 → 6.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c7eb41f2a707faa996d6ee69f3a90bc6bcf6eb1a
4
- data.tar.gz: 4e56a5a27408eb01bad4b477f92b602f56a4bdd1
3
+ metadata.gz: ab1eb13371249cc2f26137bbe0323478da4fd207
4
+ data.tar.gz: 3cb470de80d38514bd94d63d5c32722d29ead07a
5
5
  SHA512:
6
- metadata.gz: b9714b4572a738ce77096851149dad4a9a8d457feb0df1b9de39660d17dac9564f70dbd1227c3baf793a65a260f11916f1dafea47a918ce0cc5a53624abf287b
7
- data.tar.gz: 26967ba8b32e8efb4f0df9cbff222e4b0e2ac5b5258971d2210603de9145a061be31e9fc3ca26af3e1a3b784a07954f3f7dcada3c919149a11552449bf35795a
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+|\\\"\d+-other\\\")\)\]/
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 =~ /\\\"(\d+)-other\\\"/
24
- option_id = $1
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 k =~ /\[question\((\d+)\),\s*option\((\d+)\)\]/
45
- !answers.keys.any? { |key| key =~ /\[question\((#{$1})\),\s*option\(\\\"(#{$2})-other\\\"\)\]/ }
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.map { |k,v| Answer.new(children_params.merge(key: k, value: v, answer_text: v, submitted_at: submitted_at)) }
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
@@ -1,3 +1,3 @@
1
1
  module SurveyGizmo
2
- VERSION = '6.2.0'
2
+ VERSION = '6.2.2'
3
3
  end
@@ -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(\\\"10021-other\\\")]" => "Some other text field answer",
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.0
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-29 00:00:00.000000000 Z
14
+ date: 2016-06-30 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport