qualtrics_api 0.0.1 → 0.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 629272d717f8d529b095c1771e54a7a3e2482a16
4
- data.tar.gz: cf3fa9bf32e67fc055b5ead552334106d824b2cd
3
+ metadata.gz: a1bc31e5bdb1d4226c3a1f0511a03dd30e90a733
4
+ data.tar.gz: 75c496a12eddd15a9cafc638eaf3ef1d1c176692
5
5
  SHA512:
6
- metadata.gz: 9a1db695a3d34f476fd90da22cdc6c6653606053f5602de3e18d4836f42fb91d414ed37f62483c30ce86e32f95339c05c01e549e7a76585fbca3ee0bbf9a1811
7
- data.tar.gz: 0234a120e01f2d24b4e879c973207a330c28bfefee8685ed34aa5c8c62812916c7dfe3e9c604425ed022570bc8bd32a9708630760770b6ae0876af34b4a4bdc4
6
+ metadata.gz: 062dd62b815df05915fa106c95018d3347093db0b18a8c16639f0aca2cb0dd88f8f6047e5fa5d4a7b4cfe47195eba83fc933a763c2bf0632965bd64c16b42eb4
7
+ data.tar.gz: e18f3a82dcc31b40ae17c9d97c51e245ee5893726d72ff3e17cfbe2b49d30e27a6ef01325ae47c6f9ce278bef1f6e55950da708d76b70ddd6c2d633e45e7e533
@@ -0,0 +1,78 @@
1
+ # This configuration was generated by `rubocop --auto-gen-config`.
2
+ # The point is for the user to remove these configuration records
3
+ # one by one as the offences are removed from the code base.
4
+
5
+ AlignHash:
6
+ Enabled: true
7
+
8
+ AlignParameters:
9
+ Enabled: true
10
+
11
+ AndOr:
12
+ Enabled: false
13
+
14
+ AssignmentInCondition:
15
+ Enabled: true
16
+
17
+ BlockAlignment:
18
+ Enabled: true
19
+
20
+ Documentation:
21
+ Enabled: false
22
+
23
+ ClassAndModuleChildren:
24
+ Enabled: false
25
+
26
+ EmptyLines:
27
+ Enabled: true
28
+
29
+ EmptyLinesAroundBody:
30
+ Enabled: false
31
+
32
+ TrailingBlankLines:
33
+ Enabled: true
34
+
35
+ HashSyntax:
36
+ Enabled: false
37
+
38
+ LeadingCommentSpace:
39
+ Enabled: true
40
+
41
+ LineLength:
42
+ Enabled: false
43
+
44
+ Loop:
45
+ Enabled: true
46
+
47
+ MethodLength:
48
+ Enabled: true
49
+
50
+ NumericLiterals:
51
+ Enabled: true
52
+
53
+ RedundantSelf:
54
+ Enabled: true
55
+
56
+ SpaceBeforeBlockBraces:
57
+ Enabled: true
58
+
59
+ SpaceInsideBlockBraces:
60
+ Enabled: true
61
+
62
+ SpaceInsideBrackets:
63
+ Enabled: true
64
+
65
+ SpaceInsideHashLiteralBraces:
66
+ Enabled: true
67
+
68
+ StringLiterals:
69
+ Enabled: false
70
+
71
+ TrailingWhitespace:
72
+ Enabled: false
73
+
74
+ SignalException:
75
+ Enabled: false
76
+
77
+ UnusedBlockArgument:
78
+ Enabled: false
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.0
4
+ install: gem install bundler --version '~> 1.7' && bundle install
@@ -0,0 +1,6 @@
1
+ guard 'rspec', cmd: 'rspec --color' do
2
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
3
+ watch(%r{^lib/qualtrics_api/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
4
+
5
+ watch(%r|^spec/(.*)_spec\.rb|)
6
+ end
data/README.md CHANGED
@@ -1,3 +1,7 @@
1
+ [![Gem Version](https://badge.fury.io/rb/qualtrics_api.svg)](http://badge.fury.io/rb/qualtrics_api)
2
+ [![Dependency Status](https://gemnasium.com/pallymore/qualtrics_api.svg)](https://gemnasium.com/pallymore/qualtrics_api)
3
+ [![Build Status](https://travis-ci.org/CambridgeEducation/qualtrics_api.svg)](https://travis-ci.org/CambridgeEducation/qualtrics_api)
4
+
1
5
  # QualtricsAPI
2
6
 
3
7
  Ruby wrapper for Qualtrics REST ControlPanel API version 3.0.
@@ -1,3 +1,4 @@
1
+ require 'virtus'
1
2
  require "faraday"
2
3
  require "faraday_middleware"
3
4
 
@@ -1,23 +1,20 @@
1
1
  module QualtricsAPI
2
-
3
2
  class Client
4
- attr_reader :api_token
3
+ include Virtus.value_object
5
4
 
6
- def initialize(options = {})
7
- @api_token = options[:api_token]
8
- end
5
+ attribute :api_token, String
9
6
 
10
7
  def surveys(options = {})
11
- @surveys ||= QualtricsAPI::SurveyCollection.new options.merge({ connection: connection })
8
+ @surveys ||= QualtricsAPI::SurveyCollection.new options.merge(connection: connection)
12
9
  end
13
10
 
14
11
  def response_exports(options = {})
15
- @response_exports ||= QualtricsAPI::ResponseExportCollection.new options.merge({ connection: connection })
12
+ @response_exports ||= QualtricsAPI::ResponseExportCollection.new options.merge(connection: connection)
16
13
  end
17
14
 
18
15
  def connection
19
16
  @conn ||= Faraday.new(url: QualtricsAPI::URL,
20
- params: { apiToken: @api_token }) do |faraday|
17
+ params: { apiToken: api_token }) do |faraday|
21
18
  faraday.request :json
22
19
  faraday.response :json, :content_type => /\bjson$/
23
20
 
@@ -28,5 +25,4 @@ module QualtricsAPI
28
25
  end
29
26
  end
30
27
  end
31
-
32
28
  end
@@ -1,16 +1,12 @@
1
1
  module QualtricsAPI
2
-
3
2
  class ResponseExport
3
+ include Virtus.value_object
4
4
 
5
- attr_reader :id
6
-
7
- def initialize(options = {})
8
- @conn = options[:connection]
9
- @id = options[:id]
10
- end
5
+ attribute :connection
6
+ attribute :id, String
11
7
 
12
8
  def update_status
13
- res = @conn.get('surveys/responseExports/' + @id).body["result"]
9
+ res = connection.get('surveys/responseExports/' + id).body["result"]
14
10
  @export_progress = res["percentComplete"]
15
11
  @file_url = res["fileUrl"]
16
12
  @completed = true if @export_progress == 100.0
@@ -36,5 +32,4 @@ module QualtricsAPI
36
32
  @file_url
37
33
  end
38
34
  end
39
-
40
35
  end
@@ -2,23 +2,22 @@ module QualtricsAPI
2
2
  class ResponseExportCollection
3
3
  extend Forwardable
4
4
  include Enumerable
5
+ include Virtus.value_object
5
6
 
6
- attr_reader :all
7
+ attribute :connection
8
+ attribute :all, Array, :default => []
7
9
 
8
10
  def_delegator :all, :each
9
11
  def_delegator :all, :size
10
12
 
11
- def initialize(options = {})
12
- @conn = options[:connection]
13
- @all = []
13
+ def [](export_id)
14
+ find(export_id)
14
15
  end
15
-
16
- def [](export_id); find(export_id); end
16
+
17
17
  def find(export_id)
18
18
  @all.select do |response_export|
19
19
  response_export.id == export_id
20
- end.first || QualtricsAPI::ResponseExport.new(:id => export_id , connection: @conn)
20
+ end.first || QualtricsAPI::ResponseExport.new(:id => export_id, connection: connection)
21
21
  end
22
-
23
22
  end
24
23
  end
@@ -1,62 +1,48 @@
1
1
  module QualtricsAPI
2
2
  module Services
3
3
  class ResponseExportService
4
- attr_reader :survey_id,
5
- :response_set_id,
6
- :file_type,
7
- :last_response_id,
8
- :start_date,
9
- :end_date,
10
- :limit,
11
- :included_question_ids,
12
- :max_rows,
13
- :use_labels,
14
- :decimal_format,
15
- :seen_unanswered_recode,
16
- :use_local_time,
17
- :spss_string_length,
18
- :result
4
+ include Virtus.value_object
19
5
 
20
- def initialize(options = {})
21
- @conn = options[:connection]
22
- @survey_id = options[:survey_id]
23
- @response_set_id = options[:response_set_id]
24
- @file_type = options[:file_type] || 'CSV'
25
- @last_response_id = options[:last_response_id]
26
- @start_date = options[:start_date]
27
- @end_date = options[:end_date]
28
- @limit = options[:limit]
29
- @included_question_ids = options[:included_question_ids]
30
- @max_rows = options[:max_rows]
31
- @use_labels = options.has_key?(:use_labels) ? options[:use_labels] : false
32
- @decimal_format = options[:decimal_format] || '.'
33
- @seen_unanswered_recode = options[:seen_unanswered_recode]
34
- @use_local_time = options.has_key?(:use_local_time) ? options[:use_local_time] : false
35
- @spss_string_length = options[:spss_string_length]
36
- @id = options[:id]
37
- end
6
+ attribute :connection
7
+ attribute :survey_id, String
8
+ attribute :response_set_id, String
9
+ attribute :file_type, String, :default => 'CSV'
10
+ attribute :last_response_id, String
11
+ attribute :start_date, String
12
+ attribute :end_date, String
13
+ attribute :limit, String
14
+ attribute :included_question_ids, String
15
+ attribute :max_rows, String
16
+ attribute :use_labels, Boolean, :default => false
17
+ attribute :decimal_format, String, :default => '.'
18
+ attribute :seen_unanswered_recode, String
19
+ attribute :use_local_time, Boolean, :default => false
20
+ attribute :spss_string_length, String
21
+ attribute :id, String
22
+
23
+ attr_reader :result
38
24
 
39
25
  def start
40
- response = @conn.get("surveys/#{@survey_id}/responseExports", export_params)
26
+ response = connection.get("surveys/#{survey_id}/responseExports", export_params)
41
27
  export_id = response.body["result"]["exportStatus"].split('/').last
42
- @result = ResponseExport.new(id: export_id, connection: @conn)
28
+ @result = ResponseExport.new(id: export_id, connection: connection)
43
29
  end
44
30
 
45
31
  def export_configurations
46
32
  {
47
- response_set_id: @response_set_id,
48
- file_type: @file_type,
49
- last_response_id: @last_response_id,
50
- start_date: @start_date,
51
- end_date: @end_date,
52
- limit: @limit,
53
- included_question_ids: @included_question_ids,
54
- max_rows: @max_rows,
55
- use_labels: @use_labels,
56
- decimal_format: @decimal_format,
57
- seen_unanswered_recode: @seen_unanswered_recode,
58
- use_local_time: @use_local_time,
59
- spss_string_length: @spss_string_length
33
+ response_set_id: response_set_id,
34
+ file_type: file_type,
35
+ last_response_id: last_response_id,
36
+ start_date: start_date,
37
+ end_date: end_date,
38
+ limit: limit,
39
+ included_question_ids: included_question_ids,
40
+ max_rows: max_rows,
41
+ use_labels: use_labels,
42
+ decimal_format: decimal_format,
43
+ seen_unanswered_recode: seen_unanswered_recode,
44
+ use_local_time: use_local_time,
45
+ spss_string_length: spss_string_length
60
46
  }
61
47
  end
62
48
 
@@ -1,17 +1,26 @@
1
1
  module QualtricsAPI
2
-
3
2
  class Survey
4
- attr_accessor :id, :name, :owner_id, :last_modified, :status
3
+ include Virtus.value_object
4
+
5
+ attribute :connection
6
+ attribute :id, String
7
+ attribute :name, String
8
+ attribute :owner_id, String
9
+ attribute :last_modified, String
10
+ attribute :created_at, String
11
+ attribute :status, String
12
+
13
+ attr_accessor :id, :name, :owner_id, :last_modified, :status, :created_at
5
14
 
6
15
  def initialize(options = {})
7
16
  attributes_mappings.each do |key, qualtrics_key|
8
17
  instance_variable_set "@#{key}", options[qualtrics_key]
9
18
  end
10
- @conn = options[:connection]
19
+ super
11
20
  end
12
21
 
13
22
  def export_responses(export_options = {})
14
- QualtricsAPI::Services::ResponseExportService.new(export_options.merge(survey_id: id, connection: @conn))
23
+ QualtricsAPI::Services::ResponseExportService.new(export_options.merge(survey_id: id, connection: connection))
15
24
  end
16
25
 
17
26
  private
@@ -22,7 +31,8 @@ module QualtricsAPI
22
31
  :name => "name",
23
32
  :owner_id => "ownerId",
24
33
  :last_modified => "lastModified",
25
- :status => "status"
34
+ :status => "status",
35
+ :created_at => "SurveyCreationDate"
26
36
  }
27
37
  end
28
38
  end
@@ -1,25 +1,22 @@
1
1
  module QualtricsAPI
2
-
3
2
  class SurveyCollection
4
3
  extend Forwardable
5
4
  include Enumerable
5
+ include Virtus.value_object
6
+
7
+ attribute :connection
8
+ attribute :scope_id, String
9
+ attribute :all, Array, :default => []
6
10
 
7
- attr_accessor :scope_id
8
- attr_reader :all
11
+ attr_writer :scope_id
9
12
 
10
13
  def_delegator :all, :each
11
14
  def_delegator :all, :size
12
15
 
13
- def initialize(options = {})
14
- @conn = options[:connection]
15
- @scope_id = options[:scope_id]
16
- @all = []
17
- end
18
-
19
16
  def fetch(options = {})
20
17
  @all = []
21
18
  update_query_attributes(options)
22
- parse_fetch_response(@conn.get('surveys', query_params))
19
+ parse_fetch_response(connection.get('surveys', query_params))
23
20
  self
24
21
  end
25
22
 
@@ -30,14 +27,17 @@ module QualtricsAPI
30
27
  end
31
28
 
32
29
  def update_query_attributes(new_attributes = {})
33
- @scope_id = new_attributes[:scope_id] if new_attributes.has_key? :scope_id
30
+ @scope_id = new_attributes[:scope_id] if new_attributes.key?(:scope_id)
34
31
  end
35
32
 
36
- def [](survey_id); find(survey_id); end
33
+ def [](survey_id)
34
+ find(survey_id)
35
+ end
36
+
37
37
  def find(survey_id)
38
38
  @all.select do |survey|
39
39
  survey.id == survey_id
40
- end.first || QualtricsAPI::Survey.new("id" => survey_id , connection: @conn)
40
+ end.first || QualtricsAPI::Survey.new("id" => survey_id, connection: connection)
41
41
  end
42
42
 
43
43
  private
@@ -56,9 +56,8 @@ module QualtricsAPI
56
56
 
57
57
  def parse_fetch_response(response)
58
58
  @all = response.body["result"].map do |result|
59
- QualtricsAPI::Survey.new result.merge(connection: @conn)
59
+ QualtricsAPI::Survey.new result.merge(connection: connection)
60
60
  end
61
61
  end
62
62
  end
63
-
64
63
  end
@@ -1,3 +1,3 @@
1
1
  module QualtricsAPI
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -7,12 +7,12 @@ require 'qualtrics_api/version'
7
7
  Gem::Specification.new do |spec|
8
8
  spec.name = "qualtrics_api"
9
9
  spec.version = QualtricsAPI::VERSION
10
- spec.authors = ["Yurui Zhang"]
11
- spec.email = ["yuruiology@gmail.com"]
10
+ spec.authors = ["Yurui Zhang", "Marcin Naglik", "Mateusz Urbański"]
11
+ spec.email = ["yuruiology@gmail.com", "marcin.naglik@razorbear.com", "mateuszurbanski@yahoo.pl"]
12
12
  spec.summary = %q{A Ruby wrapper for Qualtrics REST API v3.0}
13
13
  spec.description = %q{A Ruby wrapper for Qualtrics REST API version 3.0.
14
14
  See https://co1.qualtrics.com/APIDocs/ for API documents.}
15
- spec.homepage = ""
15
+ spec.homepage = "https://github.com/CambridgeEducation/qualtrics_api"
16
16
  spec.license = "MIT"
17
17
 
18
18
  spec.files = `git ls-files -z`.split("\x0")
@@ -20,11 +20,15 @@ Gem::Specification.new do |spec|
20
20
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
21
  spec.require_paths = ["lib"]
22
22
 
23
+ spec.required_ruby_version = '>= 2.1.0'
24
+
23
25
  spec.add_dependency "faraday", "~> 0.9.1"
24
26
  spec.add_dependency "faraday_middleware", "~> 0.9.1"
27
+ spec.add_dependency "virtus", "~> 1.0"
25
28
 
26
29
  spec.add_development_dependency "bundler", "~> 1.7"
27
30
  spec.add_development_dependency "rake", "~> 10.0"
28
- spec.add_development_dependency "rspec", "~> 3.2.0"
29
- spec.add_development_dependency "vcr", "~> 2.9.3"
31
+ spec.add_development_dependency "rspec", "~> 3.2"
32
+ spec.add_development_dependency "vcr", "~> 2.9"
33
+ spec.add_development_dependency "guard-rspec", "~> 4.5"
30
34
  end
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe QualtricsAPI::Client do
4
-
5
4
  subject { QualtricsAPI::Client.new(:api_token => "someToken") }
6
5
 
7
6
  it "has an api token" do
@@ -18,7 +17,7 @@ describe QualtricsAPI::Client do
18
17
  end
19
18
 
20
19
  it "sets connection" do
21
- expect(subject.surveys.instance_variable_get(:@conn)).to eq subject.connection
20
+ expect(subject.surveys.connection).to eq subject.connection
22
21
  end
23
22
 
24
23
  it "caches the collection" do
@@ -32,7 +31,7 @@ describe QualtricsAPI::Client do
32
31
  end
33
32
 
34
33
  it "sets connection" do
35
- expect(subject.surveys.instance_variable_get(:@conn)).to eq subject.connection
34
+ expect(subject.surveys.connection).to eq subject.connection
36
35
  end
37
36
 
38
37
  it "assigns scope_id if passed" do
@@ -43,5 +42,4 @@ describe QualtricsAPI::Client do
43
42
  expect(subject.surveys.object_id).to eq subject.surveys.object_id
44
43
  end
45
44
  end
46
-
47
45
  end
@@ -3,19 +3,19 @@ require 'spec_helper'
3
3
  describe QualtricsAPI::ResponseExportCollection do
4
4
  let(:connection) { double('connection') }
5
5
 
6
- subject { described_class.new connection: connection }
6
+ subject { described_class.new(connection: connection) }
7
7
 
8
8
  it "has no @all when initialized" do
9
9
  expect(subject.all).to eq []
10
10
  end
11
11
 
12
12
  it "takes a connection" do
13
- expect(subject.instance_variable_get(:@conn)).to eq connection
13
+ expect(subject.connection).to eq connection
14
14
  end
15
15
 
16
16
  describe "#find, #[]" do
17
- let(:export_1) { QualtricsAPI::ResponseExport.new :id => "export1" }
18
- let(:export_2) { QualtricsAPI::ResponseExport.new :id => "export2" }
17
+ let(:export_1) { QualtricsAPI::ResponseExport.new(:id => "export1") }
18
+ let(:export_2) { QualtricsAPI::ResponseExport.new(:id => "export2") }
19
19
 
20
20
  it "finds the export by id" do
21
21
  subject.instance_variable_set :@all, [export_1, export_2]
@@ -27,7 +27,7 @@ describe QualtricsAPI::ResponseExportCollection do
27
27
  sut = subject["eee 3"]
28
28
  expect(sut).to be_a QualtricsAPI::ResponseExport
29
29
  expect(sut.id).to eq "eee 3"
30
- expect(sut.instance_variable_get(:@conn)).to eq connection
30
+ expect(sut.connection).to eq connection
31
31
  end
32
32
  end
33
33
  end
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe QualtricsAPI::ResponseExport do
4
-
5
4
  let(:connection) { double('connection') }
6
5
  subject { described_class.new id: "someId", connection: connection }
7
6
 
@@ -18,14 +18,14 @@ describe QualtricsAPI::Services::ResponseExportService do
18
18
  decimal_format: ",",
19
19
  seen_unanswered_recode: "something",
20
20
  use_local_time: true,
21
- spss_string_length: "15",
21
+ spss_string_length: "15"
22
22
  }
23
23
  end
24
24
  let(:connection) { double("connection") }
25
25
 
26
- subject { described_class.new params.merge(connection: connection)}
26
+ subject { described_class.new params.merge(connection: connection) }
27
27
 
28
- describe "assgin options" do
28
+ describe "assign options" do
29
29
  before do
30
30
  allow_any_instance_of(described_class).to receive(:start)
31
31
  end
@@ -37,7 +37,7 @@ describe QualtricsAPI::Services::ResponseExportService do
37
37
  end
38
38
 
39
39
  it "assigns connection" do
40
- expect(subject.instance_variable_get(:@conn)).to eq connection
40
+ expect(subject.connection).to eq connection
41
41
  end
42
42
 
43
43
  describe "defaults" do
@@ -106,5 +106,4 @@ describe QualtricsAPI::Services::ResponseExportService do
106
106
  expect(subject.id).to eq "ES_cwLvnQHobKfV9t3"
107
107
  end
108
108
  end
109
-
110
109
  end
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe QualtricsAPI::SurveyCollection do
4
-
5
4
  let(:connection) { double('connection') }
6
5
 
7
6
  subject { described_class.new connection: connection, scope_id: "fake_scopeId" }
@@ -19,7 +18,7 @@ describe QualtricsAPI::SurveyCollection do
19
18
  end
20
19
 
21
20
  it "takes a connection" do
22
- expect(subject.instance_variable_get(:@conn)).to eq connection
21
+ expect(subject.connection).to eq connection
23
22
  end
24
23
 
25
24
  describe "#query_attributes" do
@@ -43,7 +42,7 @@ describe QualtricsAPI::SurveyCollection do
43
42
  sut = subject["s3"]
44
43
  expect(sut).to be_a QualtricsAPI::Survey
45
44
  expect(sut.id).to eq "s3"
46
- expect(sut.instance_variable_get(:@conn)).to eq connection
45
+ expect(sut.connection).to eq connection
47
46
  end
48
47
  end
49
48
 
@@ -71,7 +70,7 @@ describe QualtricsAPI::SurveyCollection do
71
70
  end
72
71
 
73
72
  it "passes down the connection" do
74
- expect(subject.all.first.instance_variable_get(:@conn)).to eq client.connection
73
+ expect(subject.all.first.connection).to eq client.connection
75
74
  end
76
75
 
77
76
  it "returns itself" do
@@ -100,7 +99,5 @@ describe QualtricsAPI::SurveyCollection do
100
99
  end
101
100
  end
102
101
  end
103
-
104
102
  end
105
-
106
103
  end
@@ -1,20 +1,20 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe QualtricsAPI::Survey do
4
-
5
4
  let(:qualtrics_response) do
6
5
  {
7
6
  "id" => "SV_djzgZ6eJXqnIUyF",
8
7
  "name" => "test_survey",
9
8
  "ownerId" => "UR_3fnAz35QCGlr725",
10
9
  "lastModified" => "2015-03-20 12:56:33",
11
- "status" => "Inactive"
10
+ "status" => "Inactive",
11
+ "SurveyCreationDate" => "2015-03-20 12:56:33"
12
12
  }
13
13
  end
14
14
 
15
- let(:connection) { double('connection', {get: {}}) }
15
+ let(:connection) { double('connection', get: {}) }
16
16
 
17
- subject { described_class.new qualtrics_response.merge(connection: connection)}
17
+ subject { described_class.new qualtrics_response.merge(connection: connection) }
18
18
 
19
19
  it "has an id" do
20
20
  expect(subject.id).to eq qualtrics_response["id"]
@@ -32,12 +32,16 @@ describe QualtricsAPI::Survey do
32
32
  expect(subject.last_modified).to eq qualtrics_response["lastModified"]
33
33
  end
34
34
 
35
+ it "has created_at" do
36
+ expect(subject.created_at).to eq qualtrics_response["SurveyCreationDate"]
37
+ end
38
+
35
39
  it "has status" do
36
40
  expect(subject.status).to eq qualtrics_response["status"]
37
41
  end
38
42
 
39
43
  it "has a connection" do
40
- expect(subject.instance_variable_get(:@conn)).to eq connection
44
+ expect(subject.connection).to eq connection
41
45
  end
42
46
 
43
47
  describe "export_responses" do
@@ -48,11 +52,9 @@ describe QualtricsAPI::Survey do
48
52
  end
49
53
 
50
54
  it "inits a ResponseExportService with options" do
51
- expect(QualtricsAPI::Services::ResponseExportService).to receive(:new).with({
52
- start_date: options[:start_date],
53
- survey_id: subject.id,
54
- connection: subject.instance_variable_get(:@conn)
55
- })
55
+ expect(QualtricsAPI::Services::ResponseExportService).to receive(:new).with(start_date: options[:start_date],
56
+ survey_id: subject.id,
57
+ connection: subject.connection)
56
58
 
57
59
  subject.export_responses(options)
58
60
  end
metadata CHANGED
@@ -1,14 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qualtrics_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yurui Zhang
8
+ - Marcin Naglik
9
+ - Mateusz Urbański
8
10
  autorequire:
9
11
  bindir: bin
10
12
  cert_chain: []
11
- date: 2015-03-25 00:00:00.000000000 Z
13
+ date: 2015-06-26 00:00:00.000000000 Z
12
14
  dependencies:
13
15
  - !ruby/object:Gem::Dependency
14
16
  name: faraday
@@ -38,6 +40,20 @@ dependencies:
38
40
  - - "~>"
39
41
  - !ruby/object:Gem::Version
40
42
  version: 0.9.1
43
+ - !ruby/object:Gem::Dependency
44
+ name: virtus
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '1.0'
50
+ type: :runtime
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - "~>"
55
+ - !ruby/object:Gem::Version
56
+ version: '1.0'
41
57
  - !ruby/object:Gem::Dependency
42
58
  name: bundler
43
59
  requirement: !ruby/object:Gem::Requirement
@@ -72,39 +88,58 @@ dependencies:
72
88
  requirements:
73
89
  - - "~>"
74
90
  - !ruby/object:Gem::Version
75
- version: 3.2.0
91
+ version: '3.2'
76
92
  type: :development
77
93
  prerelease: false
78
94
  version_requirements: !ruby/object:Gem::Requirement
79
95
  requirements:
80
96
  - - "~>"
81
97
  - !ruby/object:Gem::Version
82
- version: 3.2.0
98
+ version: '3.2'
83
99
  - !ruby/object:Gem::Dependency
84
100
  name: vcr
85
101
  requirement: !ruby/object:Gem::Requirement
86
102
  requirements:
87
103
  - - "~>"
88
104
  - !ruby/object:Gem::Version
89
- version: 2.9.3
105
+ version: '2.9'
90
106
  type: :development
91
107
  prerelease: false
92
108
  version_requirements: !ruby/object:Gem::Requirement
93
109
  requirements:
94
110
  - - "~>"
95
111
  - !ruby/object:Gem::Version
96
- version: 2.9.3
112
+ version: '2.9'
113
+ - !ruby/object:Gem::Dependency
114
+ name: guard-rspec
115
+ requirement: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - "~>"
118
+ - !ruby/object:Gem::Version
119
+ version: '4.5'
120
+ type: :development
121
+ prerelease: false
122
+ version_requirements: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - "~>"
125
+ - !ruby/object:Gem::Version
126
+ version: '4.5'
97
127
  description: |-
98
128
  A Ruby wrapper for Qualtrics REST API version 3.0.
99
129
  See https://co1.qualtrics.com/APIDocs/ for API documents.
100
130
  email:
101
131
  - yuruiology@gmail.com
132
+ - marcin.naglik@razorbear.com
133
+ - mateuszurbanski@yahoo.pl
102
134
  executables: []
103
135
  extensions: []
104
136
  extra_rdoc_files: []
105
137
  files:
106
138
  - ".gitignore"
139
+ - ".rubocop.yml"
140
+ - ".travis.yml"
107
141
  - Gemfile
142
+ - Guardfile
108
143
  - LICENSE.txt
109
144
  - README.md
110
145
  - Rakefile
@@ -132,7 +167,7 @@ files:
132
167
  - spec/lib/survey_spec.rb
133
168
  - spec/qualtrics_api_spec.rb
134
169
  - spec/spec_helper.rb
135
- homepage: ''
170
+ homepage: https://github.com/CambridgeEducation/qualtrics_api
136
171
  licenses:
137
172
  - MIT
138
173
  metadata: {}
@@ -144,7 +179,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
144
179
  requirements:
145
180
  - - ">="
146
181
  - !ruby/object:Gem::Version
147
- version: '0'
182
+ version: 2.1.0
148
183
  required_rubygems_version: !ruby/object:Gem::Requirement
149
184
  requirements:
150
185
  - - ">="
@@ -152,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
187
  version: '0'
153
188
  requirements: []
154
189
  rubyforge_project:
155
- rubygems_version: 2.4.3
190
+ rubygems_version: 2.4.6
156
191
  signing_key:
157
192
  specification_version: 4
158
193
  summary: A Ruby wrapper for Qualtrics REST API v3.0