qualtrics 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/qualtrics.rb +1 -0
- data/lib/qualtrics/recipient.rb +7 -0
- data/lib/qualtrics/submission.rb +39 -0
- data/lib/qualtrics/version.rb +1 -1
- data/qualtrics.gemspec +0 -1
- data/spec/fixtures/vcr_cassettes/Qualtrics_Submission/has_a_survey_id.yml +62 -0
- data/spec/qualtrics/recipient_spec.rb +27 -0
- data/spec/qualtrics/submission_spec.rb +54 -0
- data/spec/spec_helper.rb +1 -1
- metadata +6 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3082552f68e86aa628b0dcda0ffd131fc6638b2e
|
4
|
+
data.tar.gz: 1432fdb41b01181a73fce80a07ccb5af9225d569
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20d57dd6f18568e10e651dc33b262f824e50aa20adad0ca65e10fc4685904161b86117152fff84ae7174c803e5bb2a0f99003d3f140c8898ea9b9287f26bd56a
|
7
|
+
data.tar.gz: deeab34717dd6e74b9cdd4fb1a39de7b4fd8ec29455c9874e05e45251b7aca2f6311cb50eb5705f578eb84f6449af8789033364ffb9dfd7f78ddbe43f7a204aa
|
data/lib/qualtrics.rb
CHANGED
data/lib/qualtrics/recipient.rb
CHANGED
@@ -98,6 +98,13 @@ module Qualtrics
|
|
98
98
|
}
|
99
99
|
end
|
100
100
|
|
101
|
+
def response_history
|
102
|
+
info_hash["RecipientResponseHistory"].map do |r|
|
103
|
+
response = Hash[r.map{|k,v| [Qualtrics::Submission.attribute_map[k], v]}]
|
104
|
+
Qualtrics::Submission.new(response)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
101
108
|
protected
|
102
109
|
def update_params
|
103
110
|
{
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Qualtrics
|
2
|
+
class Submission < Entity
|
3
|
+
|
4
|
+
attr_accessor :id, :survey_id, :distribution_id, :finished_survey, :time_stamp
|
5
|
+
|
6
|
+
def initialize(options={})
|
7
|
+
@id = options[:id]
|
8
|
+
@survey_id = options[:survey_id]
|
9
|
+
@distribution_id = options[:distribution_id]
|
10
|
+
@finished_survey = options[:finished_survey]
|
11
|
+
@time_stamp = options[:time_stamp]
|
12
|
+
end
|
13
|
+
|
14
|
+
def info_hash
|
15
|
+
response = get('getLegacyResponseData', {
|
16
|
+
'SurveyID' => survey_id,
|
17
|
+
'ResponseID' => id,
|
18
|
+
'Format' => 'CSV',
|
19
|
+
'ExportTags' => 1
|
20
|
+
})
|
21
|
+
|
22
|
+
if response.success?
|
23
|
+
response
|
24
|
+
else
|
25
|
+
false
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.attribute_map
|
30
|
+
{
|
31
|
+
'ResponseID' => :id,
|
32
|
+
'SurveyID' => :survey_id,
|
33
|
+
'TimeStamp' => :time_stamp,
|
34
|
+
'EmailDistributionID' => :distribution_id,
|
35
|
+
'FinishedSurvey' => :finished_survey
|
36
|
+
}
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/qualtrics/version.rb
CHANGED
data/qualtrics.gemspec
CHANGED
@@ -0,0 +1,62 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://survey.qualtrics.com/WRAPI/ControlPanel/api.php?ExportTags=1&Format=JSON&Request=getLegacyResponseData&ResponseID=R_296ZnPPDJEONkHP&SurveyID=SV_8deJytTY3InclQ9&Token=<QUALTRICS_TOKEN>&User=<QUALTRICS_USER>&Version=2.3
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.9.1
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- "*/*"
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- Apache
|
23
|
+
Cache-Control:
|
24
|
+
- max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0,
|
25
|
+
max-age=315360000
|
26
|
+
Pragma:
|
27
|
+
- ''
|
28
|
+
Content-Transfer-Encoding:
|
29
|
+
- binary
|
30
|
+
Requeststatus:
|
31
|
+
- Success
|
32
|
+
Expires:
|
33
|
+
- Thu, 27 Feb 2025 19:32:02 GMT
|
34
|
+
P3p:
|
35
|
+
- CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE", CP="CAO
|
36
|
+
DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"
|
37
|
+
Servershortname:
|
38
|
+
- w11
|
39
|
+
X-Cnection:
|
40
|
+
- close
|
41
|
+
X-Edgeconnect-Midmile-Rtt:
|
42
|
+
- '1'
|
43
|
+
- '20'
|
44
|
+
X-Edgeconnect-Origin-Mex-Latency:
|
45
|
+
- '1356'
|
46
|
+
- '788'
|
47
|
+
Content-Length:
|
48
|
+
- '1199'
|
49
|
+
Content-Type:
|
50
|
+
- application/json
|
51
|
+
Date:
|
52
|
+
- Mon, 02 Mar 2015 19:32:03 GMT
|
53
|
+
Connection:
|
54
|
+
- keep-alive
|
55
|
+
body:
|
56
|
+
encoding: UTF-8
|
57
|
+
string: '{"R_296ZnPPDJEONkHP":{"ResponseSet":"Default Response Set","Name":"fn,
|
58
|
+
kln","ExternalDataReference":"7","EmailAddress":"ksun@brookeside.com","IPAddress":"104.129.66.226","Status":"0","StartDate":"2015-03-02
|
59
|
+
13:50:13","EndDate":"2015-03-02 13:50:40","Finished":"1","seller_company":"","role":"","redirect_host":"","sect1_head":1,"q1_lc_1":"9","q2_lr_1":"9","q3_lr_1":"9","q4_lc_1":"9","q5_lc_1":"9","q6_li_1":"9","q7_lr_1":"9","q8_li_1":"9","sect2_head":1,"q1_cs_1":"4","q2_cr_1":"4","q3_ch_1":"4","q4_ci_1":"4","q5_cc_1":"4","q9_cp_1":"4","q10_cs_1":"4","q8_cr_1":"4","q6_ch_1":"4","q11_ci_1":"4","q7_cc_1":"4","q14_cp_1":"4","q13_cs_1":"4","q12_cr_1":"4","q15_ch_1":"4","q16_ci_1":"4","q17_cc_1":"4","q18_cp_1":"4","sect3_head":1,"q1_pi_1":"3","q2_pc_1":"3","q3_pr_1":"3","q4_pp_1":"3","q5_ps_1":"3","q6_ph_1":"3","q7_pi_1":"3","q8_pc_1":"3","q9_pr_1":"3","q10_pp_1":"3","q11_ps_1":"3","q12_ph_1":"3","q13_pi_1":"3","q14_pc_1":"3","q15_pr_1":"3","q16_pp_1":"3","q17_ps_1":"3","q18_ph_1":"3","q19_pi_1":"3","q20_pc_1":"3","q21_pr_1":"3","q22_pp_1":"3","q23_ps_1":"3","q24_ph_1":"3","q25_pi_1":"3","q26_pc_1":"3","q27_pr_1":"3","q28_pp_1":"3","q29_ps_1":"3","q30_ph_1":"3","sect4_head":1,"q1_mx":""}}'
|
60
|
+
http_version:
|
61
|
+
recorded_at: Mon, 02 Mar 2015 19:32:03 GMT
|
62
|
+
recorded_with: VCR 2.9.3
|
@@ -182,4 +182,31 @@ describe Qualtrics::Recipient, :vcr => true do
|
|
182
182
|
end
|
183
183
|
end
|
184
184
|
|
185
|
+
context 'has responses' do
|
186
|
+
let(:recipient) { Qualtrics::Recipient.new }
|
187
|
+
|
188
|
+
it 'can check its own response history' do
|
189
|
+
allow(recipient).to receive(:info_hash).and_return (
|
190
|
+
{
|
191
|
+
'PanelMemberID' => 'whatever',
|
192
|
+
'PanelID' => 'this is',
|
193
|
+
'FirstName' => 'kk',
|
194
|
+
'LastName' => 'omg',
|
195
|
+
'RecipientResponseHistory' =>
|
196
|
+
[{'ResponseID' => 'response_id',
|
197
|
+
'SurveyID' => 'survey_id',
|
198
|
+
'TimeStamp' => '2015-03-02 11:50:40',
|
199
|
+
'EmailDistributionID' => 'distribution_id',
|
200
|
+
'FinishedSurvey' => true}]
|
201
|
+
}
|
202
|
+
)
|
203
|
+
|
204
|
+
response = recipient.response_history[0]
|
205
|
+
expect(response.distribution_id).to eql('distribution_id')
|
206
|
+
expect(response.finished_survey).to eql(true)
|
207
|
+
expect(response.id).to eql('response_id')
|
208
|
+
expect(response.survey_id).to eql('survey_id')
|
209
|
+
expect(response.time_stamp).to eql('2015-03-02 11:50:40')
|
210
|
+
end
|
211
|
+
end
|
185
212
|
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Qualtrics::Submission, vcr: true do
|
4
|
+
it 'has an id' do
|
5
|
+
id = '12345asdfg'
|
6
|
+
|
7
|
+
submission = Qualtrics::Submission.new({
|
8
|
+
id: id
|
9
|
+
})
|
10
|
+
|
11
|
+
expect(submission.id).to eql(id)
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'has a survey id' do
|
15
|
+
survey_id = 'survey_id'
|
16
|
+
|
17
|
+
submission = Qualtrics::Submission.new({
|
18
|
+
survey_id: survey_id
|
19
|
+
})
|
20
|
+
|
21
|
+
expect(submission.survey_id).to eql(survey_id)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'has a distribution id' do
|
25
|
+
distribution_id = 'distribution_id'
|
26
|
+
|
27
|
+
submission = Qualtrics::Submission.new({
|
28
|
+
distribution_id: distribution_id
|
29
|
+
})
|
30
|
+
|
31
|
+
expect(submission.distribution_id).to eql(distribution_id)
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'has a finished survey boolean' do
|
35
|
+
finished_survey = true
|
36
|
+
|
37
|
+
submission = Qualtrics::Submission.new({
|
38
|
+
finished_survey: finished_survey
|
39
|
+
})
|
40
|
+
|
41
|
+
expect(submission.finished_survey).to eql(finished_survey)
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'has a timestamp' do
|
45
|
+
time_stamp = "2015-03-02 11:50:40"
|
46
|
+
|
47
|
+
submission = Qualtrics::Submission.new({
|
48
|
+
time_stamp: time_stamp
|
49
|
+
})
|
50
|
+
|
51
|
+
expect(submission.time_stamp).to eql(time_stamp)
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qualtrics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Sun
|
@@ -165,20 +165,6 @@ dependencies:
|
|
165
165
|
- - ">="
|
166
166
|
- !ruby/object:Gem::Version
|
167
167
|
version: '0'
|
168
|
-
- !ruby/object:Gem::Dependency
|
169
|
-
name: mocha
|
170
|
-
requirement: !ruby/object:Gem::Requirement
|
171
|
-
requirements:
|
172
|
-
- - ">="
|
173
|
-
- !ruby/object:Gem::Version
|
174
|
-
version: '0'
|
175
|
-
type: :development
|
176
|
-
prerelease: false
|
177
|
-
version_requirements: !ruby/object:Gem::Requirement
|
178
|
-
requirements:
|
179
|
-
- - ">="
|
180
|
-
- !ruby/object:Gem::Version
|
181
|
-
version: '0'
|
182
168
|
description: Client for Qualtrics API with Faraday
|
183
169
|
email:
|
184
170
|
- sunkev@brandeis.edu
|
@@ -207,6 +193,7 @@ files:
|
|
207
193
|
- lib/qualtrics/recipient.rb
|
208
194
|
- lib/qualtrics/recipient_import_row.rb
|
209
195
|
- lib/qualtrics/response.rb
|
196
|
+
- lib/qualtrics/submission.rb
|
210
197
|
- lib/qualtrics/survey.rb
|
211
198
|
- lib/qualtrics/survey_import.rb
|
212
199
|
- lib/qualtrics/transaction.rb
|
@@ -236,6 +223,7 @@ files:
|
|
236
223
|
- spec/fixtures/vcr_cassettes/Qualtrics_Recipient/recipient_made_in_qualtrics/can_delete_itself_in_qualtrics.yml
|
237
224
|
- spec/fixtures/vcr_cassettes/Qualtrics_Recipient/recipient_made_in_qualtrics/can_update_itself_in_qualtrics.yml
|
238
225
|
- spec/fixtures/vcr_cassettes/Qualtrics_Recipient/recipient_made_in_qualtrics/gets_its_information_in_qualtrics.yml
|
226
|
+
- spec/fixtures/vcr_cassettes/Qualtrics_Submission/has_a_survey_id.yml
|
239
227
|
- spec/fixtures/vcr_cassettes/Qualtrics_Survey/creating_to_qualtrics/can_be_activated_or_deactivated.yml
|
240
228
|
- spec/fixtures/vcr_cassettes/Qualtrics_Survey/creating_to_qualtrics/destroys_a_survey_that_returns_true_when_successful.yml
|
241
229
|
- spec/fixtures/vcr_cassettes/Qualtrics_Survey/creating_to_qualtrics/populates_the_survey_id_when_successful.yml
|
@@ -251,6 +239,7 @@ files:
|
|
251
239
|
- spec/qualtrics/recipient_import_row_spec.rb
|
252
240
|
- spec/qualtrics/recipient_spec.rb
|
253
241
|
- spec/qualtrics/response_spec.rb
|
242
|
+
- spec/qualtrics/submission_spec.rb
|
254
243
|
- spec/qualtrics/survey_import_spec.rb
|
255
244
|
- spec/qualtrics/survey_spec.rb
|
256
245
|
- spec/spec_helper.rb
|
@@ -306,6 +295,7 @@ test_files:
|
|
306
295
|
- spec/fixtures/vcr_cassettes/Qualtrics_Recipient/recipient_made_in_qualtrics/can_delete_itself_in_qualtrics.yml
|
307
296
|
- spec/fixtures/vcr_cassettes/Qualtrics_Recipient/recipient_made_in_qualtrics/can_update_itself_in_qualtrics.yml
|
308
297
|
- spec/fixtures/vcr_cassettes/Qualtrics_Recipient/recipient_made_in_qualtrics/gets_its_information_in_qualtrics.yml
|
298
|
+
- spec/fixtures/vcr_cassettes/Qualtrics_Submission/has_a_survey_id.yml
|
309
299
|
- spec/fixtures/vcr_cassettes/Qualtrics_Survey/creating_to_qualtrics/can_be_activated_or_deactivated.yml
|
310
300
|
- spec/fixtures/vcr_cassettes/Qualtrics_Survey/creating_to_qualtrics/destroys_a_survey_that_returns_true_when_successful.yml
|
311
301
|
- spec/fixtures/vcr_cassettes/Qualtrics_Survey/creating_to_qualtrics/populates_the_survey_id_when_successful.yml
|
@@ -321,6 +311,7 @@ test_files:
|
|
321
311
|
- spec/qualtrics/recipient_import_row_spec.rb
|
322
312
|
- spec/qualtrics/recipient_spec.rb
|
323
313
|
- spec/qualtrics/response_spec.rb
|
314
|
+
- spec/qualtrics/submission_spec.rb
|
324
315
|
- spec/qualtrics/survey_import_spec.rb
|
325
316
|
- spec/qualtrics/survey_spec.rb
|
326
317
|
- spec/spec_helper.rb
|