traitify 1.8.4 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +11 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +5 -1
- data/Gemfile.lock +109 -42
- data/README.md +50 -25
- data/lib/traitify/client/connection.rb +22 -0
- data/lib/traitify/client/model.rb +45 -0
- data/lib/traitify/client/overrides.rb +27 -0
- data/lib/traitify/client/request.rb +33 -0
- data/lib/traitify/client/setup.rb +25 -0
- data/lib/traitify/client.rb +20 -27
- data/lib/traitify/configuration.rb +4 -12
- data/lib/traitify/data.rb +18 -0
- data/lib/traitify/error.rb +18 -16
- data/lib/traitify/middleware/formatter.rb +52 -0
- data/lib/traitify/middleware/raise_error.rb +38 -0
- data/lib/traitify/response.rb +44 -0
- data/lib/traitify/version.rb +1 -1
- data/lib/traitify.rb +29 -1
- data/paths.yml +1352 -0
- data/spec/spec_helper.rb +14 -6
- data/spec/support/mocks/assessment.json +1 -1
- data/spec/support/mocks/assessment_analytics.json +7 -0
- data/spec/support/mocks/blank.json +0 -0
- data/spec/support/mocks/career.json +1 -2
- data/spec/support/mocks/careers.json +2 -3
- data/spec/support/mocks/decks.json +1 -4
- data/spec/support/mocks/locale.json +10 -0
- data/spec/support/mocks/locales.json +12 -0
- data/spec/support/mocks/profile.json +5 -0
- data/spec/support/mocks/profiles.json +5 -0
- data/spec/support/mocks/trait_analytics.json +7 -0
- data/spec/support/mocks/type_analytics.json +7 -0
- data/spec/traitify/client/examples/analytics_spec.rb +53 -0
- data/spec/{traitify-ruby/client → traitify/client/examples}/assessment_spec.rb +19 -14
- data/spec/traitify/client/examples/career_spec.rb +52 -0
- data/spec/traitify/client/examples/configuration_spec.rb +29 -0
- data/spec/traitify/client/examples/deck_spec.rb +29 -0
- data/spec/traitify/client/examples/locale_spec.rb +39 -0
- data/spec/{traitify-ruby/client → traitify/client/examples}/major_spec.rb +12 -11
- data/spec/traitify/client/examples/profiles_spec.rb +66 -0
- data/spec/traitify/client/examples/result_spec.rb +130 -0
- data/spec/traitify/client/examples/slide_spec.rb +95 -0
- data/spec/traitify/client/model_spec.rb +73 -0
- data/spec/traitify/client/request_spec.rb +85 -0
- data/spec/traitify/client/setup_spec.rb +62 -0
- data/spec/traitify/client_spec.rb +52 -0
- data/spec/traitify/data_spec.rb +105 -0
- data/spec/traitify/error_spec.rb +117 -0
- data/spec/traitify/response_spec.rb +82 -0
- data/spec/traitify/version_spec.rb +7 -0
- data/traitify.gemspec +14 -12
- metadata +113 -53
- data/lib/traitify/client/assessments.rb +0 -29
- data/lib/traitify/client/careers.rb +0 -25
- data/lib/traitify/client/decks.rb +0 -16
- data/lib/traitify/client/majors.rb +0 -25
- data/lib/traitify/client/results.rb +0 -37
- data/lib/traitify/client/slides.rb +0 -34
- data/lib/traitify/connection.rb +0 -33
- data/lib/traitify/request.rb +0 -18
- data/spec/traitify-ruby/client/career_spec.rb +0 -51
- data/spec/traitify-ruby/client/configuration_spec.rb +0 -51
- data/spec/traitify-ruby/client/deck_spec.rb +0 -28
- data/spec/traitify-ruby/client/result_spec.rb +0 -93
- data/spec/traitify-ruby/client/slide_spec.rb +0 -82
@@ -0,0 +1,117 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Traitify::Error do
|
4
|
+
describe "#from" do
|
5
|
+
it "creates error from 400" do
|
6
|
+
response = Traitify::Data.new(
|
7
|
+
body: "string",
|
8
|
+
request: {http_method: "get", url: "http://www.example.com"},
|
9
|
+
status: 400
|
10
|
+
)
|
11
|
+
result = Traitify::Error.from(response)
|
12
|
+
|
13
|
+
expect(result).to be_an_instance_of(Traitify::BadRequest)
|
14
|
+
end
|
15
|
+
|
16
|
+
it "creates error from 401" do
|
17
|
+
response = Traitify::Data.new(
|
18
|
+
body: "string",
|
19
|
+
request: {http_method: "get", url: "http://www.example.com"},
|
20
|
+
status: 401
|
21
|
+
)
|
22
|
+
result = Traitify::Error.from(response)
|
23
|
+
|
24
|
+
expect(result).to be_an_instance_of(Traitify::Unauthorized)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "creates error from 404" do
|
28
|
+
response = Traitify::Data.new(
|
29
|
+
body: "string",
|
30
|
+
request: {http_method: "get", url: "http://www.example.com"},
|
31
|
+
status: 404
|
32
|
+
)
|
33
|
+
result = Traitify::Error.from(response)
|
34
|
+
|
35
|
+
expect(result).to be_an_instance_of(Traitify::NotFound)
|
36
|
+
end
|
37
|
+
|
38
|
+
it "creates error from 422" do
|
39
|
+
response = Traitify::Data.new(
|
40
|
+
body: "string",
|
41
|
+
request: {http_method: "get", url: "http://www.example.com"},
|
42
|
+
status: 422
|
43
|
+
)
|
44
|
+
result = Traitify::Error.from(response)
|
45
|
+
|
46
|
+
expect(result).to be_an_instance_of(Traitify::UnprocessableEntity)
|
47
|
+
end
|
48
|
+
|
49
|
+
it "creates error from 500" do
|
50
|
+
response = Traitify::Data.new(
|
51
|
+
body: "string",
|
52
|
+
request: {http_method: "get", url: "http://www.example.com"},
|
53
|
+
status: 500
|
54
|
+
)
|
55
|
+
result = Traitify::Error.from(response)
|
56
|
+
|
57
|
+
expect(result).to be_an_instance_of(Traitify::ServerError)
|
58
|
+
end
|
59
|
+
|
60
|
+
it "creates nothing from 200" do
|
61
|
+
response = Traitify::Data.new(
|
62
|
+
body: "string",
|
63
|
+
request: {http_method: "get", url: "http://www.example.com"},
|
64
|
+
status: 200
|
65
|
+
)
|
66
|
+
result = Traitify::Error.from(response)
|
67
|
+
|
68
|
+
expect(result).to be_nil
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe ".message" do
|
73
|
+
it "returns error from array" do
|
74
|
+
response = Traitify::Data.new(
|
75
|
+
body: ["array with string"],
|
76
|
+
request: {http_method: "get", url: "http://www.example.com"},
|
77
|
+
status: 500
|
78
|
+
)
|
79
|
+
result = Traitify::Error.new(response).message
|
80
|
+
|
81
|
+
expect(result).to eq("GET | http://www.example.com | 500 | array with string")
|
82
|
+
end
|
83
|
+
|
84
|
+
it "returns error from array with object" do
|
85
|
+
response = Traitify::Data.new(
|
86
|
+
body: [{message: "array with object"}],
|
87
|
+
request: {http_method: "get", url: "http://www.example.com"},
|
88
|
+
status: 500
|
89
|
+
)
|
90
|
+
result = Traitify::Error.new(response).message
|
91
|
+
|
92
|
+
expect(result).to eq("GET | http://www.example.com | 500 | array with object")
|
93
|
+
end
|
94
|
+
|
95
|
+
it "returns error from object" do
|
96
|
+
response = Traitify::Data.new(
|
97
|
+
body: {message: "object with message"},
|
98
|
+
request: {http_method: "get", url: "http://www.example.com"},
|
99
|
+
status: 500
|
100
|
+
)
|
101
|
+
result = Traitify::Error.new(response).message
|
102
|
+
|
103
|
+
expect(result).to eq("GET | http://www.example.com | 500 | object with message")
|
104
|
+
end
|
105
|
+
|
106
|
+
it "returns error from string" do
|
107
|
+
response = Traitify::Data.new(
|
108
|
+
body: "string",
|
109
|
+
request: {http_method: "get", url: "http://www.example.com"},
|
110
|
+
status: 500
|
111
|
+
)
|
112
|
+
result = Traitify::Error.new(response).message
|
113
|
+
|
114
|
+
expect(result).to eq("GET | http://www.example.com | 500 | string")
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Traitify::Response do
|
4
|
+
describe ".data" do
|
5
|
+
it "returns array from array" do
|
6
|
+
request = OpenStruct.new(body: [{traitify: "result"}])
|
7
|
+
result = Traitify::Response.new(request).data
|
8
|
+
|
9
|
+
expect(result[0]).to be_instance_of(Traitify::Data)
|
10
|
+
expect(result[0].traitify).to eq("result")
|
11
|
+
end
|
12
|
+
|
13
|
+
it "returns data from hash" do
|
14
|
+
request = OpenStruct.new(body: {traitify: "result"})
|
15
|
+
result = Traitify::Response.new(request).data
|
16
|
+
|
17
|
+
expect(result).to be_instance_of(Traitify::Data)
|
18
|
+
expect(result.traitify).to eq("result")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe ".page" do
|
23
|
+
it "returns blank pagination" do
|
24
|
+
request = Traitify::Data.new(env: {response_headers: {}})
|
25
|
+
result = Traitify::Response.new(request).page
|
26
|
+
|
27
|
+
expect(result.previous).to be_blank
|
28
|
+
expect(result.next).to be_blank
|
29
|
+
end
|
30
|
+
|
31
|
+
it "returns both pages" do
|
32
|
+
previous_url = "http://www.example.com/previous?page=1"
|
33
|
+
next_url = "http://www.example.com/next?page=1"
|
34
|
+
link = ["<#{previous_url}>; rel=\"prev\"", "<#{next_url}>; rel=\"next\""].join(", ")
|
35
|
+
request = Traitify::Data.new(env: {response_headers: {link: link}})
|
36
|
+
result = Traitify::Response.new(request).page
|
37
|
+
|
38
|
+
expect(result.next.params.page).to eq(["1"])
|
39
|
+
expect(result.next.url).to eq(next_url)
|
40
|
+
expect(result.previous.params.page).to eq(["1"])
|
41
|
+
expect(result.previous.url).to eq(previous_url)
|
42
|
+
end
|
43
|
+
|
44
|
+
it "returns next page" do
|
45
|
+
next_url = "http://www.example.com/next?page=1"
|
46
|
+
link = ["<#{next_url}>; rel=\"next\""].join(", ")
|
47
|
+
request = Traitify::Data.new(env: {response_headers: {link: link}})
|
48
|
+
result = Traitify::Response.new(request).page
|
49
|
+
|
50
|
+
expect(result.next.params.page).to eq(["1"])
|
51
|
+
expect(result.next.url).to eq(next_url)
|
52
|
+
expect(result.previous).to be_blank
|
53
|
+
end
|
54
|
+
|
55
|
+
it "returns previous page" do
|
56
|
+
previous_url = "http://www.example.com/previous?page=1"
|
57
|
+
link = ["<#{previous_url}>; rel=\"prev\""].join(", ")
|
58
|
+
request = Traitify::Data.new(env: {response_headers: {link: link}})
|
59
|
+
result = Traitify::Response.new(request).page
|
60
|
+
|
61
|
+
expect(result.next).to be_blank
|
62
|
+
expect(result.previous.params.page).to eq(["1"])
|
63
|
+
expect(result.previous.url).to eq(previous_url)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe ".total" do
|
68
|
+
it "returns nothing" do
|
69
|
+
request = Traitify::Data.new(env: {response_headers: {}})
|
70
|
+
result = Traitify::Response.new(request).total
|
71
|
+
|
72
|
+
expect(result).to be_blank
|
73
|
+
end
|
74
|
+
|
75
|
+
it "returns total" do
|
76
|
+
request = Traitify::Data.new(env: {response_headers: {"x-total-count" => 10}})
|
77
|
+
result = Traitify::Response.new(request).total
|
78
|
+
|
79
|
+
expect(result).to eq(10)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
data/traitify.gemspec
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
lib = File.expand_path("../lib", __FILE__)
|
2
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "English"
|
3
4
|
require "traitify/version"
|
4
5
|
|
5
6
|
Gem::Specification.new do |spec|
|
@@ -8,23 +9,24 @@ Gem::Specification.new do |spec|
|
|
8
9
|
spec.licenses = ["MIT"]
|
9
10
|
spec.summary = "Traitify Gem"
|
10
11
|
spec.description = "Traitify is a ruby gem wrapper for the Traitify API"
|
11
|
-
spec.authors = ["Tom Prats", "Eric Fleming"]
|
12
|
+
spec.authors = ["Tom Prats", "Eric Fleming", "Carson Wright"]
|
12
13
|
spec.email = "tom@traitify.com"
|
13
14
|
spec.homepage = "https://www.traitify.com"
|
14
15
|
|
15
|
-
spec.files = `git ls-files`.split(
|
16
|
-
spec.executables = spec.files.grep(%r{^bin/})
|
16
|
+
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}){ |f| File.basename(f) }
|
17
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
19
|
spec.require_paths = ["lib"]
|
19
20
|
|
20
|
-
spec.
|
21
|
-
spec.
|
22
|
-
spec.
|
21
|
+
spec.add_runtime_dependency "activesupport", ">= 5.1", "< 8.x"
|
22
|
+
spec.add_runtime_dependency "faraday", "~> 2.5"
|
23
|
+
spec.add_runtime_dependency "faraday-net_http", "~> 3.0"
|
23
24
|
|
24
|
-
spec.add_development_dependency "
|
25
|
-
spec.add_development_dependency "
|
26
|
-
spec.add_development_dependency "
|
27
|
-
spec.add_development_dependency "
|
28
|
-
spec.add_development_dependency "
|
29
|
-
spec.add_development_dependency "
|
25
|
+
spec.add_development_dependency "binding_of_caller", "~> 1.0"
|
26
|
+
spec.add_development_dependency "bundler", "~> 2.2"
|
27
|
+
spec.add_development_dependency "pry", "~> 0.14"
|
28
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
29
|
+
spec.add_development_dependency "rspec", "~> 3.11"
|
30
|
+
spec.add_development_dependency "simplecov", "~> 0.21.2"
|
31
|
+
spec.add_development_dependency "webmock", "~> 3.18"
|
30
32
|
end
|
metadata
CHANGED
@@ -1,142 +1,163 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: traitify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Prats
|
8
8
|
- Eric Fleming
|
9
|
+
- Carson Wright
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date:
|
13
|
+
date: 2022-09-08 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
16
|
+
name: activesupport
|
16
17
|
requirement: !ruby/object:Gem::Requirement
|
17
18
|
requirements:
|
18
|
-
- - "
|
19
|
+
- - ">="
|
19
20
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
21
|
+
version: '5.1'
|
22
|
+
- - "<"
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 8.x
|
21
25
|
type: :runtime
|
22
26
|
prerelease: false
|
23
27
|
version_requirements: !ruby/object:Gem::Requirement
|
24
28
|
requirements:
|
25
|
-
- - "
|
29
|
+
- - ">="
|
26
30
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
31
|
+
version: '5.1'
|
32
|
+
- - "<"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 8.x
|
28
35
|
- !ruby/object:Gem::Dependency
|
29
36
|
name: faraday
|
30
37
|
requirement: !ruby/object:Gem::Requirement
|
31
38
|
requirements:
|
32
39
|
- - "~>"
|
33
40
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
41
|
+
version: '2.5'
|
35
42
|
type: :runtime
|
36
43
|
prerelease: false
|
37
44
|
version_requirements: !ruby/object:Gem::Requirement
|
38
45
|
requirements:
|
39
46
|
- - "~>"
|
40
47
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
48
|
+
version: '2.5'
|
42
49
|
- !ruby/object:Gem::Dependency
|
43
|
-
name:
|
50
|
+
name: faraday-net_http
|
44
51
|
requirement: !ruby/object:Gem::Requirement
|
45
52
|
requirements:
|
46
53
|
- - "~>"
|
47
54
|
- !ruby/object:Gem::Version
|
48
|
-
version: '0
|
55
|
+
version: '3.0'
|
49
56
|
type: :runtime
|
50
57
|
prerelease: false
|
51
58
|
version_requirements: !ruby/object:Gem::Requirement
|
52
59
|
requirements:
|
53
60
|
- - "~>"
|
54
61
|
- !ruby/object:Gem::Version
|
55
|
-
version: '0
|
62
|
+
version: '3.0'
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: binding_of_caller
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '1.0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '1.0'
|
56
77
|
- !ruby/object:Gem::Dependency
|
57
78
|
name: bundler
|
58
79
|
requirement: !ruby/object:Gem::Requirement
|
59
80
|
requirements:
|
60
81
|
- - "~>"
|
61
82
|
- !ruby/object:Gem::Version
|
62
|
-
version: '
|
83
|
+
version: '2.2'
|
63
84
|
type: :development
|
64
85
|
prerelease: false
|
65
86
|
version_requirements: !ruby/object:Gem::Requirement
|
66
87
|
requirements:
|
67
88
|
- - "~>"
|
68
89
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
90
|
+
version: '2.2'
|
70
91
|
- !ruby/object:Gem::Dependency
|
71
|
-
name:
|
92
|
+
name: pry
|
72
93
|
requirement: !ruby/object:Gem::Requirement
|
73
94
|
requirements:
|
74
95
|
- - "~>"
|
75
96
|
- !ruby/object:Gem::Version
|
76
|
-
version: '
|
97
|
+
version: '0.14'
|
77
98
|
type: :development
|
78
99
|
prerelease: false
|
79
100
|
version_requirements: !ruby/object:Gem::Requirement
|
80
101
|
requirements:
|
81
102
|
- - "~>"
|
82
103
|
- !ruby/object:Gem::Version
|
83
|
-
version: '
|
104
|
+
version: '0.14'
|
84
105
|
- !ruby/object:Gem::Dependency
|
85
|
-
name:
|
106
|
+
name: rake
|
86
107
|
requirement: !ruby/object:Gem::Requirement
|
87
108
|
requirements:
|
88
109
|
- - "~>"
|
89
110
|
- !ruby/object:Gem::Version
|
90
|
-
version: '
|
111
|
+
version: '13.0'
|
91
112
|
type: :development
|
92
113
|
prerelease: false
|
93
114
|
version_requirements: !ruby/object:Gem::Requirement
|
94
115
|
requirements:
|
95
116
|
- - "~>"
|
96
117
|
- !ruby/object:Gem::Version
|
97
|
-
version: '
|
118
|
+
version: '13.0'
|
98
119
|
- !ruby/object:Gem::Dependency
|
99
|
-
name:
|
120
|
+
name: rspec
|
100
121
|
requirement: !ruby/object:Gem::Requirement
|
101
122
|
requirements:
|
102
123
|
- - "~>"
|
103
124
|
- !ruby/object:Gem::Version
|
104
|
-
version: '
|
125
|
+
version: '3.11'
|
105
126
|
type: :development
|
106
127
|
prerelease: false
|
107
128
|
version_requirements: !ruby/object:Gem::Requirement
|
108
129
|
requirements:
|
109
130
|
- - "~>"
|
110
131
|
- !ruby/object:Gem::Version
|
111
|
-
version: '
|
132
|
+
version: '3.11'
|
112
133
|
- !ruby/object:Gem::Dependency
|
113
|
-
name:
|
134
|
+
name: simplecov
|
114
135
|
requirement: !ruby/object:Gem::Requirement
|
115
136
|
requirements:
|
116
137
|
- - "~>"
|
117
138
|
- !ruby/object:Gem::Version
|
118
|
-
version:
|
139
|
+
version: 0.21.2
|
119
140
|
type: :development
|
120
141
|
prerelease: false
|
121
142
|
version_requirements: !ruby/object:Gem::Requirement
|
122
143
|
requirements:
|
123
144
|
- - "~>"
|
124
145
|
- !ruby/object:Gem::Version
|
125
|
-
version:
|
146
|
+
version: 0.21.2
|
126
147
|
- !ruby/object:Gem::Dependency
|
127
148
|
name: webmock
|
128
149
|
requirement: !ruby/object:Gem::Requirement
|
129
150
|
requirements:
|
130
151
|
- - "~>"
|
131
152
|
- !ruby/object:Gem::Version
|
132
|
-
version: '
|
153
|
+
version: '3.18'
|
133
154
|
type: :development
|
134
155
|
prerelease: false
|
135
156
|
version_requirements: !ruby/object:Gem::Requirement
|
136
157
|
requirements:
|
137
158
|
- - "~>"
|
138
159
|
- !ruby/object:Gem::Version
|
139
|
-
version: '
|
160
|
+
version: '3.18'
|
140
161
|
description: Traitify is a ruby gem wrapper for the Traitify API
|
141
162
|
email: tom@traitify.com
|
142
163
|
executables: []
|
@@ -144,6 +165,7 @@ extensions: []
|
|
144
165
|
extra_rdoc_files: []
|
145
166
|
files:
|
146
167
|
- ".gitignore"
|
168
|
+
- ".rubocop.yml"
|
147
169
|
- CHANGELOG.md
|
148
170
|
- Gemfile
|
149
171
|
- Gemfile.lock
|
@@ -151,37 +173,58 @@ files:
|
|
151
173
|
- README.md
|
152
174
|
- lib/traitify.rb
|
153
175
|
- lib/traitify/client.rb
|
154
|
-
- lib/traitify/client/
|
155
|
-
- lib/traitify/client/
|
156
|
-
- lib/traitify/client/
|
157
|
-
- lib/traitify/client/
|
158
|
-
- lib/traitify/client/
|
159
|
-
- lib/traitify/client/slides.rb
|
176
|
+
- lib/traitify/client/connection.rb
|
177
|
+
- lib/traitify/client/model.rb
|
178
|
+
- lib/traitify/client/overrides.rb
|
179
|
+
- lib/traitify/client/request.rb
|
180
|
+
- lib/traitify/client/setup.rb
|
160
181
|
- lib/traitify/configuration.rb
|
161
|
-
- lib/traitify/
|
182
|
+
- lib/traitify/data.rb
|
162
183
|
- lib/traitify/error.rb
|
163
|
-
- lib/traitify/
|
184
|
+
- lib/traitify/middleware/formatter.rb
|
185
|
+
- lib/traitify/middleware/raise_error.rb
|
186
|
+
- lib/traitify/response.rb
|
164
187
|
- lib/traitify/version.rb
|
188
|
+
- paths.yml
|
165
189
|
- spec/spec_helper.rb
|
166
190
|
- spec/support/mocks/assessment.json
|
191
|
+
- spec/support/mocks/assessment_analytics.json
|
167
192
|
- spec/support/mocks/assessment_with_results.json
|
193
|
+
- spec/support/mocks/blank.json
|
168
194
|
- spec/support/mocks/career.json
|
169
195
|
- spec/support/mocks/careers.json
|
170
196
|
- spec/support/mocks/decks.json
|
197
|
+
- spec/support/mocks/locale.json
|
198
|
+
- spec/support/mocks/locales.json
|
171
199
|
- spec/support/mocks/major.json
|
172
200
|
- spec/support/mocks/majors.json
|
173
201
|
- spec/support/mocks/personality_traits.json
|
202
|
+
- spec/support/mocks/profile.json
|
203
|
+
- spec/support/mocks/profiles.json
|
174
204
|
- spec/support/mocks/result.json
|
175
205
|
- spec/support/mocks/slide.json
|
176
206
|
- spec/support/mocks/slides.json
|
177
207
|
- spec/support/mocks/slides_complete.json
|
178
|
-
- spec/
|
179
|
-
- spec/
|
180
|
-
- spec/traitify
|
181
|
-
- spec/traitify
|
182
|
-
- spec/traitify
|
183
|
-
- spec/traitify
|
184
|
-
- spec/traitify
|
208
|
+
- spec/support/mocks/trait_analytics.json
|
209
|
+
- spec/support/mocks/type_analytics.json
|
210
|
+
- spec/traitify/client/examples/analytics_spec.rb
|
211
|
+
- spec/traitify/client/examples/assessment_spec.rb
|
212
|
+
- spec/traitify/client/examples/career_spec.rb
|
213
|
+
- spec/traitify/client/examples/configuration_spec.rb
|
214
|
+
- spec/traitify/client/examples/deck_spec.rb
|
215
|
+
- spec/traitify/client/examples/locale_spec.rb
|
216
|
+
- spec/traitify/client/examples/major_spec.rb
|
217
|
+
- spec/traitify/client/examples/profiles_spec.rb
|
218
|
+
- spec/traitify/client/examples/result_spec.rb
|
219
|
+
- spec/traitify/client/examples/slide_spec.rb
|
220
|
+
- spec/traitify/client/model_spec.rb
|
221
|
+
- spec/traitify/client/request_spec.rb
|
222
|
+
- spec/traitify/client/setup_spec.rb
|
223
|
+
- spec/traitify/client_spec.rb
|
224
|
+
- spec/traitify/data_spec.rb
|
225
|
+
- spec/traitify/error_spec.rb
|
226
|
+
- spec/traitify/response_spec.rb
|
227
|
+
- spec/traitify/version_spec.rb
|
185
228
|
- traitify.gemspec
|
186
229
|
homepage: https://www.traitify.com
|
187
230
|
licenses:
|
@@ -202,30 +245,47 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
202
245
|
- !ruby/object:Gem::Version
|
203
246
|
version: '0'
|
204
247
|
requirements: []
|
205
|
-
|
206
|
-
rubygems_version: 2.2.2
|
248
|
+
rubygems_version: 3.1.4
|
207
249
|
signing_key:
|
208
250
|
specification_version: 4
|
209
251
|
summary: Traitify Gem
|
210
252
|
test_files:
|
211
253
|
- spec/spec_helper.rb
|
212
254
|
- spec/support/mocks/assessment.json
|
255
|
+
- spec/support/mocks/assessment_analytics.json
|
213
256
|
- spec/support/mocks/assessment_with_results.json
|
257
|
+
- spec/support/mocks/blank.json
|
214
258
|
- spec/support/mocks/career.json
|
215
259
|
- spec/support/mocks/careers.json
|
216
260
|
- spec/support/mocks/decks.json
|
261
|
+
- spec/support/mocks/locale.json
|
262
|
+
- spec/support/mocks/locales.json
|
217
263
|
- spec/support/mocks/major.json
|
218
264
|
- spec/support/mocks/majors.json
|
219
265
|
- spec/support/mocks/personality_traits.json
|
266
|
+
- spec/support/mocks/profile.json
|
267
|
+
- spec/support/mocks/profiles.json
|
220
268
|
- spec/support/mocks/result.json
|
221
269
|
- spec/support/mocks/slide.json
|
222
270
|
- spec/support/mocks/slides.json
|
223
271
|
- spec/support/mocks/slides_complete.json
|
224
|
-
- spec/
|
225
|
-
- spec/
|
226
|
-
- spec/traitify
|
227
|
-
- spec/traitify
|
228
|
-
- spec/traitify
|
229
|
-
- spec/traitify
|
230
|
-
- spec/traitify
|
231
|
-
|
272
|
+
- spec/support/mocks/trait_analytics.json
|
273
|
+
- spec/support/mocks/type_analytics.json
|
274
|
+
- spec/traitify/client/examples/analytics_spec.rb
|
275
|
+
- spec/traitify/client/examples/assessment_spec.rb
|
276
|
+
- spec/traitify/client/examples/career_spec.rb
|
277
|
+
- spec/traitify/client/examples/configuration_spec.rb
|
278
|
+
- spec/traitify/client/examples/deck_spec.rb
|
279
|
+
- spec/traitify/client/examples/locale_spec.rb
|
280
|
+
- spec/traitify/client/examples/major_spec.rb
|
281
|
+
- spec/traitify/client/examples/profiles_spec.rb
|
282
|
+
- spec/traitify/client/examples/result_spec.rb
|
283
|
+
- spec/traitify/client/examples/slide_spec.rb
|
284
|
+
- spec/traitify/client/model_spec.rb
|
285
|
+
- spec/traitify/client/request_spec.rb
|
286
|
+
- spec/traitify/client/setup_spec.rb
|
287
|
+
- spec/traitify/client_spec.rb
|
288
|
+
- spec/traitify/data_spec.rb
|
289
|
+
- spec/traitify/error_spec.rb
|
290
|
+
- spec/traitify/response_spec.rb
|
291
|
+
- spec/traitify/version_spec.rb
|
@@ -1,29 +0,0 @@
|
|
1
|
-
module Traitify
|
2
|
-
class Client
|
3
|
-
module Assessment
|
4
|
-
def create_assessment(options = {})
|
5
|
-
Hashie::Mash.new post("/assessments", { deck_id: deck_id_from(options) })
|
6
|
-
end
|
7
|
-
|
8
|
-
def assessment(assessment_id)
|
9
|
-
Hashie::Mash.new get("/assessments/#{assessment_id}")
|
10
|
-
end
|
11
|
-
alias :find_assessment :assessment
|
12
|
-
|
13
|
-
def assessment_with_results(assessment_id, image_pack = nil, data = [])
|
14
|
-
image_pack ||= self.image_pack
|
15
|
-
|
16
|
-
response = image_pack ?
|
17
|
-
get("/assessments/#{assessment_id}?data=#{data.join(",")}&image_pack=#{image_pack}") :
|
18
|
-
get("/assessments/#{assessment_id}?data=#{data.join(",")}")
|
19
|
-
|
20
|
-
Hashie::Mash.new(response)
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
def deck_id_from(options)
|
25
|
-
options[:deck_id] || deck_id
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
module Traitify
|
2
|
-
class Client
|
3
|
-
module Career
|
4
|
-
# Valid options are
|
5
|
-
# - page
|
6
|
-
# - careers_per_page
|
7
|
-
# - experience_levels
|
8
|
-
def careers(options = {})
|
9
|
-
response = options.empty? ?
|
10
|
-
get("/careers") :
|
11
|
-
get("/careers?" + options.collect{ |k,v| "#{k}=#{v}" }.join("&"))
|
12
|
-
|
13
|
-
response.collect { |career| Hashie::Mash.new(career) }
|
14
|
-
end
|
15
|
-
alias_method :find_careers, :careers
|
16
|
-
|
17
|
-
def career(id)
|
18
|
-
response = get("/careers/#{id}")
|
19
|
-
|
20
|
-
Hashie::Mash.new(response)
|
21
|
-
end
|
22
|
-
alias_method :find_career, :career
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module Traitify
|
2
|
-
class Client
|
3
|
-
module Deck
|
4
|
-
def decks(image_pack = nil)
|
5
|
-
image_pack ||= self.image_pack
|
6
|
-
|
7
|
-
response = image_pack ?
|
8
|
-
get("/decks?image_pack=#{image_pack}") :
|
9
|
-
get("/decks")
|
10
|
-
|
11
|
-
response.collect { |deck| Hashie::Mash.new(deck) }
|
12
|
-
end
|
13
|
-
alias_method :find_decks, :decks
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
module Traitify
|
2
|
-
class Client
|
3
|
-
module Major
|
4
|
-
# Valid options are
|
5
|
-
# - page
|
6
|
-
# - majors_per_page
|
7
|
-
# - experience_levels
|
8
|
-
def majors(options = {})
|
9
|
-
response = options.empty? ?
|
10
|
-
get("/majors") :
|
11
|
-
get("/majors?" + options.collect{ |k,v| "#{k}=#{v}" }.join("&"))
|
12
|
-
|
13
|
-
response.collect { |major| Hashie::Mash.new(major) }
|
14
|
-
end
|
15
|
-
alias_method :find_majors, :majors
|
16
|
-
|
17
|
-
def major(id)
|
18
|
-
response = get("/majors/#{id}")
|
19
|
-
|
20
|
-
Hashie::Mash.new(response)
|
21
|
-
end
|
22
|
-
alias_method :find_major, :major
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|