survey-gizmo-ruby 6.2.2 → 6.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/survey_gizmo/api/response.rb +5 -2
- data/lib/survey_gizmo/faraday_middleware/parse_survey_gizmo.rb +4 -2
- data/lib/survey_gizmo/resource.rb +2 -2
- data/lib/survey_gizmo/version.rb +1 -1
- data/spec/resource_spec.rb +3 -3
- data/spec/support/spec_shared_api_object.rb +2 -2
- data/survey-gizmo-ruby.gemspec +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a97c56891cb5d32899be0d8761f6111ea93594aa
|
4
|
+
data.tar.gz: 52c6711838243e3215f6514f7915610a863900d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 114bee62cb95e00705c8d0c3a55d144851b11fba7635959b478d0b7b92272834436a6f3deb52330f87bf7eb8ddb3e4c7062a6dccff6a08e0a2675a1344bd9a6e
|
7
|
+
data.tar.gz: 3fb1758367b9685ee72f42a7104f1431180cb74dd49ef430e999b140c3c29156fc1dd32069b18db6541a9ef510a572b5ba15f81ae6ab217f4a585be4ac3c4d5d
|
@@ -36,7 +36,7 @@ module SurveyGizmo::API
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def parsed_answers
|
39
|
-
filtered_answers = 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
|
@@ -47,7 +47,10 @@ module SurveyGizmo::API
|
|
47
47
|
true
|
48
48
|
end
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
|
+
filtered_answers.map do |k, v|
|
52
|
+
Answer.new(children_params.merge(key: k, value: v, answer_text: v, submitted_at: submitted_at))
|
53
|
+
end
|
51
54
|
end
|
52
55
|
end
|
53
56
|
end
|
@@ -39,10 +39,12 @@ module SurveyGizmo
|
|
39
39
|
|
40
40
|
# Handle really crappy [] notation in SG API, so far just in SurveyResponse
|
41
41
|
Array.wrap(body['data']).compact.each do |datum|
|
42
|
-
# SurveyGizmo returns date information using US/Eastern timezone
|
42
|
+
# SurveyGizmo returns date information using US/Eastern or Berlin timezone depending on which URI you use, but
|
43
|
+
# does not return any information about the timezone.
|
43
44
|
# See https://apihelp.surveygizmo.com/help/article/link/surveyresponse-returned-fields#examplereturns
|
44
45
|
TIME_FIELDS.each do |time_key|
|
45
|
-
|
46
|
+
next if datum[time_key].blank?
|
47
|
+
datum[time_key] = ActiveSupport::TimeZone.new(SurveyGizmo.configuration.api_time_zone).parse(datum[time_key])
|
46
48
|
end
|
47
49
|
|
48
50
|
datum.keys.grep(/^\[/).each do |key|
|
@@ -163,7 +163,7 @@ module SurveyGizmo
|
|
163
163
|
private
|
164
164
|
|
165
165
|
def attributes_without_blanks
|
166
|
-
attributes.reject { |k,v| v.blank? }
|
166
|
+
attributes.reject { |k, v| v.blank? }
|
167
167
|
end
|
168
168
|
|
169
169
|
# Extract attributes required for API calls about this object
|
@@ -184,7 +184,7 @@ module SurveyGizmo
|
|
184
184
|
# Also used for loading member objects, e.g. loading Options for a given Question.
|
185
185
|
def children_params
|
186
186
|
klass_id = self.class.name.split('::').last.downcase + '_id'
|
187
|
-
route_params.merge(klass_id.to_sym => id).reject { |k,v| k == :id }
|
187
|
+
route_params.merge(klass_id.to_sym => id).reject { |k, v| k == :id }
|
188
188
|
end
|
189
189
|
|
190
190
|
def create_route(method)
|
data/lib/survey_gizmo/version.rb
CHANGED
data/spec/resource_spec.rb
CHANGED
@@ -22,9 +22,9 @@ describe 'Survey Gizmo Resource' do
|
|
22
22
|
it '#reload' do
|
23
23
|
stub_request(:get, /#{@base}/).to_return(json_response(true, get_attributes))
|
24
24
|
obj = described_class.new(get_attributes.merge(update_attributes))
|
25
|
-
obj.attributes.reject {|k,v| v.blank? }.should == get_attributes.merge(update_attributes)
|
25
|
+
obj.attributes.reject { |k, v| v.blank? }.should == get_attributes.merge(update_attributes)
|
26
26
|
obj.reload
|
27
|
-
obj.attributes.reject {|k,v| v.blank? }.should == get_attributes
|
27
|
+
obj.attributes.reject { |k, v| v.blank? }.should == get_attributes
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'should raise an error if params are missing' do
|
@@ -263,7 +263,7 @@ describe 'Survey Gizmo Resource' do
|
|
263
263
|
|
264
264
|
it 'should propagate time, survey_id, and response_id' do
|
265
265
|
response = described_class.new(
|
266
|
-
answers: answers.select { |k,v| k == "[question(5)]"},
|
266
|
+
answers: answers.select { |k, v| k == "[question(5)]"},
|
267
267
|
survey_id: survey_id,
|
268
268
|
id: response_id,
|
269
269
|
submitted_at: timestamp
|
@@ -16,7 +16,7 @@ shared_examples_for 'an API object' do
|
|
16
16
|
stub_request(:put, /#{@base}/).to_return(json_response(true, create_attributes))
|
17
17
|
obj = described_class.create(create_attributes)
|
18
18
|
|
19
|
-
obj.attributes.reject { |k,v| v.blank? }.should == (create_attributes_to_compare || create_attributes)
|
19
|
+
obj.attributes.reject { |k, v| v.blank? }.should == (create_attributes_to_compare || create_attributes)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -25,7 +25,7 @@ shared_examples_for 'an API object' do
|
|
25
25
|
stub_request(:get, /#{@base}/).to_return(json_response(true, get_attributes))
|
26
26
|
obj = described_class.first(first_params)
|
27
27
|
a_request(:get, /#{@base}#{uri_paths[:get]}/).should have_been_made
|
28
|
-
obj.attributes.reject{|k,v| v.blank? }.should == (get_attributes_to_compare || get_attributes)
|
28
|
+
obj.attributes.reject { |k, v| v.blank? }.should == (get_attributes_to_compare || get_attributes)
|
29
29
|
end
|
30
30
|
|
31
31
|
it "should return false if the request fails" do
|
data/survey-gizmo-ruby.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.licenses = ['MIT']
|
16
16
|
gem.required_ruby_version = '>= 1.9'
|
17
17
|
|
18
|
-
gem.add_dependency 'activesupport', '>= 3.0'
|
18
|
+
gem.add_dependency 'activesupport', '>= 3.0', '< 5.0'
|
19
19
|
gem.add_dependency 'addressable', '~> 2'
|
20
20
|
gem.add_dependency 'awesome_print', '~> 1'
|
21
21
|
gem.add_dependency 'faraday', '>= 0.9.1', '~> 0.9'
|
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.3
|
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-
|
14
|
+
date: 2016-07-01 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|
@@ -20,6 +20,9 @@ dependencies:
|
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '3.0'
|
23
|
+
- - "<"
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: '5.0'
|
23
26
|
type: :runtime
|
24
27
|
prerelease: false
|
25
28
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -27,6 +30,9 @@ dependencies:
|
|
27
30
|
- - ">="
|
28
31
|
- !ruby/object:Gem::Version
|
29
32
|
version: '3.0'
|
33
|
+
- - "<"
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '5.0'
|
30
36
|
- !ruby/object:Gem::Dependency
|
31
37
|
name: addressable
|
32
38
|
requirement: !ruby/object:Gem::Requirement
|