traitify 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,87 @@
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 ".find_slides" do
16
+ let(:slides) { tom.find_slides("assessment-uuid") }
17
+
18
+ before(:each) do
19
+ stub_it(:get, "/assessments/assessment-uuid/slides", "slides")
20
+ end
21
+
22
+ it "returns an assessment's slides" do
23
+ expect(slides.assessment_id).to eq("assessment-uuid")
24
+ end
25
+
26
+ it "returns slides' assessment uuid" do
27
+ expect(slides.assessment_id).to eq("assessment-uuid")
28
+ end
29
+ end
30
+
31
+ describe ".update_slides" do
32
+ let(:slides) { tom.find_slides("assessment-uuid") }
33
+ let(:slides_complete) { tom.update_slides(slides) }
34
+
35
+ before(:each) do
36
+ stub_it(:get, "/assessments/assessment-uuid/slides", "slides")
37
+ stub_it(:put, "/assessments/assessment-uuid/slides", "slides_complete")
38
+ slides.each do |slide|
39
+ slide.response = 0
40
+ slide.time_taken = 1000
41
+ end
42
+ end
43
+
44
+ it "returns an assessment" do
45
+ expect(slides_complete.first.response).to eq(true)
46
+ end
47
+ end
48
+
49
+ describe ".update_slide" do
50
+ context "with arguments" do
51
+ let(:slides) { tom.find_slides("assessment-uuid") }
52
+ let(:slide) { slides.first }
53
+ let(:slide_complete) { tom.update_slide(slides.assessment_id, slide) }
54
+
55
+ before(:each) do
56
+ stub_it(:get, "/assessments/assessment-uuid/slides", "slides")
57
+ stub_it(:put, "/assessments/assessment-uuid/slides/dd0f359c-afbd-4be5-8f96-62d8c2d18ae9", "slide")
58
+
59
+ slide.response = 0
60
+ slide.time_taken = 1000
61
+ end
62
+
63
+ it "returns a slide" do
64
+ expect(slide_complete.response).to eq(true)
65
+ end
66
+ end
67
+
68
+ context "with a hash" do
69
+ let(:slides) { tom.find_slides("assessment-uuid") }
70
+ let(:slide) { tom.update_slide(
71
+ assessment_id: slides.assessment_id,
72
+ slide_id: slides.first.id,
73
+ response: 0,
74
+ time_taken: 1000
75
+ )}
76
+
77
+ before(:each) do
78
+ stub_it(:get, "/assessments/assessment-uuid/slides", "slides")
79
+ stub_it(:put, "/assessments/assessment-uuid/slides/dd0f359c-afbd-4be5-8f96-62d8c2d18ae9", "slide")
80
+ end
81
+
82
+ it "returns a slide" do
83
+ expect(slide.response).to eq(true)
84
+ end
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,41 @@
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 ".create_user" do
15
+ let(:user) { tom.create_user(
16
+ first_name: "Tom",
17
+ last_name: "Prats",
18
+ email: "tom@tomprats.com"
19
+ )}
20
+
21
+ before(:each) do
22
+ stub_it(:post, "/users", "user")
23
+ end
24
+
25
+ it "returns a user" do
26
+ expect(user.first_name).to eq("Tom")
27
+ end
28
+ end
29
+
30
+ describe ".find_user" do
31
+ let(:user) { tom.find_user("toms-uuid") }
32
+
33
+ before(:each) do
34
+ stub_it(:get, "/users/toms-uuid", "user")
35
+ end
36
+
37
+ it "returns a user" do
38
+ expect(user.id).to eq("toms-uuid")
39
+ end
40
+ end
41
+ end
data/traitify.gemspec ADDED
@@ -0,0 +1,29 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'traitify/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "traitify"
7
+ spec.version = Traitify::VERSION
8
+ spec.author = "Tom Prats"
9
+ spec.email = "tom@tomprats.com"
10
+ spec.description = %q{Traitify Developer Gem}
11
+ spec.summary = spec.description
12
+ spec.homepage = ""
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency "faraday", "~> 0.8.0"
21
+ spec.add_dependency "faraday_middleware", "~> 0.9.0"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.3"
24
+ spec.add_development_dependency "rake", "~> 10.1.0"
25
+ spec.add_development_dependency "rspec", "~> 2.14.0"
26
+ spec.add_development_dependency "pry"
27
+ spec.add_development_dependency "binding_of_caller"
28
+ spec.add_development_dependency "webmock", "~> 1.13.0"
29
+ end
metadata ADDED
@@ -0,0 +1,202 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: traitify
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Tom Prats
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-06-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 0.8.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 0.8.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: faraday_middleware
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 0.9.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 0.9.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 10.1.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: 10.1.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: 2.14.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 2.14.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: binding_of_caller
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: webmock
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: 1.13.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ~>
123
+ - !ruby/object:Gem::Version
124
+ version: 1.13.0
125
+ description: Traitify Developer Gem
126
+ email: tom@tomprats.com
127
+ executables: []
128
+ extensions: []
129
+ extra_rdoc_files: []
130
+ files:
131
+ - .gitignore
132
+ - CHANGELOG.md
133
+ - Gemfile
134
+ - Gemfile.lock
135
+ - LICENSE.txt
136
+ - README.md
137
+ - lib/traitify.rb
138
+ - lib/traitify/assessments.rb
139
+ - lib/traitify/badges.rb
140
+ - lib/traitify/client.rb
141
+ - lib/traitify/client/assessments.rb
142
+ - lib/traitify/client/results.rb
143
+ - lib/traitify/client/slides.rb
144
+ - lib/traitify/client/users.rb
145
+ - lib/traitify/configuration.rb
146
+ - lib/traitify/connection.rb
147
+ - lib/traitify/error.rb
148
+ - lib/traitify/personality_blends.rb
149
+ - lib/traitify/personality_types.rb
150
+ - lib/traitify/request.rb
151
+ - lib/traitify/results.rb
152
+ - lib/traitify/slides.rb
153
+ - lib/traitify/users.rb
154
+ - lib/traitify/version.rb
155
+ - spec/spec_helper.rb
156
+ - spec/support/mocks/assessment.json
157
+ - spec/support/mocks/result.json
158
+ - spec/support/mocks/slide.json
159
+ - spec/support/mocks/slides.json
160
+ - spec/support/mocks/slides_complete.json
161
+ - spec/support/mocks/user.json
162
+ - spec/traitify-ruby/client/assessment_spec.rb
163
+ - spec/traitify-ruby/client/result_spec.rb
164
+ - spec/traitify-ruby/client/slide_spec.rb
165
+ - spec/traitify-ruby/client/user_spec.rb
166
+ - traitify.gemspec
167
+ homepage: ''
168
+ licenses:
169
+ - MIT
170
+ metadata: {}
171
+ post_install_message:
172
+ rdoc_options: []
173
+ require_paths:
174
+ - lib
175
+ required_ruby_version: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - '>='
178
+ - !ruby/object:Gem::Version
179
+ version: '0'
180
+ required_rubygems_version: !ruby/object:Gem::Requirement
181
+ requirements:
182
+ - - '>='
183
+ - !ruby/object:Gem::Version
184
+ version: '0'
185
+ requirements: []
186
+ rubyforge_project:
187
+ rubygems_version: 2.0.14
188
+ signing_key:
189
+ specification_version: 4
190
+ summary: Traitify Developer Gem
191
+ test_files:
192
+ - spec/spec_helper.rb
193
+ - spec/support/mocks/assessment.json
194
+ - spec/support/mocks/result.json
195
+ - spec/support/mocks/slide.json
196
+ - spec/support/mocks/slides.json
197
+ - spec/support/mocks/slides_complete.json
198
+ - spec/support/mocks/user.json
199
+ - spec/traitify-ruby/client/assessment_spec.rb
200
+ - spec/traitify-ruby/client/result_spec.rb
201
+ - spec/traitify-ruby/client/slide_spec.rb
202
+ - spec/traitify-ruby/client/user_spec.rb