traitify 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +34 -0
- data/CHANGELOG.md +12 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +54 -0
- data/LICENSE.txt +22 -0
- data/README.md +166 -0
- data/lib/traitify.rb +13 -0
- data/lib/traitify/assessments.rb +36 -0
- data/lib/traitify/badges.rb +43 -0
- data/lib/traitify/client.rb +35 -0
- data/lib/traitify/client/assessments.rb +20 -0
- data/lib/traitify/client/results.rb +17 -0
- data/lib/traitify/client/slides.rb +36 -0
- data/lib/traitify/client/users.rb +17 -0
- data/lib/traitify/configuration.rb +21 -0
- data/lib/traitify/connection.rb +46 -0
- data/lib/traitify/error.rb +44 -0
- data/lib/traitify/personality_blends.rb +55 -0
- data/lib/traitify/personality_types.rb +39 -0
- data/lib/traitify/request.rb +46 -0
- data/lib/traitify/results.rb +31 -0
- data/lib/traitify/slides.rb +95 -0
- data/lib/traitify/users.rb +39 -0
- data/lib/traitify/version.rb +3 -0
- data/spec/spec_helper.rb +19 -0
- data/spec/support/mocks/assessment.json +7 -0
- data/spec/support/mocks/result.json +157 -0
- data/spec/support/mocks/slide.json +13 -0
- data/spec/support/mocks/slides.json +54 -0
- data/spec/support/mocks/slides_complete.json +54 -0
- data/spec/support/mocks/user.json +8 -0
- data/spec/traitify-ruby/client/assessment_spec.rb +64 -0
- data/spec/traitify-ruby/client/result_spec.rb +54 -0
- data/spec/traitify-ruby/client/slide_spec.rb +87 -0
- data/spec/traitify-ruby/client/user_spec.rb +41 -0
- data/traitify.gemspec +29 -0
- metadata +202 -0
@@ -0,0 +1,39 @@
|
|
1
|
+
module Traitify
|
2
|
+
class User
|
3
|
+
attr_accessor :id, :first_name, :last_name, :email, :created_at, :updated_at
|
4
|
+
|
5
|
+
def initialize(options = {})
|
6
|
+
self.id = options[:id]
|
7
|
+
self.first_name = options[:first_name]
|
8
|
+
self.last_name = options[:last_name]
|
9
|
+
self.email = options[:email]
|
10
|
+
self.created_at = options[:created_at]
|
11
|
+
self.updated_at = options[:updated_at]
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.parse_json(user)
|
15
|
+
created_at = user["created_at"] ? Time.at(user["created_at"]) : nil
|
16
|
+
updated_at = user["updated_at"] ? Time.at(user["updated_at"]) : nil
|
17
|
+
|
18
|
+
User.new(
|
19
|
+
id: user["id"],
|
20
|
+
first_name: user["first_name"],
|
21
|
+
last_name: user["last_name"],
|
22
|
+
email: user["email"],
|
23
|
+
created_at: created_at,
|
24
|
+
updated_at: updated_at
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
def to_hash
|
29
|
+
{
|
30
|
+
id: id,
|
31
|
+
first_name: first_name,
|
32
|
+
last_name: last_name,
|
33
|
+
email: email,
|
34
|
+
created_at: created_at,
|
35
|
+
updated_at: updated_at,
|
36
|
+
}
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require "Traitify"
|
2
|
+
require "webmock/rspec"
|
3
|
+
require "pry"
|
4
|
+
|
5
|
+
Dir[File.expand_path("spec/support/**/*.rb", __FILE__)].each{|f| require f}
|
6
|
+
|
7
|
+
RSpec.configure do |config|
|
8
|
+
config.color_enabled = true
|
9
|
+
config.order = "random"
|
10
|
+
end
|
11
|
+
|
12
|
+
def stub_it(http_method = :any, endpoint = "/", status = 200, response)
|
13
|
+
url = "https://secret:x@example.com/v1#{endpoint}"
|
14
|
+
stub_request(http_method, url).to_return(
|
15
|
+
status: status,
|
16
|
+
body: File.read(File.expand_path("../support/mocks/#{response}.json", __FILE__)),
|
17
|
+
headers: { 'Content-type' => "application/json" }
|
18
|
+
)
|
19
|
+
end
|
@@ -0,0 +1,157 @@
|
|
1
|
+
{
|
2
|
+
"personality_blend": {
|
3
|
+
"personality_type_1": {
|
4
|
+
"id": "028095da-31c7-4ef9-8067-bcfe3f1cd549",
|
5
|
+
"name": "Analyzer",
|
6
|
+
"description": "Analyzers...are inquisitive. They delve, study and look deeply for information. They have a keen eye and an experimental nature. Analyzers use these capacities to figure out problems and search for the facts, often in a laboratory environment. They excel at going beyond the surface toward uncovering information and discovery.",
|
7
|
+
"badge": {
|
8
|
+
"image_small": "https://traitify-api.s3.amazonaws.com/traitify-api/badges/analyzer/full-color/small",
|
9
|
+
"image_medium": "https://traitify-api.s3.amazonaws.com/traitify-api/badges/analayzer/full-color/medium",
|
10
|
+
"image_large": "https://traitify-api.s3.amazonaws.com/traitify-api/badges/analayzer/full-color/large",
|
11
|
+
"font_color": "fff",
|
12
|
+
"color_1": "81abf7",
|
13
|
+
"color_2": "6ea1ea",
|
14
|
+
"color_3": "1761ba"
|
15
|
+
}
|
16
|
+
},
|
17
|
+
"personality_type_2": {
|
18
|
+
"id": "2c9166c8-8c70-45d6-9c7b-7c975175b1fb",
|
19
|
+
"name": "Planner",
|
20
|
+
"description": "Planners...are the detail people. They are methodical, precise, and detail-oriented. Planners create systems to follow, and enjoy working with data, detail, words and numbers. Great at manipulating data, they love procedure and routine. Often found in office settings, they excel at completing detailed work in an organized manner.",
|
21
|
+
"badge": {
|
22
|
+
"image_small": "https://traitify-api.s3.amazonaws.com/traitify-api/badges/planner/full-color/small",
|
23
|
+
"image_medium": "https://traitify-api.s3.amazonaws.com/traitify-api/badges/planner/full-color/medium",
|
24
|
+
"image_large": "https://traitify-api.s3.amazonaws.com/traitify-api/badges/planner/full-color/large",
|
25
|
+
"font_color": "fff",
|
26
|
+
"color_1": "ffed73",
|
27
|
+
"color_2": "f2df72",
|
28
|
+
"color_3": "f7d719"
|
29
|
+
}
|
30
|
+
},
|
31
|
+
"name": null,
|
32
|
+
"description": null,
|
33
|
+
"compliments": null,
|
34
|
+
"conflicts": null
|
35
|
+
},
|
36
|
+
"personality_types": [
|
37
|
+
{
|
38
|
+
"personality_type": {
|
39
|
+
"id": "028095da-31c7-4ef9-8067-bcfe3f1cd549",
|
40
|
+
"name": "Analyzer",
|
41
|
+
"description": "Analyzers...are inquisitive. They delve, study and look deeply for information. They have a keen eye and an experimental nature. Analyzers use these capacities to figure out problems and search for the facts, often in a laboratory environment. They excel at going beyond the surface toward uncovering information and discovery.",
|
42
|
+
"badge": {
|
43
|
+
"image_small": "https://traitify-api.s3.amazonaws.com/traitify-api/badges/analyzer/full-color/small",
|
44
|
+
"image_medium": "https://traitify-api.s3.amazonaws.com/traitify-api/badges/analayzer/full-color/medium",
|
45
|
+
"image_large": "https://traitify-api.s3.amazonaws.com/traitify-api/badges/analayzer/full-color/large",
|
46
|
+
"font_color": "fff",
|
47
|
+
"color_1": "81abf7",
|
48
|
+
"color_2": "6ea1ea",
|
49
|
+
"color_3": "1761ba"
|
50
|
+
}
|
51
|
+
},
|
52
|
+
"score": 67
|
53
|
+
},
|
54
|
+
{
|
55
|
+
"personality_type": {
|
56
|
+
"id": "2c9166c8-8c70-45d6-9c7b-7c975175b1fb",
|
57
|
+
"name": "Planner",
|
58
|
+
"description": "Planners...are the detail people. They are methodical, precise, and detail-oriented. Planners create systems to follow, and enjoy working with data, detail, words and numbers. Great at manipulating data, they love procedure and routine. Often found in office settings, they excel at completing detailed work in an organized manner.",
|
59
|
+
"badge": {
|
60
|
+
"image_small": "https://traitify-api.s3.amazonaws.com/traitify-api/badges/planner/full-color/small",
|
61
|
+
"image_medium": "https://traitify-api.s3.amazonaws.com/traitify-api/badges/planner/full-color/medium",
|
62
|
+
"image_large": "https://traitify-api.s3.amazonaws.com/traitify-api/badges/planner/full-color/large",
|
63
|
+
"font_color": "fff",
|
64
|
+
"color_1": "ffed73",
|
65
|
+
"color_2": "f2df72",
|
66
|
+
"color_3": "f7d719"
|
67
|
+
}
|
68
|
+
},
|
69
|
+
"score": 67
|
70
|
+
},
|
71
|
+
{
|
72
|
+
"personality_type": {
|
73
|
+
"id": "02b7bbe5-1185-4443-9497-e916ae373a83",
|
74
|
+
"name": "Visionary",
|
75
|
+
"description": "Visionaries...are pioneers. They are great convincers and like to work with others in a “take charge” capacity. They love to take risks, make changes and set trends. They tend to be ambitious and energetic. Visionaries are often in positions of prominence in business and the public eye and excel at taking charge and gaining the confidence of others.",
|
76
|
+
"badge": {
|
77
|
+
"image_small": "https://traitify-api.s3.amazonaws.com/traitify-api/badges/visionary/flat/small",
|
78
|
+
"image_medium": "https://traitify-api.s3.amazonaws.com/traitify-api/badges/visionary/flat/medium",
|
79
|
+
"image_large": "https://traitify-api.s3.amazonaws.com/traitify-api/badges/visionary/flat/large",
|
80
|
+
"font_color": "fff",
|
81
|
+
"color_1": "bc7def",
|
82
|
+
"color_2": "ac70e5",
|
83
|
+
"color_3": "5322a0"
|
84
|
+
}
|
85
|
+
},
|
86
|
+
"score": 67
|
87
|
+
},
|
88
|
+
{
|
89
|
+
"personality_type": {
|
90
|
+
"id": "f49525cc-59ba-4e2a-8dde-73ec1971d7ee",
|
91
|
+
"name": "Inventor",
|
92
|
+
"description": "Inventors...are creative. They take a contemporary, ‘out of the box’ approach to work and life. Inventors use themselves and other medium, often various forms of the arts, to communicate and interact with the world. Inventors excel when they are ‘lost in their work,’ completely engrossed in a project.",
|
93
|
+
"badge": {
|
94
|
+
"image_small": "https://traitify-api.s3.amazonaws.com/traitify-api/badges/inventor/full-color/small",
|
95
|
+
"image_medium": "https://traitify-api.s3.amazonaws.com/traitify-api/badges/inventor/full-color/medium",
|
96
|
+
"image_large": "https://traitify-api.s3.amazonaws.com/traitify-api/badges/inventor/full-color/large",
|
97
|
+
"font_color": "fff",
|
98
|
+
"color_1": "7ff7e3",
|
99
|
+
"color_2": "74edd6",
|
100
|
+
"color_3": "26c6a7"
|
101
|
+
}
|
102
|
+
},
|
103
|
+
"score": 50
|
104
|
+
},
|
105
|
+
{
|
106
|
+
"personality_type": {
|
107
|
+
"id": "36c9af67-9447-4f4a-9d03-f6fb1f788f2d",
|
108
|
+
"name": "Action Taker",
|
109
|
+
"description": "Action-Takers...are hands-on doers. They use manual and physical skills, working with technology or machinery to complete tasks. Often there is an athletic aspect to their work. They are handy, practical, systematic, applied, and down-to-earth. They are drawn to jobs that involve a specific skill-set and a concrete task. They excel at solitary, goal-oriented work and getting the job done.",
|
110
|
+
"badge": {
|
111
|
+
"image_small": "https://traitify-api.s3.amazonaws.com/traitify-api/badges/action-taker/full-color/small",
|
112
|
+
"image_medium": "https://traitify-api.s3.amazonaws.com/traitify-api/badges/action-taker/full-color/medium",
|
113
|
+
"image_large": "https://traitify-api.s3.amazonaws.com/traitify-api/badges/action-taker/full-color/large",
|
114
|
+
"font_color": "fff",
|
115
|
+
"color_1": "ffa466",
|
116
|
+
"color_2": "f79b5c",
|
117
|
+
"color_3": "ea813b"
|
118
|
+
}
|
119
|
+
},
|
120
|
+
"score": 17
|
121
|
+
},
|
122
|
+
{
|
123
|
+
"personality_type": {
|
124
|
+
"id": "9172e799-c971-4822-a3fe-660369eaeef5",
|
125
|
+
"name": "Mentor",
|
126
|
+
"description": "Mentors...are people-oriented. They have great communication skills and are most fulfilled when assisting or working directly with others to improve a personal or societal situation. Mentors are patient and compassionate and work best in a group or on a team toward a common goal. Mentors excel at working with others to help them learn and grow.",
|
127
|
+
"badge": {
|
128
|
+
"image_small": "https://traitify-api.s3.amazonaws.com/traitify-api/badges/mentor/full-color/small",
|
129
|
+
"image_medium": "https://traitify-api.s3.amazonaws.com/traitify-api/badges/mentor/full-color/medium",
|
130
|
+
"image_large": "https://traitify-api.s3.amazonaws.com/traitify-api/badges/mentor/full-color/large",
|
131
|
+
"font_color": "fff",
|
132
|
+
"color_1": "f47171",
|
133
|
+
"color_2": "ea6c6c",
|
134
|
+
"color_3": "e24747"
|
135
|
+
}
|
136
|
+
},
|
137
|
+
"score": 0
|
138
|
+
},
|
139
|
+
{
|
140
|
+
"personality_type": {
|
141
|
+
"id": "9f1fd384-e321-48a4-b5f4-085b588af907",
|
142
|
+
"name": "Naturalist",
|
143
|
+
"description": "Naturalists...are attached to the natural world, frequently working with plants and animals in their environment. Often nature lovers, they like to experience the world outdoors. They are committed to preserving and protecting the planet and its natural resources. Serene, earthy, efficient and solid, they excel at working as one with the natural environment.",
|
144
|
+
"badge": {
|
145
|
+
"image_small": "https://traitify-api.s3.amazonaws.com/traitify-api/badges/naturalist/full-color/small",
|
146
|
+
"image_medium": "https://traitify-api.s3.amazonaws.com/traitify-api/badges/naturalist/full-color/medium",
|
147
|
+
"image_large": "https://traitify-api.s3.amazonaws.com/traitify-api/badges/naturalist/full-color/large",
|
148
|
+
"font_color": "fff",
|
149
|
+
"color_1": "6ad379",
|
150
|
+
"color_2": "5bc467",
|
151
|
+
"color_3": "317239"
|
152
|
+
}
|
153
|
+
},
|
154
|
+
"score": -17
|
155
|
+
}
|
156
|
+
]
|
157
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
{
|
2
|
+
"id": "dd0f359c-afbd-4be5-8f96-62d8c2d18ae9",
|
3
|
+
"position": 1,
|
4
|
+
"caption": "Swimming",
|
5
|
+
"image_desktop": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/desktop",
|
6
|
+
"image_desktop_retina": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/desktop_retina",
|
7
|
+
"image_phone_landscape": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/phone_landscape",
|
8
|
+
"image_phone_portrait": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/phone_portrait",
|
9
|
+
"response": true,
|
10
|
+
"time_taken": 600,
|
11
|
+
"completed_at": 1394724020890,
|
12
|
+
"created_at": 1394724020890
|
13
|
+
}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"id": "dd0f359c-afbd-4be5-8f96-62d8c2d18ae9",
|
4
|
+
"position": 1,
|
5
|
+
"caption": "Swimming",
|
6
|
+
"image_desktop": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/desktop",
|
7
|
+
"image_desktop_retina": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/desktop_retina",
|
8
|
+
"image_phone_landscape": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/phone_landscape",
|
9
|
+
"image_phone_portrait": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/phone_portrait",
|
10
|
+
"response": null,
|
11
|
+
"time_taken": null,
|
12
|
+
"completed_at": null,
|
13
|
+
"created_at": 1394724020890
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"id": "8fa4e615-e849-4d99-86b7-918f2a2476d3",
|
17
|
+
"position": 2,
|
18
|
+
"caption": "Swimming",
|
19
|
+
"image_desktop": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/desktop",
|
20
|
+
"image_desktop_retina": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/desktop_retina",
|
21
|
+
"image_phone_landscape": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/phone_landscape",
|
22
|
+
"image_phone_portrait": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/phone_portrait",
|
23
|
+
"response": null,
|
24
|
+
"time_taken": null,
|
25
|
+
"completed_at": null,
|
26
|
+
"created_at": 1394724020890
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"id": "c4a886ea-8855-4fd6-83b9-a7e8fa8ab047",
|
30
|
+
"position": 3,
|
31
|
+
"caption": "Swimming",
|
32
|
+
"image_desktop": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/desktop",
|
33
|
+
"image_desktop_retina": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/desktop_retina",
|
34
|
+
"image_phone_landscape": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/phone_landscape",
|
35
|
+
"image_phone_portrait": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/phone_portrait",
|
36
|
+
"response": null,
|
37
|
+
"time_taken": null,
|
38
|
+
"completed_at": null,
|
39
|
+
"created_at": 1394724020890
|
40
|
+
},
|
41
|
+
{
|
42
|
+
"id": "00cccad0-b22b-4515-bebe-cec8c16c3c41",
|
43
|
+
"position": 4,
|
44
|
+
"caption": "Swimming",
|
45
|
+
"image_desktop": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/desktop",
|
46
|
+
"image_desktop_retina": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/desktop_retina",
|
47
|
+
"image_phone_landscape": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/phone_landscape",
|
48
|
+
"image_phone_portrait": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/phone_portrait",
|
49
|
+
"response": null,
|
50
|
+
"time_taken": null,
|
51
|
+
"completed_at": null,
|
52
|
+
"created_at": 1394724020890
|
53
|
+
}
|
54
|
+
]
|
@@ -0,0 +1,54 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"id": "dd0f359c-afbd-4be5-8f96-62d8c2d18ae9",
|
4
|
+
"position": 1,
|
5
|
+
"caption": "Swimming",
|
6
|
+
"image_desktop": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/desktop",
|
7
|
+
"image_desktop_retina": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/desktop_retina",
|
8
|
+
"image_phone_landscape": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/phone_landscape",
|
9
|
+
"image_phone_portrait": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/phone_portrait",
|
10
|
+
"response": true,
|
11
|
+
"time_taken": 1000,
|
12
|
+
"completed_at": 1394724020890,
|
13
|
+
"created_at": 1394719145536
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"id": "8fa4e615-e849-4d99-86b7-918f2a2476d3",
|
17
|
+
"position": 2,
|
18
|
+
"caption": "Swimming",
|
19
|
+
"image_desktop": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/desktop",
|
20
|
+
"image_desktop_retina": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/desktop_retina",
|
21
|
+
"image_phone_landscape": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/phone_landscape",
|
22
|
+
"image_phone_portrait": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/phone_portrait",
|
23
|
+
"response": true,
|
24
|
+
"time_taken": 1000,
|
25
|
+
"completed_at": 1394724020890,
|
26
|
+
"created_at": 1394719145536
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"id": "c4a886ea-8855-4fd6-83b9-a7e8fa8ab047",
|
30
|
+
"position": 3,
|
31
|
+
"caption": "Swimming",
|
32
|
+
"image_desktop": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/desktop",
|
33
|
+
"image_desktop_retina": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/desktop_retina",
|
34
|
+
"image_phone_landscape": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/phone_landscape",
|
35
|
+
"image_phone_portrait": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/phone_portrait",
|
36
|
+
"response": true,
|
37
|
+
"time_taken": 1000,
|
38
|
+
"completed_at": 1394724020890,
|
39
|
+
"created_at": 1394719145536
|
40
|
+
},
|
41
|
+
{
|
42
|
+
"id": "00cccad0-b22b-4515-bebe-cec8c16c3c41",
|
43
|
+
"position": 4,
|
44
|
+
"caption": "Swimming",
|
45
|
+
"image_desktop": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/desktop",
|
46
|
+
"image_desktop_retina": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/desktop_retina",
|
47
|
+
"image_phone_landscape": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/phone_landscape",
|
48
|
+
"image_phone_portrait": "https://traitify-api.s3.amazonaws.com/slides/781acd1f-8184-482d-a3d1-e6190d0b7db5/phone_portrait",
|
49
|
+
"response": true,
|
50
|
+
"time_taken": 1000,
|
51
|
+
"completed_at": 1394724020890,
|
52
|
+
"created_at": 1394719145536
|
53
|
+
}
|
54
|
+
]
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Traitify::Client do
|
4
|
+
before do
|
5
|
+
Traitify.configure do |tom|
|
6
|
+
tom.secret = "secret"
|
7
|
+
tom.api_host = "https://example.com"
|
8
|
+
tom.api_version = "v1"
|
9
|
+
tom.deck_id = "deck-uuid"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
let(:tom) { Traitify.new }
|
14
|
+
|
15
|
+
describe ".create_assessment" do
|
16
|
+
context "without a user" do
|
17
|
+
let(:assessment) { tom.create_assessment }
|
18
|
+
|
19
|
+
before(:each) do
|
20
|
+
stub_it(:post, "/assessments", "assessment")
|
21
|
+
end
|
22
|
+
|
23
|
+
it "returns an assessment" do
|
24
|
+
expect(assessment.deck_id).to eq(tom.deck_id)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context "with a user" do
|
29
|
+
let(:assessment) { tom.create_assessment(user_id: "toms-uuid") }
|
30
|
+
|
31
|
+
before(:each) do
|
32
|
+
stub_it(:post, "/assessments", "assessment")
|
33
|
+
end
|
34
|
+
|
35
|
+
it "returns an assessment" do
|
36
|
+
expect(assessment.user_id).to eq("toms-uuid")
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context "with a deck" do
|
41
|
+
let(:assessment) { tom.create_assessment(deck_id: "other-deck-uuid") }
|
42
|
+
|
43
|
+
before(:each) do
|
44
|
+
stub_it(:post, "/assessments", "assessment")
|
45
|
+
end
|
46
|
+
|
47
|
+
it "returns an assessment" do
|
48
|
+
expect(assessment.id).to eq("assessment-uuid")
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe ".find_assessment" do
|
54
|
+
let(:assessment) { tom.find_assessment("assessment-uuid") }
|
55
|
+
|
56
|
+
before(:each) do
|
57
|
+
stub_it(:get, "/assessments/assessment-uuid", "assessment")
|
58
|
+
end
|
59
|
+
|
60
|
+
it "returns an assessment" do
|
61
|
+
expect(assessment.id).to eq("assessment-uuid")
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Traitify::Client do
|
4
|
+
before do
|
5
|
+
Traitify.configure do |tom|
|
6
|
+
tom.secret = "secret"
|
7
|
+
tom.api_host = "https://example.com"
|
8
|
+
tom.api_version = "v1"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
let(:tom) { Traitify.new }
|
13
|
+
|
14
|
+
describe ".find_results" do
|
15
|
+
context "without an image pack" do
|
16
|
+
let(:result) { tom.find_results("assessment-uuid") }
|
17
|
+
|
18
|
+
before(:each) do
|
19
|
+
stub_it(:get, "/assessments/assessment-uuid/personality_types", "result")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "returns a result" do
|
23
|
+
expect(result.personality_types.first.name).to eq("Analyzer")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context "with an image pack" do
|
28
|
+
context "set in the configurations" do
|
29
|
+
let(:tom) { Traitify.new(image_pack: "full-color") }
|
30
|
+
let(:result) { tom.find_results("assessment-uuid") }
|
31
|
+
|
32
|
+
before(:each) do
|
33
|
+
stub_it(:get, "/assessments/assessment-uuid/personality_types?image_pack=full-color", "result")
|
34
|
+
end
|
35
|
+
|
36
|
+
it "returns a result" do
|
37
|
+
expect(result.personality_blend.personality_type_1.badge.image_large).to eq("https://traitify-api.s3.amazonaws.com/traitify-api/badges/analayzer/full-color/large")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
context "set in the call" do
|
42
|
+
let(:result) { tom.find_results("assessment-uuid", "full-color") }
|
43
|
+
|
44
|
+
before(:each) do
|
45
|
+
stub_it(:get, "/assessments/assessment-uuid/personality_types?image_pack=full-color", "result")
|
46
|
+
end
|
47
|
+
|
48
|
+
it "returns a result" do
|
49
|
+
expect(result.personality_blend.personality_type_1.badge.image_large).to eq("https://traitify-api.s3.amazonaws.com/traitify-api/badges/analayzer/full-color/large")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|