qualtrics_api 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/qualtrics_api.rb +6 -0
- data/lib/qualtrics_api/base_model.rb +20 -0
- data/lib/qualtrics_api/configurable.rb +1 -0
- data/lib/qualtrics_api/extensions/serializable_collection.rb +15 -0
- data/lib/qualtrics_api/extensions/serializable_model.rb +13 -0
- data/lib/qualtrics_api/panel.rb +1 -9
- data/lib/qualtrics_api/panel_collection.rb +1 -0
- data/lib/qualtrics_api/panel_member.rb +7 -14
- data/lib/qualtrics_api/survey.rb +1 -9
- data/lib/qualtrics_api/survey_collection.rb +1 -1
- data/lib/qualtrics_api/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f99dbc6dfa6842ea514f22148e7c87fb8b183414
|
4
|
+
data.tar.gz: d6778d2aadd24c5ed9bb93e7b2de9f829228bbf8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b706a1e3f81b142307c87b7cf650c6a58797831451abc67609ded2fa0f9db158688348d0adc4ba678e60db265caee228d42364265fdc857d0bde6054fa8d139b
|
7
|
+
data.tar.gz: 096263c96a01bc162753b1c4bed1c1122c789f9efd795348b415850500cf2160e54b1dc7a7f599f2b3806a3061981356f52fb5d09bcbb285e0388c08452edc5f
|
data/lib/qualtrics_api.rb
CHANGED
@@ -10,6 +10,12 @@ require "qualtrics_api/request_error_handler"
|
|
10
10
|
|
11
11
|
require "qualtrics_api/configurable"
|
12
12
|
require "qualtrics_api/client"
|
13
|
+
|
14
|
+
require "qualtrics_api/extensions/serializable_model"
|
15
|
+
require "qualtrics_api/extensions/serializable_collection"
|
16
|
+
|
17
|
+
require "qualtrics_api/base_model"
|
18
|
+
|
13
19
|
require "qualtrics_api/survey"
|
14
20
|
require "qualtrics_api/survey_collection"
|
15
21
|
require "qualtrics_api/response_export"
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module QualtricsAPI
|
2
|
+
class BaseModel
|
3
|
+
include Virtus.value_object
|
4
|
+
include QualtricsAPI::Extensions::SerializableModel
|
5
|
+
|
6
|
+
def initialize(options = {})
|
7
|
+
attributes_mappings.each do |key, qualtrics_key|
|
8
|
+
instance_variable_set "@#{key}", options[qualtrics_key]
|
9
|
+
end
|
10
|
+
super
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def attributes_mappings
|
16
|
+
{}
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
data/lib/qualtrics_api/panel.rb
CHANGED
@@ -1,19 +1,11 @@
|
|
1
1
|
module QualtricsAPI
|
2
|
-
class Panel
|
3
|
-
include Virtus.value_object
|
2
|
+
class Panel < BaseModel
|
4
3
|
|
5
4
|
attribute :id, String
|
6
5
|
attribute :library_id, String
|
7
6
|
attribute :name, String
|
8
7
|
attribute :category, String
|
9
8
|
|
10
|
-
def initialize(options = {})
|
11
|
-
attributes_mappings.each do |key, qualtrics_key|
|
12
|
-
instance_variable_set "@#{key}", options[qualtrics_key]
|
13
|
-
end
|
14
|
-
super
|
15
|
-
end
|
16
|
-
|
17
9
|
def members(options = {})
|
18
10
|
@members ||= QualtricsAPI::PanelMemberCollection.new(options.merge(id: id))
|
19
11
|
end
|
@@ -1,7 +1,5 @@
|
|
1
1
|
module QualtricsAPI
|
2
|
-
class PanelMember
|
3
|
-
include Virtus.value_object
|
4
|
-
|
2
|
+
class PanelMember < BaseModel
|
5
3
|
attribute :id, String
|
6
4
|
attribute :first_name, String
|
7
5
|
attribute :last_name, String
|
@@ -11,23 +9,18 @@ module QualtricsAPI
|
|
11
9
|
attribute :external_data_reference, String
|
12
10
|
attribute :embeded_data, Hash
|
13
11
|
|
14
|
-
def initialize(options = {})
|
15
|
-
attributes_mappings.each do |key, qualtrics_key|
|
16
|
-
instance_variable_set "@#{key}", options[qualtrics_key]
|
17
|
-
end
|
18
|
-
super
|
19
|
-
end
|
20
|
-
|
21
12
|
def to_json(_options = {})
|
22
|
-
|
13
|
+
attributes.to_json
|
23
14
|
end
|
24
15
|
|
25
|
-
|
16
|
+
alias_method :super_attributes, :attributes
|
26
17
|
|
27
|
-
def
|
28
|
-
Hash[
|
18
|
+
def attributes
|
19
|
+
Hash[super_attributes.map { |k, v| [mapped_and_uppercased_attribute(k), v] }].delete_if { |_k, v| v.nil? }
|
29
20
|
end
|
30
21
|
|
22
|
+
private
|
23
|
+
|
31
24
|
def mapped_and_uppercased_attribute(attribute)
|
32
25
|
(attributes_mappings[attribute] || attribute).to_s.tap do |a|
|
33
26
|
a[0] = a[0].upcase
|
data/lib/qualtrics_api/survey.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
module QualtricsAPI
|
2
|
-
class Survey
|
3
|
-
include Virtus.value_object
|
2
|
+
class Survey < BaseModel
|
4
3
|
|
5
4
|
attribute :id, String
|
6
5
|
attribute :name, String
|
@@ -9,13 +8,6 @@ module QualtricsAPI
|
|
9
8
|
attribute :created_at, String
|
10
9
|
attribute :status, String
|
11
10
|
|
12
|
-
def initialize(options = {})
|
13
|
-
attributes_mappings.each do |key, qualtrics_key|
|
14
|
-
instance_variable_set "@#{key}", options[qualtrics_key]
|
15
|
-
end
|
16
|
-
super
|
17
|
-
end
|
18
|
-
|
19
11
|
def export_responses(export_options = {})
|
20
12
|
QualtricsAPI::Services::ResponseExportService.new(export_options.merge(survey_id: id))
|
21
13
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qualtrics_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yurui Zhang
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-07-
|
13
|
+
date: 2015-07-22 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: faraday
|
@@ -170,8 +170,11 @@ files:
|
|
170
170
|
- fixtures/vcr_cassettes/survey_collection_fetch_sucess.yml
|
171
171
|
- fixtures/vcr_cassettes/survey_collection_fetch_with_scopeId_success.yml
|
172
172
|
- lib/qualtrics_api.rb
|
173
|
+
- lib/qualtrics_api/base_model.rb
|
173
174
|
- lib/qualtrics_api/client.rb
|
174
175
|
- lib/qualtrics_api/configurable.rb
|
176
|
+
- lib/qualtrics_api/extensions/serializable_collection.rb
|
177
|
+
- lib/qualtrics_api/extensions/serializable_model.rb
|
175
178
|
- lib/qualtrics_api/panel.rb
|
176
179
|
- lib/qualtrics_api/panel_collection.rb
|
177
180
|
- lib/qualtrics_api/panel_import.rb
|