workable 1.0.0.rc2 → 1.0.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/workable/client.rb +24 -5
- data/lib/workable/version.rb +1 -1
- data/spec/lib/workable/client_spec.rb +26 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a012b72ac227d6a5e255ab04744c9d1d73b3702
|
4
|
+
data.tar.gz: c4d387f0f391433e9daa0dcea11e44d31a199530
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bf6600e83452fcb61a6f42ffcf91dae9ef568a9e003fa86901f22dd2fc4c48ea84babb708edf131f37f911a1799292e2cc4f2d49629d267ca7b893e4fe86629
|
7
|
+
data.tar.gz: 25d8a1c06fe687e3101bcb1df465f370a4cb46ea5de0cc8eb36d249044389f4f285ed642e50fb35f537a6a6fae89a18acf8e3bbeba9b164cb35bbbdd225c9941
|
data/README.md
CHANGED
@@ -49,7 +49,9 @@ client.stages # => Array of hashes
|
|
49
49
|
client.recruiters # => Array of hashes
|
50
50
|
client.job_details(shortcode) # => Hash
|
51
51
|
client.job_questions(shortcode) # => Array of hashes
|
52
|
-
client.job_candidates(shortcode, stage_slug) # => Array of hashes
|
52
|
+
client.job_candidates(shortcode, :stage => stage_slug, :limit => 100) # => Array of hashes:
|
53
|
+
# if given stage limits to given stage
|
54
|
+
# if given limit lists the last `limit` added candidates
|
53
55
|
|
54
56
|
# Adding candidates - candidate is a Hash as described in:
|
55
57
|
# http://resources.workable.com/add-candidates-using-api
|
data/lib/workable/client.rb
CHANGED
@@ -48,11 +48,13 @@ module Workable
|
|
48
48
|
end
|
49
49
|
|
50
50
|
# list candidates for given job
|
51
|
-
# @param
|
52
|
-
# @param
|
53
|
-
|
54
|
-
|
55
|
-
|
51
|
+
# @param shortcode [String] job shortcode to select candidates from
|
52
|
+
# @param options [Hash] extra options like `stage_slug` or `limit`
|
53
|
+
# @option options :stage [String] optional stage slug, if not given candidates are listed for all stages
|
54
|
+
# @option options :limit [Number|String] optional limit of candidates to download, if not given all candidates are listed
|
55
|
+
def job_candidates(shortcode, options = {})
|
56
|
+
url = build_job_candidates_url(shortcode, options)
|
57
|
+
transform_to(:candidate, get_request(url)['candidates'])
|
56
58
|
end
|
57
59
|
|
58
60
|
# list of questions for job
|
@@ -160,6 +162,23 @@ module Workable
|
|
160
162
|
}
|
161
163
|
end
|
162
164
|
|
165
|
+
# build url for fetching job candidates
|
166
|
+
# @param shortcode [String] job shortcode to select candidates from
|
167
|
+
# @param options [Hash] extra options like `stage_slug` or `limit`
|
168
|
+
# @option options :stage_slug [String] optional stage slug, if not given candidates are listed for all stages
|
169
|
+
# @option options :limit [Number|String] optional limit of candidates to download, if not given all candidates are listed
|
170
|
+
def build_job_candidates_url(shortcode, options)
|
171
|
+
if (stage_slug = options.delete(:stage))
|
172
|
+
then stage_slug = "/#{stage_slug}"
|
173
|
+
end
|
174
|
+
params =
|
175
|
+
if options.empty?
|
176
|
+
then ""
|
177
|
+
else "?#{options.map{|k,v| "#{k}=#{v}"}.join("&")}"
|
178
|
+
end
|
179
|
+
"jobs/#{shortcode}#{stage_slug}/candidates#{params}"
|
180
|
+
end
|
181
|
+
|
163
182
|
# transform result using given method if defined
|
164
183
|
# @param type [Symbol] type of the transformation, one of `[:job, :candidate, :question, :stage]`
|
165
184
|
# @param result [Hash|Array|nil] the value to transform, can be nothing, `Hash` of values or `Array` of `Hash`es
|
data/lib/workable/version.rb
CHANGED
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Workable::Client do
|
4
4
|
|
5
|
-
describe '
|
5
|
+
describe '#new' do
|
6
6
|
it 'raises an error on missing api_key / subdomain' do
|
7
7
|
expect { described_class.new }.to raise_error(Workable::Errors::InvalidConfiguration)
|
8
8
|
expect { described_class.new(api_key: 'key') }.to raise_error(Workable::Errors::InvalidConfiguration)
|
@@ -70,7 +70,31 @@ describe Workable::Client do
|
|
70
70
|
|
71
71
|
end
|
72
72
|
|
73
|
-
describe
|
73
|
+
describe "#build_job_candidates_url" do
|
74
|
+
subject{ described_class.new(api_key: 'test', subdomain: 'subdomain') }
|
75
|
+
|
76
|
+
it "builds url without options" do
|
77
|
+
expect(subject.send(:build_job_candidates_url, "test", {})).to eq("jobs/test/candidates")
|
78
|
+
end
|
79
|
+
|
80
|
+
it "builds url with multiple unknown options" do
|
81
|
+
expect(subject.send(:build_job_candidates_url, "test", {:a => 1, :b =>1})).to eq("jobs/test/candidates?a=1&b=1")
|
82
|
+
end
|
83
|
+
|
84
|
+
it "builds url with limit" do
|
85
|
+
expect(subject.send(:build_job_candidates_url, "test", {:limit => 100})).to eq("jobs/test/candidates?limit=100")
|
86
|
+
end
|
87
|
+
|
88
|
+
it "builds url with stage slug" do
|
89
|
+
expect(subject.send(:build_job_candidates_url, "test", {:stage => "sourced"})).to eq("jobs/test/sourced/candidates")
|
90
|
+
end
|
91
|
+
|
92
|
+
it "builds url with stage slug and limit" do
|
93
|
+
expect(subject.send(:build_job_candidates_url, "test", {:limit => 100, :stage => "sourced"})).to eq("jobs/test/sourced/candidates?limit=100")
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
describe '#job_candidates' do
|
74
98
|
let(:client){ described_class.new(api_key: 'test', subdomain: 'subdomain') }
|
75
99
|
|
76
100
|
it 'returns array of candidates for given job' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: workable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.rc3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rafał Wojsznis
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-04-
|
12
|
+
date: 2015-04-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|