survey-gizmo-ruby 2.0.0 → 2.0.1
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/rest_response.rb +9 -0
- data/spec/resource_spec.rb +21 -0
- data/spec/support/spec_shared_api_object.rb +4 -3
- data/survey-gizmo-ruby.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc7ec77f5e304d1dec270f479b3caadc795e75e1
|
4
|
+
data.tar.gz: 1c65b8c0bf95015e3c65be784b78bdd916793100
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77bf4d152eeb999f2a6a62f4a233b4d8b42e8c47038e54864ccd42947024383e790785f41fa618ec06f8f50d7add669e0f0c96666092e6a3c45155a3073151c7
|
7
|
+
data.tar.gz: e87d4acc9fe981fd5653ceb2f7197e144c7d5d3c5aedbe8f2d71afc7d0c21b1d5036fa66d5bb062c04cc331cfd48a3054549a74ee5bedb3df7c726ef30a29521
|
@@ -10,6 +10,15 @@ class RestResponse
|
|
10
10
|
|
11
11
|
# Handle really crappy [] notation in SG API, so far just in SurveyResponse
|
12
12
|
(data.is_a?(Array) ? data : [data]).each do |datum|
|
13
|
+
|
14
|
+
# SurveyGizmo returns date information in EST, but does not
|
15
|
+
# provide time zone information in their API responses.
|
16
|
+
#
|
17
|
+
# See https://surveygizmov4.helpgizmo.com/help/article/link/date-and-time-submitted
|
18
|
+
unless datum["datesubmitted"].blank?
|
19
|
+
datum["datesubmitted"] = datum["datesubmitted"] + " EST"
|
20
|
+
end
|
21
|
+
|
13
22
|
datum.keys.grep(/^\[/).each do |key|
|
14
23
|
next if datum[key].nil? || datum[key].length == 0
|
15
24
|
|
data/spec/resource_spec.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
describe 'Survey Gizmo Resource' do
|
3
3
|
|
4
|
+
let(:create_attributes_to_compare) { }
|
5
|
+
let(:get_attributes_to_compare) { }
|
6
|
+
|
4
7
|
describe SurveyGizmo::Resource do
|
5
8
|
before(:each) do
|
6
9
|
SurveyGizmo.setup(user: 'test@test.com', password: 'password')
|
@@ -149,4 +152,22 @@ describe 'Survey Gizmo Resource' do
|
|
149
152
|
it_should_behave_like 'an API object'
|
150
153
|
it_should_behave_like 'an object with errors'
|
151
154
|
end
|
155
|
+
|
156
|
+
describe SurveyGizmo::API::Response do
|
157
|
+
let(:create_attributes) { {:survey_id => 1234, :datesubmitted => "2015-04-15 05:46:30" } }
|
158
|
+
let(:create_attributes_to_compare) { create_attributes.merge(:datesubmitted => Time.parse("2015-04-15 05:46:30 EST")) }
|
159
|
+
let(:get_attributes) { create_attributes.merge(:id => 1) }
|
160
|
+
let(:get_attributes_to_compare) { create_attributes_to_compare.merge(:id => 1) }
|
161
|
+
let(:update_attributes) { {:survey_id => 1234, :title => 'Updated'} }
|
162
|
+
let(:first_params) { {:id => 1, :survey_id => 1234 } }
|
163
|
+
let(:uri_paths){
|
164
|
+
h = { :create => '/survey/1234/surveyresponse' }
|
165
|
+
h.default = '/survey/1234/surveyresponse/1'
|
166
|
+
h
|
167
|
+
}
|
168
|
+
|
169
|
+
it_should_behave_like 'an API object'
|
170
|
+
it_should_behave_like 'an object with errors'
|
171
|
+
end
|
172
|
+
|
152
173
|
end
|
@@ -23,7 +23,8 @@ shared_examples_for 'an API object' do
|
|
23
23
|
it "should set the attributes" do
|
24
24
|
stub_request(:put, /#{@base}/).to_return(json_response(true, create_attributes))
|
25
25
|
obj = described_class.create(create_attributes)
|
26
|
-
|
26
|
+
|
27
|
+
obj.attributes.reject{|k,v| v.blank? }.should == (create_attributes_to_compare || create_attributes)
|
27
28
|
end
|
28
29
|
end
|
29
30
|
|
@@ -37,7 +38,7 @@ shared_examples_for 'an API object' do
|
|
37
38
|
it "should set the attributes" do
|
38
39
|
stub_request(:get, /#{@base}/).to_return(json_response(true, get_attributes))
|
39
40
|
obj = described_class.first(first_params)
|
40
|
-
obj.attributes.reject{|k,v| v.blank? }.should == get_attributes
|
41
|
+
obj.attributes.reject{|k,v| v.blank? }.should == (get_attributes_to_compare || get_attributes)
|
41
42
|
end
|
42
43
|
|
43
44
|
it "should return false if the request fails" do
|
@@ -126,4 +127,4 @@ shared_examples_for 'an API object' do
|
|
126
127
|
end
|
127
128
|
end
|
128
129
|
|
129
|
-
end
|
130
|
+
end
|
data/survey-gizmo-ruby.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
6
|
gem.name = 'survey-gizmo-ruby'
|
7
|
-
gem.version = '2.0.
|
7
|
+
gem.version = '2.0.1'
|
8
8
|
gem.authors = ['Kabari Hendrick', 'Chris Horn', 'Adrien Jarthon', 'Lumos Labs, Inc.']
|
9
9
|
gem.email = ['adrien.jarthon@dimelo.com']
|
10
10
|
gem.description = 'Gem to use the SurveyGizmo.com REST API, v3+'
|
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: 2.0.
|
4
|
+
version: 2.0.1
|
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: 2015-
|
14
|
+
date: 2015-04-21 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|
@@ -238,7 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
238
238
|
version: '0'
|
239
239
|
requirements: []
|
240
240
|
rubyforge_project:
|
241
|
-
rubygems_version: 2.
|
241
|
+
rubygems_version: 2.4.5
|
242
242
|
signing_key:
|
243
243
|
specification_version: 4
|
244
244
|
summary: Gem to use the SurveyGizmo.com REST API, v3+
|