qualtrics 0.5.8 → 0.5.9b

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: c4d90b05afe3ccaf9a2d35b379c7600bfe98d40b
4
- data.tar.gz: c144ce0eeec7e63c18e3964edcf70baf9b041e26
3
+ metadata.gz: ff857183cb9afc1fac74cb73bcd8ae3c0b8e2d4a
4
+ data.tar.gz: b7c60632e41be773d07ab12d000cc4c36b64acfd
5
5
  SHA512:
6
- metadata.gz: 57a35f15099f12f0e0a53d93a8a32e56b5a540341e279484feb51b2217b6a4e09a4468b424a20a64c6f2c1150a6e8fc668edec3be76a4e6155ec0ea5a1f978c4
7
- data.tar.gz: d4370401903c2822eecbd964edfc71d97b8ed925fac277cbed9fc13765cfc718c12fdb58dec8de9677ec49f094397fe8822463f7af892805f4299ffd92509375
6
+ metadata.gz: a2f5265358a434c1d86e3b99658e1a5d8149de80636567550f44cc41cf598ea74c091cc977d82489a98c23be70439a6fe81d420fe4ac8a7a70028d9b103939dc
7
+ data.tar.gz: 0c78a6a51a56441d778f8868ae71e61238165fb6714518083747a38cece85ef8c5fe8856ed570325e758dbe00247f0b0b6c925688e65346adce1667c43f3a030
@@ -16,7 +16,11 @@ module Qualtrics
16
16
  end
17
17
 
18
18
  def result
19
- body['Result'].nil? ? {} : body['Result']
19
+ if content_type == 'application/vnd.msexcel'
20
+ body.nil? ? {} : body
21
+ else
22
+ body['Result'].nil? ? {} : body['Result']
23
+ end
20
24
  end
21
25
 
22
26
  def status
@@ -32,7 +36,7 @@ module Qualtrics
32
36
  elsif content_type == 'application/json'
33
37
  @body = JSON.parse(@raw_response.body)
34
38
  elsif content_type == 'application/vnd.msexcel'
35
- @body = CSV.parse(@raw_response.body)
39
+ @body = @raw_response.body
36
40
  else
37
41
  raise Qualtrics::UnexpectedContentType, content_type
38
42
  end
@@ -11,7 +11,7 @@ module Qualtrics
11
11
  @time_stamp = options[:time_stamp]
12
12
  end
13
13
 
14
- def csv_result
14
+ def raw_csv
15
15
  response = get('getLegacyResponseData', {
16
16
  'SurveyID' => survey_id,
17
17
  'ResponseID' => id,
@@ -20,7 +20,7 @@ module Qualtrics
20
20
  })
21
21
 
22
22
  if response.status == 200
23
- response
23
+ response.result
24
24
  else
25
25
  false
26
26
  end
@@ -1,3 +1,3 @@
1
1
  module Qualtrics
2
- VERSION = "0.5.8"
2
+ VERSION = "0.5.9b"
3
3
  end
@@ -55,28 +55,25 @@ describe Qualtrics::Response, :vcr do
55
55
  Faraday.new do |builder|
56
56
  builder.adapter :test, Faraday::Adapter::Test::Stubs.new do |m|
57
57
  m.get('/csv_response') { |env| [ 200, {'Content-Type'=>'application/vnd.msexcel'}, 'csv,stuff' ]}
58
- m.get('/json_response') { |env| [ 200, {'Content-Type'=>'application/json'}, '{"Meta":{"Status":"Fubar","Debug":""}}' ]}
58
+ m.get('/json_response') { |env| [ 200, {'Content-Type'=>'application/json'}, '{"Meta":{"Status":"Fubar","Debug":""}, "Result":{"Works":"Working"}}' ]}
59
59
  m.get('/random_content') { |env| [ 200, {'Content-Type'=>'random stuff'}, 'not a real body' ]}
60
60
  end
61
61
  end
62
62
  end
63
63
 
64
- it 'can parse csv' do
65
- # s = Qualtrics::Submission.new(id: 'R_5msAm76fXKn1adf', survey_id:'SV_8deJytTY3InclQ9')
64
+ it 'can return RAW csv file' do
66
65
  raw_response = content_endpoints.get('/csv_response')
67
66
  response = Qualtrics::Response.new(raw_response)
68
- expect(lambda{ response.send(:body) }).to_not raise_error
67
+ expect(response.result).to eql ('csv,stuff')
69
68
  end
70
69
 
71
70
  it 'can parse json' do
72
- # s = Qualtrics::Submission.new(id: 'R_5msAm76fXKn1adf', survey_id:'SV_8deJytTY3InclQ9')
73
71
  raw_response = content_endpoints.get('/json_response')
74
72
  response = Qualtrics::Response.new(raw_response)
75
- expect(lambda{ response.send(:body) }).to_not raise_error
73
+ expect(response.result).to eql ({'Works' => 'Working'})
76
74
  end
77
75
 
78
76
  it 'raises an error for other content types' do
79
- # s = Qualtrics::Submission.new(id: 'R_5msAm76fXKn1adf', survey_id:'SV_8deJytTY3InclQ9')
80
77
  raw_response = content_endpoints.get('/random_content')
81
78
  response = Qualtrics::Response.new(raw_response)
82
79
  expect(lambda{ response.send(:body) }).to raise_error(Qualtrics::UnexpectedContentType)
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.8
4
+ version: 0.5.9b
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Sun
@@ -260,12 +260,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
260
260
  version: '0'
261
261
  required_rubygems_version: !ruby/object:Gem::Requirement
262
262
  requirements:
263
- - - ">="
263
+ - - ">"
264
264
  - !ruby/object:Gem::Version
265
- version: '0'
265
+ version: 1.3.1
266
266
  requirements: []
267
267
  rubyforge_project:
268
- rubygems_version: 2.2.2
268
+ rubygems_version: 2.4.6
269
269
  signing_key:
270
270
  specification_version: 4
271
271
  summary: Client for Qualtrics API