traitify 1.8.0 → 1.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +2 -2
- data/lib/traitify/client.rb +1 -0
- data/lib/traitify/client/majors.rb +25 -0
- data/lib/traitify/version.rb +1 -1
- data/spec/support/mocks/major.json +5 -0
- data/spec/support/mocks/majors.json +7 -0
- data/spec/traitify-ruby/client/major_spec.rb +51 -0
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7530eaaaa500fb5b4cf332190b306002acdc01eb
|
4
|
+
data.tar.gz: 3878d31690a2881194aabcee0a3fe925a021bc26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a257561597252a1a2ed5880bbdedd753ed28b76020d400cd1a7a1dbbdc348142ae85ed2f25a977726b6cdeae2ca479dac016c086851a9203a4704aa5c88cbc16
|
7
|
+
data.tar.gz: a8b8c9ee517c348218c4585123105502da7873cf239ccfdda335378bbd35203ea8809f3106cdcbc2382bd26c0af5ba5a83af8d1a7c56c99188223f9317da0ca2
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
traitify (1.
|
4
|
+
traitify (1.8.1)
|
5
5
|
faraday (~> 0.9)
|
6
6
|
faraday_middleware (~> 0.9)
|
7
7
|
hashie (~> 3.0)
|
@@ -21,7 +21,7 @@ GEM
|
|
21
21
|
multipart-post (>= 1.2, < 3)
|
22
22
|
faraday_middleware (0.9.1)
|
23
23
|
faraday (>= 0.7.4, < 0.10)
|
24
|
-
hashie (3.4.
|
24
|
+
hashie (3.4.1)
|
25
25
|
method_source (0.8.2)
|
26
26
|
multipart-post (2.0.0)
|
27
27
|
pry (0.10.1)
|
data/lib/traitify/client.rb
CHANGED
@@ -0,0 +1,25 @@
|
|
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
|
data/lib/traitify/version.rb
CHANGED
@@ -0,0 +1,51 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Traitify::Client do
|
4
|
+
before do
|
5
|
+
Traitify.configure do |tom|
|
6
|
+
tom.secret_key = "secret"
|
7
|
+
tom.host = "https://example.com"
|
8
|
+
tom.version = "v1"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
let(:tom) { Traitify.new }
|
13
|
+
|
14
|
+
describe ".majors" do
|
15
|
+
context "without params" do
|
16
|
+
let(:majors) { tom.majors }
|
17
|
+
|
18
|
+
before(:each) do
|
19
|
+
stub_it(:get, "/majors", "majors")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "returns majors" do
|
23
|
+
expect(majors.first.title).to eq("Major Title")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context "with params" do
|
28
|
+
let(:majors) { tom.majors(page: 1, majors_per_page: 50) }
|
29
|
+
|
30
|
+
before(:each) do
|
31
|
+
stub_it(:get, "/majors?majors_per_page=50&page=1", "majors")
|
32
|
+
end
|
33
|
+
|
34
|
+
it "returns majors" do
|
35
|
+
expect(majors.first.title).to eq("Major Title")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe ".major" do
|
41
|
+
let(:major) { tom.major("major-id") }
|
42
|
+
|
43
|
+
before(:each) do
|
44
|
+
stub_it(:get, "/majors/major-id", "major")
|
45
|
+
end
|
46
|
+
|
47
|
+
it "returns major" do
|
48
|
+
expect(major.title).to eq("Major Title")
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: traitify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Prats
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-04-
|
12
|
+
date: 2015-04-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hashie
|
@@ -154,6 +154,7 @@ files:
|
|
154
154
|
- lib/traitify/client/assessments.rb
|
155
155
|
- lib/traitify/client/careers.rb
|
156
156
|
- lib/traitify/client/decks.rb
|
157
|
+
- lib/traitify/client/majors.rb
|
157
158
|
- lib/traitify/client/results.rb
|
158
159
|
- lib/traitify/client/slides.rb
|
159
160
|
- lib/traitify/configuration.rb
|
@@ -167,6 +168,8 @@ files:
|
|
167
168
|
- spec/support/mocks/career.json
|
168
169
|
- spec/support/mocks/careers.json
|
169
170
|
- spec/support/mocks/decks.json
|
171
|
+
- spec/support/mocks/major.json
|
172
|
+
- spec/support/mocks/majors.json
|
170
173
|
- spec/support/mocks/personality_traits.json
|
171
174
|
- spec/support/mocks/result.json
|
172
175
|
- spec/support/mocks/slide.json
|
@@ -176,6 +179,7 @@ files:
|
|
176
179
|
- spec/traitify-ruby/client/career_spec.rb
|
177
180
|
- spec/traitify-ruby/client/configuration_spec.rb
|
178
181
|
- spec/traitify-ruby/client/deck_spec.rb
|
182
|
+
- spec/traitify-ruby/client/major_spec.rb
|
179
183
|
- spec/traitify-ruby/client/result_spec.rb
|
180
184
|
- spec/traitify-ruby/client/slide_spec.rb
|
181
185
|
- traitify.gemspec
|
@@ -210,6 +214,8 @@ test_files:
|
|
210
214
|
- spec/support/mocks/career.json
|
211
215
|
- spec/support/mocks/careers.json
|
212
216
|
- spec/support/mocks/decks.json
|
217
|
+
- spec/support/mocks/major.json
|
218
|
+
- spec/support/mocks/majors.json
|
213
219
|
- spec/support/mocks/personality_traits.json
|
214
220
|
- spec/support/mocks/result.json
|
215
221
|
- spec/support/mocks/slide.json
|
@@ -219,5 +225,7 @@ test_files:
|
|
219
225
|
- spec/traitify-ruby/client/career_spec.rb
|
220
226
|
- spec/traitify-ruby/client/configuration_spec.rb
|
221
227
|
- spec/traitify-ruby/client/deck_spec.rb
|
228
|
+
- spec/traitify-ruby/client/major_spec.rb
|
222
229
|
- spec/traitify-ruby/client/result_spec.rb
|
223
230
|
- spec/traitify-ruby/client/slide_spec.rb
|
231
|
+
has_rdoc:
|