quest_back 0.0.2 → 0.0.3
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/.travis.yml +16 -0
- data/CHANGELOG.md +4 -1
- data/README.md +2 -0
- data/Rakefile +8 -0
- data/lib/quest_back/api.rb +52 -0
- data/lib/quest_back/version.rb +1 -1
- data/quest_back.gemspec +2 -2
- data/spec/fixtures/add_respondents_data_without_email_invitation_success.xml +7 -0
- data/spec/quest_back/api_spec.rb +85 -1
- data/spec/quest_back/response_spec.rb +4 -4
- data/spec/spec_helper.rb +0 -2
- metadata +10 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7c60ef5de27f5accea75be07c80da30a954c42e
|
4
|
+
data.tar.gz: c3deae3810afb2f42c46870f1d68c6fdf1883f06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57aa9cb3c9244253e71d2e2ee85702e4b49f5d1b79f3dab440ca04a7924b0429ad172082d3a9428a13ea4d030550f26df73586d06f61d9035f63ec0c1d6de5d0
|
7
|
+
data.tar.gz: 464c8ac3b5d820fe5299a0e1777db430c6750df8a1ddb07fbb8ef6b6ddff93aedc33b8c8dd64ba6dcb0c4eec114abe749d00aa942716d0099d59ba4c072693c2
|
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
data/Rakefile
CHANGED
data/lib/quest_back/api.rb
CHANGED
@@ -20,6 +20,7 @@ module QuestBack
|
|
20
20
|
get_quests: [:user_info, :paging_info, :quest_filter],
|
21
21
|
add_email_invitees: [:user_info, :quest_info, :emails, :sendduplicate, :language_id],
|
22
22
|
add_respondents_data: [:user_info, :quest_info, :respondents_data, :language_id],
|
23
|
+
add_respondents_data_without_email_invitation: [:user_info, :quest_info, :respondents_data, :language_id],
|
23
24
|
add_respondents_data_with_sms_invitation: [
|
24
25
|
:user_info, :quest_info, :respondents_data, :language_id,
|
25
26
|
:sms_from_number, :sms_from_text, :sms_message
|
@@ -39,6 +40,7 @@ module QuestBack
|
|
39
40
|
get_language_list: [:language],
|
40
41
|
add_email_invitees: [],
|
41
42
|
add_respondents_data: [],
|
43
|
+
add_respondents_data_without_email_invitation: [],
|
42
44
|
add_respondents_data_with_sms_invitation: []
|
43
45
|
}
|
44
46
|
|
@@ -172,6 +174,56 @@ module QuestBack
|
|
172
174
|
call :add_respondents_data, attributes, include_defaults: [:respondents_data]
|
173
175
|
end
|
174
176
|
|
177
|
+
# Public: Add respondent data to a quest - optionally send as invitee as well.
|
178
|
+
# This will not send an email invitation through Questback's platform
|
179
|
+
#
|
180
|
+
# attributes - Attributes sent to QuestBack
|
181
|
+
#
|
182
|
+
# QuestBack is doing a bit of CSV over XML here? As you need to serialize
|
183
|
+
# respondent_data as a string with a delimiter ala CSV. The order of the
|
184
|
+
# data must match the order of respondent_data_header. I guess simply using XML
|
185
|
+
# and named elements was too easy? :-)
|
186
|
+
#
|
187
|
+
# Example
|
188
|
+
#
|
189
|
+
# response = api.add_respondents_data_without_email_invitation(
|
190
|
+
# quest_info: {quest_id: 4567668, security_lock: 'm0pI8orKJp'},
|
191
|
+
# respondents_data: {
|
192
|
+
# respondent_data_header: {
|
193
|
+
# respondent_data_header: [
|
194
|
+
# {
|
195
|
+
# title: 'Epost',
|
196
|
+
# type: QuestBack::Api.respondent_data_header_type_for(:text),
|
197
|
+
# is_email_field: true,
|
198
|
+
# is_sms_field: false,
|
199
|
+
# },
|
200
|
+
# {
|
201
|
+
# title: 'Navn',
|
202
|
+
# type: QuestBack::Api.respondent_data_header_type_for(:text),
|
203
|
+
# is_email_field: false,
|
204
|
+
# is_sms_field: false,
|
205
|
+
# },
|
206
|
+
# {
|
207
|
+
# title: 'Alder',
|
208
|
+
# type: QuestBack::Api.respondent_data_header_type_for(:numeric),
|
209
|
+
# is_email_field: false,
|
210
|
+
# is_sms_field: false,
|
211
|
+
# },
|
212
|
+
# ]
|
213
|
+
# },
|
214
|
+
# respondent_data: ['th@skalar.no;Thorbjorn;32'], # According to QuestBack's doc you can only do one here
|
215
|
+
# allow_duplicate: true,
|
216
|
+
# add_as_invitee: true
|
217
|
+
# }
|
218
|
+
# )
|
219
|
+
#
|
220
|
+
# You may override respondent_data's delimiter in string too.
|
221
|
+
#
|
222
|
+
# Returns QuestBack::Response
|
223
|
+
def add_respondents_data_without_email_invitation(attributes = {})
|
224
|
+
call :add_respondents_data_without_email_invitation, attributes, include_defaults: [:respondents_data]
|
225
|
+
end
|
226
|
+
|
175
227
|
# Public: Add respondent data to a quest with SMS invitation
|
176
228
|
#
|
177
229
|
# attributes - Attributes sent to QuestBack
|
data/lib/quest_back/version.rb
CHANGED
data/quest_back.gemspec
CHANGED
@@ -19,9 +19,9 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_dependency "activesupport", ">= 3.2.14", "< 5"
|
22
|
-
spec.add_dependency "savon", "~> 2.
|
22
|
+
spec.add_dependency "savon", "~> 2.11.1"
|
23
23
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.5"
|
25
|
-
spec.add_development_dependency "rspec", "~>
|
25
|
+
spec.add_development_dependency "rspec", "~> 3.4.0"
|
26
26
|
spec.add_development_dependency "rake"
|
27
27
|
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
|
2
|
+
<s:Body>
|
3
|
+
<AddRespondentsDataWithoutEmailInvitationResponse xmlns="https://integration.questback.com/2011/03">
|
4
|
+
<AddRespondentsDataWithoutEmailInvitationResult>https://response.questback.com/isa/qbv.dll/SQ?id=4806631-329832123|218186238-SvyvBLDH</AddRespondentsDataWithoutEmailInvitationResult>
|
5
|
+
</AddRespondentsDataWithoutEmailInvitationResponse>
|
6
|
+
</s:Body>
|
7
|
+
</s:Envelope>
|
data/spec/quest_back/api_spec.rb
CHANGED
@@ -28,7 +28,7 @@ describe QuestBack::Api, type: :request do
|
|
28
28
|
it "sets proxy building client" do
|
29
29
|
config.http_proxy = 'http://127.0.0.1/'
|
30
30
|
|
31
|
-
Savon::Client.
|
31
|
+
expect(Savon::Client).to receive(:new).
|
32
32
|
with(hash_including(proxy: 'http://127.0.0.1/')).
|
33
33
|
and_return :client
|
34
34
|
|
@@ -254,6 +254,90 @@ describe QuestBack::Api, type: :request do
|
|
254
254
|
end
|
255
255
|
end
|
256
256
|
|
257
|
+
describe "#add_respondents_data_without_email_invitation" do
|
258
|
+
it "makes call with expected arguments" do
|
259
|
+
expected_message = expected_default_message.merge(
|
260
|
+
quest_info: {'QuestId' => 4567668, 'SecurityLock' => 'm0pI8orKJp'},
|
261
|
+
respondents_data: {
|
262
|
+
'RespondentDataHeader' => {
|
263
|
+
'RespondentDataHeader' => [
|
264
|
+
{
|
265
|
+
'Title' => 'Epost',
|
266
|
+
'enum:Type' => 2,
|
267
|
+
'IsEmailField' => true,
|
268
|
+
'IsSmsField' => false
|
269
|
+
},
|
270
|
+
{
|
271
|
+
'Title' => 'Mobil',
|
272
|
+
'enum:Type' => 2,
|
273
|
+
'IsEmailField' => false,
|
274
|
+
'IsSmsField' => true
|
275
|
+
},
|
276
|
+
{
|
277
|
+
'Title' => 'Navn',
|
278
|
+
'enum:Type' => 2,
|
279
|
+
'IsEmailField' => false,
|
280
|
+
'IsSmsField' => false
|
281
|
+
},
|
282
|
+
{
|
283
|
+
'Title' => 'Alder',
|
284
|
+
'enum:Type' => 1,
|
285
|
+
'IsEmailField' => false,
|
286
|
+
'IsSmsField' => false
|
287
|
+
}
|
288
|
+
]
|
289
|
+
},
|
290
|
+
'RespondentData' => {'array:string' => ['th@skalar.no;404 40 404;Thorbjorn;32']},
|
291
|
+
'Delimiter' => ';',
|
292
|
+
'AllowDuplicate' => true,
|
293
|
+
'AddAsInvitee' => true,
|
294
|
+
order!: ["RespondentDataHeader", "RespondentData", "Delimiter", "AllowDuplicate", "AddAsInvitee"]
|
295
|
+
},
|
296
|
+
order!: QuestBack::Api::ORDER[:add_respondents_data_without_email_invitation] - [:language_id]
|
297
|
+
)
|
298
|
+
|
299
|
+
savon.expects(:add_respondents_data_without_email_invitation).with(message: expected_message).returns success_fixture_for 'add_respondents_data_without_email_invitation'
|
300
|
+
response = subject.add_respondents_data_without_email_invitation(
|
301
|
+
quest_info: {quest_id: 4567668, security_lock: 'm0pI8orKJp'},
|
302
|
+
respondents_data: {
|
303
|
+
respondent_data_header: {
|
304
|
+
respondent_data_header: [
|
305
|
+
{
|
306
|
+
title: 'Epost',
|
307
|
+
type: QuestBack::Api.respondent_data_header_type_for(:text),
|
308
|
+
is_email_field: true,
|
309
|
+
is_sms_field: false,
|
310
|
+
},
|
311
|
+
{
|
312
|
+
title: 'Mobil',
|
313
|
+
type: QuestBack::Api.respondent_data_header_type_for(:text),
|
314
|
+
is_email_field: false,
|
315
|
+
is_sms_field: true,
|
316
|
+
},
|
317
|
+
{
|
318
|
+
title: 'Navn',
|
319
|
+
type: QuestBack::Api.respondent_data_header_type_for(:text),
|
320
|
+
is_email_field: false,
|
321
|
+
is_sms_field: false,
|
322
|
+
},
|
323
|
+
{
|
324
|
+
title: 'Alder',
|
325
|
+
type: QuestBack::Api.respondent_data_header_type_for(:numeric),
|
326
|
+
is_email_field: false,
|
327
|
+
is_sms_field: false,
|
328
|
+
},
|
329
|
+
]
|
330
|
+
},
|
331
|
+
respondent_data: ['th@skalar.no;404 40 404;Thorbjorn;32'],
|
332
|
+
allow_duplicate: true,
|
333
|
+
add_as_invitee: true
|
334
|
+
}
|
335
|
+
)
|
336
|
+
|
337
|
+
expect(response).to be_successful
|
338
|
+
end
|
339
|
+
end
|
340
|
+
|
257
341
|
describe "#add_respondents_data_with_sms_invitation" do
|
258
342
|
it "makes call with expected arguments" do
|
259
343
|
expected_message = expected_default_message.merge(
|
@@ -16,7 +16,7 @@ describe QuestBack::Response, type: :request do
|
|
16
16
|
|
17
17
|
describe "#result" do
|
18
18
|
context "singular result" do
|
19
|
-
before { http.
|
19
|
+
before { allow(http).to receive(:body).and_return success_fixture_for('get_quests') }
|
20
20
|
|
21
21
|
it "returns the result of it's body" do
|
22
22
|
expect(subject.result).to eq savon_response.body[:get_quests_response][:get_quests_result][:quests][:quest]
|
@@ -24,7 +24,7 @@ describe QuestBack::Response, type: :request do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
context "multiple result" do
|
27
|
-
before { http.
|
27
|
+
before { allow(http).to receive(:body).and_return success_fixture_for('get_quests_multiple_response') }
|
28
28
|
|
29
29
|
it "fails" do
|
30
30
|
expect { subject.result }.to raise_error QuestBack::Error::MultipleResultsFound
|
@@ -34,7 +34,7 @@ describe QuestBack::Response, type: :request do
|
|
34
34
|
|
35
35
|
describe "#results" do
|
36
36
|
context "singular result" do
|
37
|
-
before { http.
|
37
|
+
before { allow(http).to receive(:body).and_return success_fixture_for('get_quests') }
|
38
38
|
|
39
39
|
it "returns the result of it's body wrapped in an array" do
|
40
40
|
expect(subject.results).to eq Array.wrap(savon_response.body[:get_quests_response][:get_quests_result][:quests][:quest])
|
@@ -42,7 +42,7 @@ describe QuestBack::Response, type: :request do
|
|
42
42
|
end
|
43
43
|
|
44
44
|
context "multiple result" do
|
45
|
-
before { http.
|
45
|
+
before { allow(http).to receive(:body).and_return success_fixture_for('get_quests_multiple_response') }
|
46
46
|
|
47
47
|
it "returns the result" do
|
48
48
|
expect(subject.results).to eq savon_response.body[:get_quests_response][:get_quests_result][:quests][:quest]
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quest_back
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thorbjørn Hermansen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -36,14 +36,14 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: 2.
|
39
|
+
version: 2.11.1
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 2.
|
46
|
+
version: 2.11.1
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -64,14 +64,14 @@ dependencies:
|
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
67
|
+
version: 3.4.0
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
74
|
+
version: 3.4.0
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: rake
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +94,7 @@ extensions: []
|
|
94
94
|
extra_rdoc_files: []
|
95
95
|
files:
|
96
96
|
- ".gitignore"
|
97
|
+
- ".travis.yml"
|
97
98
|
- CHANGELOG.md
|
98
99
|
- Gemfile
|
99
100
|
- LICENSE.txt
|
@@ -112,6 +113,7 @@ files:
|
|
112
113
|
- spec/fixtures/add_respondents_data_success.xml
|
113
114
|
- spec/fixtures/add_respondents_data_with_sms_invitation_failure.xml
|
114
115
|
- spec/fixtures/add_respondents_data_with_sms_invitation_success.xml
|
116
|
+
- spec/fixtures/add_respondents_data_without_email_invitation_success.xml
|
115
117
|
- spec/fixtures/get_language_list_success.xml
|
116
118
|
- spec/fixtures/get_quests_multiple_response_success.xml
|
117
119
|
- spec/fixtures/get_quests_success.xml
|
@@ -142,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
144
|
version: '0'
|
143
145
|
requirements: []
|
144
146
|
rubyforge_project:
|
145
|
-
rubygems_version: 2.
|
147
|
+
rubygems_version: 2.5.1
|
146
148
|
signing_key:
|
147
149
|
specification_version: 4
|
148
150
|
summary: Ruby client for QuestBack's SOAP API.
|
@@ -151,6 +153,7 @@ test_files:
|
|
151
153
|
- spec/fixtures/add_respondents_data_success.xml
|
152
154
|
- spec/fixtures/add_respondents_data_with_sms_invitation_failure.xml
|
153
155
|
- spec/fixtures/add_respondents_data_with_sms_invitation_success.xml
|
156
|
+
- spec/fixtures/add_respondents_data_without_email_invitation_success.xml
|
154
157
|
- spec/fixtures/get_language_list_success.xml
|
155
158
|
- spec/fixtures/get_quests_multiple_response_success.xml
|
156
159
|
- spec/fixtures/get_quests_success.xml
|