greenhouse_io 2.3.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES.md +6 -0
- data/README.md +26 -2
- data/lib/greenhouse_io.rb +1 -1
- data/lib/greenhouse_io/api/client.rb +30 -1
- data/lib/greenhouse_io/version.rb +1 -1
- data/spec/fixtures/cassettes/client/create_candidate_note.yml +42 -0
- data/spec/fixtures/cassettes/client/create_candidate_note_invalid_candidate_id.yml +42 -0
- data/spec/fixtures/cassettes/client/create_candidate_note_invalid_missing_field.yml +42 -0
- data/spec/fixtures/cassettes/client/create_candidate_note_invalid_on_behalf_of.yml +42 -0
- data/spec/fixtures/cassettes/client/create_candidate_note_invalid_user_id.yml +42 -0
- data/spec/greenhouse_io/api/client_spec.rb +81 -0
- metadata +12 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9dd09e95805fe4b610dce4448a7caeaf045090aa
|
4
|
+
data.tar.gz: 141396f8491cfbf28f193c69dcec7af6d8f319b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7289af592c6275e6577a1a9236088e875100099a8301a69c5f9c6d1f9e2bdf15f627cdcd754e5af0b6a6ced6d63fff9cd36b1c698493aa12b5d0c00ed087cb2
|
7
|
+
data.tar.gz: 076bcb038e271ff443ed58cef5769f4e9be601e6d1de620c6942201799b0d29b88c0814d3804bf887e0d2ec8e3722311c469e4096c2144f96f264c5c8ae65875
|
data/CHANGES.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
This project follows [semantic versioning](http://semver.org/). This changelog follows suggestions from [keepachangelog.com](http://keepachangelog.com/).
|
4
4
|
|
5
|
+
## Version 2.3.1
|
6
|
+
Released 2016-04-20.
|
7
|
+
|
8
|
+
#### Added
|
9
|
+
- Added method `create_candidate_note`. Thanks for contributing, [@jleven](https://github.com/jleven)!
|
10
|
+
|
5
11
|
## Version 2.3.0
|
6
12
|
Released 2016-02-13.
|
7
13
|
|
data/README.md
CHANGED
@@ -116,6 +116,27 @@ If you've configured the gem with a default `api_token`, then you can just insta
|
|
116
116
|
gh_client = GreenhouseIo::Client.new
|
117
117
|
```
|
118
118
|
|
119
|
+
#### Listing candidates
|
120
|
+
|
121
|
+
```
|
122
|
+
gh_client.candidates
|
123
|
+
```
|
124
|
+
|
125
|
+
#### Creating a candidate note
|
126
|
+
Use this method to attach a new note to a candidate.
|
127
|
+
|
128
|
+
```
|
129
|
+
candidate_id = 4567
|
130
|
+
author_id = 123 # ID of the user who wrote this note
|
131
|
+
note = {
|
132
|
+
:user_id => 123,
|
133
|
+
:message => "This candidate has very strong opinions about Node.JS.",
|
134
|
+
:visibility => "public"
|
135
|
+
}
|
136
|
+
|
137
|
+
gh_client.create_candidate_note(candidate_id, note, author_id)
|
138
|
+
```
|
139
|
+
|
119
140
|
#### Throttling
|
120
141
|
|
121
142
|
Rate limit and rate limit remaining are available after making an API request with an API client:
|
@@ -135,7 +156,7 @@ gh_client.offices(id, page: 1, per_page: 2)
|
|
135
156
|
|
136
157
|
#### Available methods
|
137
158
|
|
138
|
-
Methods
|
159
|
+
Methods for which an `id` is optional:
|
139
160
|
|
140
161
|
* `offices`
|
141
162
|
* `departments`
|
@@ -147,13 +168,14 @@ Methods in which an `id` is optional:
|
|
147
168
|
* `all_scorecards`
|
148
169
|
* `offers`
|
149
170
|
|
150
|
-
Methods
|
171
|
+
Methods for which an `id` is **required**:
|
151
172
|
|
152
173
|
* `activity_feed` *(requires a candidate ID)*
|
153
174
|
* `scorecards` *(requires an application ID)*
|
154
175
|
* `scheduled_interviews` *(requires an application ID)*
|
155
176
|
* `stages` *(requires a job ID)*
|
156
177
|
* `job_post` *(requires a job ID)*
|
178
|
+
* `create_candidate_note` *(requires a candidate ID)*
|
157
179
|
|
158
180
|
## Contributing
|
159
181
|
|
@@ -162,3 +184,5 @@ Methods in which an `id` is **required**:
|
|
162
184
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
163
185
|
4. Push to the branch (`git push origin my-new-feature`)
|
164
186
|
5. Create new Pull Request
|
187
|
+
|
188
|
+
Contributions are always welcome!
|
data/lib/greenhouse_io.rb
CHANGED
@@ -32,6 +32,14 @@ module GreenhouseIo
|
|
32
32
|
get_from_harvest_api "/candidates/#{id}/activity_feed", options
|
33
33
|
end
|
34
34
|
|
35
|
+
def create_candidate_note(candidate_id, note_hash, on_behalf_of)
|
36
|
+
post_to_harvest_api(
|
37
|
+
"/candidates/#{candidate_id}/activity_feed/notes",
|
38
|
+
note_hash,
|
39
|
+
{ 'On-Behalf-Of' => on_behalf_of.to_s }
|
40
|
+
)
|
41
|
+
end
|
42
|
+
|
35
43
|
def applications(id = nil, options = {})
|
36
44
|
get_from_harvest_api "/applications#{path_id(id)}", options
|
37
45
|
end
|
@@ -79,8 +87,29 @@ module GreenhouseIo
|
|
79
87
|
end
|
80
88
|
|
81
89
|
def get_from_harvest_api(url, options = {})
|
82
|
-
response = get_response(url,
|
90
|
+
response = get_response(url, {
|
91
|
+
:query => permitted_options(options),
|
92
|
+
:basic_auth => basic_auth
|
93
|
+
})
|
94
|
+
|
95
|
+
set_rate_limits(response.headers)
|
96
|
+
|
97
|
+
if response.code == 200
|
98
|
+
parse_json(response)
|
99
|
+
else
|
100
|
+
raise GreenhouseIo::Error.new(response.code)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def post_to_harvest_api(url, body, headers)
|
105
|
+
response = post_response(url, {
|
106
|
+
:body => JSON.dump(body),
|
107
|
+
:basic_auth => basic_auth,
|
108
|
+
:headers => headers
|
109
|
+
})
|
110
|
+
|
83
111
|
set_rate_limits(response.headers)
|
112
|
+
|
84
113
|
if response.code == 200
|
85
114
|
parse_json(response)
|
86
115
|
else
|
@@ -0,0 +1,42 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://123FakeToken:@harvest.greenhouse.io/v1/candidates/1/activity_feed/notes
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"user_id":2,"message":"Candidate on vacation","visibility":"public"}'
|
9
|
+
headers:
|
10
|
+
On-Behalf-Of:
|
11
|
+
- '2'
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: OK
|
16
|
+
headers:
|
17
|
+
Server:
|
18
|
+
- Cowboy
|
19
|
+
Connection:
|
20
|
+
- close
|
21
|
+
Date:
|
22
|
+
- Mon, 18 Apr 2016 19:41:43 GMT
|
23
|
+
Status:
|
24
|
+
- 200 OK
|
25
|
+
Content-Type:
|
26
|
+
- application/json;charset=utf-8
|
27
|
+
Content-Length:
|
28
|
+
- '154'
|
29
|
+
X-Ratelimit-Limit:
|
30
|
+
- '40'
|
31
|
+
X-Ratelimit-Remaining:
|
32
|
+
- '39'
|
33
|
+
X-Content-Type-Options:
|
34
|
+
- nosniff
|
35
|
+
Via:
|
36
|
+
- 1.1 vegur
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: '{"created_at":"2016-04-18T19:43:52.534Z","body":"Candidate on vacation","user":{"id":2,"name":"Richard Feynman"},"private":false,"visiblity":"public"}'
|
40
|
+
http_version:
|
41
|
+
recorded_at: Mon, 18 Apr 2016 19:41:44 GMT
|
42
|
+
recorded_with: VCR 3.0.1
|
@@ -0,0 +1,42 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://123FakeToken:@harvest.greenhouse.io/v1/candidates/99/activity_feed/notes
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"user_id":2,"message":"Candidate on vacation","visibility":"public"}'
|
9
|
+
headers:
|
10
|
+
On-Behalf-Of:
|
11
|
+
- '2'
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 404
|
15
|
+
message: Resource not found
|
16
|
+
headers:
|
17
|
+
Server:
|
18
|
+
- Cowboy
|
19
|
+
Connection:
|
20
|
+
- close
|
21
|
+
Date:
|
22
|
+
- Mon, 18 Apr 2016 19:41:43 GMT
|
23
|
+
Status:
|
24
|
+
- 200 OK
|
25
|
+
Content-Type:
|
26
|
+
- application/json;charset=utf-8
|
27
|
+
Content-Length:
|
28
|
+
- '32'
|
29
|
+
X-Ratelimit-Limit:
|
30
|
+
- '40'
|
31
|
+
X-Ratelimit-Remaining:
|
32
|
+
- '39'
|
33
|
+
X-Content-Type-Options:
|
34
|
+
- nosniff
|
35
|
+
Via:
|
36
|
+
- 1.1 vegur
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: '{"message":"Resource not found"}'
|
40
|
+
http_version:
|
41
|
+
recorded_at: Mon, 18 Apr 2016 19:41:44 GMT
|
42
|
+
recorded_with: VCR 3.0.1
|
@@ -0,0 +1,42 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://123FakeToken:@harvest.greenhouse.io/v1/candidates/1/activity_feed/notes
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"user_id":2,"visibility":"public"}'
|
9
|
+
headers:
|
10
|
+
On-Behalf-Of:
|
11
|
+
- '2'
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 422
|
15
|
+
message: Unprocessable Entity
|
16
|
+
headers:
|
17
|
+
Server:
|
18
|
+
- Cowboy
|
19
|
+
Connection:
|
20
|
+
- close
|
21
|
+
Date:
|
22
|
+
- Mon, 18 Apr 2016 19:41:43 GMT
|
23
|
+
Status:
|
24
|
+
- 200 OK
|
25
|
+
Content-Type:
|
26
|
+
- application/json;charset=utf-8
|
27
|
+
Content-Length:
|
28
|
+
- '70'
|
29
|
+
X-Ratelimit-Limit:
|
30
|
+
- '40'
|
31
|
+
X-Ratelimit-Remaining:
|
32
|
+
- '39'
|
33
|
+
X-Content-Type-Options:
|
34
|
+
- nosniff
|
35
|
+
Via:
|
36
|
+
- 1.1 vegur
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: '{"errors":[{"message":"Missing required field: body","field":"body"}]}'
|
40
|
+
http_version:
|
41
|
+
recorded_at: Mon, 18 Apr 2016 19:41:44 GMT
|
42
|
+
recorded_with: VCR 3.0.1
|
@@ -0,0 +1,42 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://123FakeToken:@harvest.greenhouse.io/v1/candidates/1/activity_feed/notes
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"user_id":2,"message":"Candidate on vacation","visibility":"public"}'
|
9
|
+
headers:
|
10
|
+
On-Behalf-Of:
|
11
|
+
- '99'
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 404
|
15
|
+
message: Resource not found
|
16
|
+
headers:
|
17
|
+
Server:
|
18
|
+
- Cowboy
|
19
|
+
Connection:
|
20
|
+
- close
|
21
|
+
Date:
|
22
|
+
- Mon, 18 Apr 2016 19:41:43 GMT
|
23
|
+
Status:
|
24
|
+
- 200 OK
|
25
|
+
Content-Type:
|
26
|
+
- application/json;charset=utf-8
|
27
|
+
Content-Length:
|
28
|
+
- '32'
|
29
|
+
X-Ratelimit-Limit:
|
30
|
+
- '40'
|
31
|
+
X-Ratelimit-Remaining:
|
32
|
+
- '39'
|
33
|
+
X-Content-Type-Options:
|
34
|
+
- nosniff
|
35
|
+
Via:
|
36
|
+
- 1.1 vegur
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: '{"message":"Resource not found"}'
|
40
|
+
http_version:
|
41
|
+
recorded_at: Mon, 18 Apr 2016 19:41:44 GMT
|
42
|
+
recorded_with: VCR 3.0.1
|
@@ -0,0 +1,42 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://123FakeToken:@harvest.greenhouse.io/v1/candidates/1/activity_feed/notes
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"user_id":99,"message":"Candidate on vacation","visibility":"public"}'
|
9
|
+
headers:
|
10
|
+
On-Behalf-Of:
|
11
|
+
- '2'
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 404
|
15
|
+
message: Resource not found
|
16
|
+
headers:
|
17
|
+
Server:
|
18
|
+
- Cowboy
|
19
|
+
Connection:
|
20
|
+
- close
|
21
|
+
Date:
|
22
|
+
- Mon, 18 Apr 2016 19:41:43 GMT
|
23
|
+
Status:
|
24
|
+
- 200 OK
|
25
|
+
Content-Type:
|
26
|
+
- application/json;charset=utf-8
|
27
|
+
Content-Length:
|
28
|
+
- '32'
|
29
|
+
X-Ratelimit-Limit:
|
30
|
+
- '40'
|
31
|
+
X-Ratelimit-Remaining:
|
32
|
+
- '39'
|
33
|
+
X-Content-Type-Options:
|
34
|
+
- nosniff
|
35
|
+
Via:
|
36
|
+
- 1.1 vegur
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: '{"message":"Resource not found"}'
|
40
|
+
http_version:
|
41
|
+
recorded_at: Mon, 18 Apr 2016 19:41:44 GMT
|
42
|
+
recorded_with: VCR 3.0.1
|
@@ -225,6 +225,87 @@ describe GreenhouseIo::Client do
|
|
225
225
|
end
|
226
226
|
end
|
227
227
|
|
228
|
+
describe "#create_candidate_note" do
|
229
|
+
it "posts an note for a specified candidate" do
|
230
|
+
VCR.use_cassette('client/create_candidate_note') do
|
231
|
+
create_candidate_note = @client.create_candidate_note(
|
232
|
+
1,
|
233
|
+
{
|
234
|
+
user_id: 2,
|
235
|
+
message: "Candidate on vacation",
|
236
|
+
visibility: "public"
|
237
|
+
},
|
238
|
+
2
|
239
|
+
)
|
240
|
+
expect(create_candidate_note).to_not be_nil
|
241
|
+
expect(create_candidate_note).to include :body => 'Candidate on vacation'
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
it "errors when given invalid On-Behalf-Of id" do
|
246
|
+
VCR.use_cassette('client/create_candidate_note_invalid_on_behalf_of') do
|
247
|
+
expect {
|
248
|
+
@client.create_candidate_note(
|
249
|
+
1,
|
250
|
+
{
|
251
|
+
user_id: 2,
|
252
|
+
message: "Candidate on vacation",
|
253
|
+
visibility: "public"
|
254
|
+
},
|
255
|
+
99
|
256
|
+
)
|
257
|
+
}.to raise_error(GreenhouseIo::Error)
|
258
|
+
end
|
259
|
+
end
|
260
|
+
|
261
|
+
it "errors when given an invalid candidate id" do
|
262
|
+
VCR.use_cassette('client/create_candidate_note_invalid_candidate_id') do
|
263
|
+
expect {
|
264
|
+
@client.create_candidate_note(
|
265
|
+
99,
|
266
|
+
{
|
267
|
+
user_id: 2,
|
268
|
+
message: "Candidate on vacation",
|
269
|
+
visibility: "public"
|
270
|
+
},
|
271
|
+
2
|
272
|
+
)
|
273
|
+
}.to raise_error(GreenhouseIo::Error)
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
it "errors when given an invalid user_id" do
|
278
|
+
VCR.use_cassette('client/create_candidate_note_invalid_user_id') do
|
279
|
+
expect {
|
280
|
+
@client.create_candidate_note(
|
281
|
+
1,
|
282
|
+
{
|
283
|
+
user_id: 99,
|
284
|
+
message: "Candidate on vacation",
|
285
|
+
visibility: "public"
|
286
|
+
},
|
287
|
+
2
|
288
|
+
)
|
289
|
+
}.to raise_error(GreenhouseIo::Error)
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
it "errors when missing required field" do
|
294
|
+
VCR.use_cassette('client/create_candidate_note_invalid_missing_field') do
|
295
|
+
expect {
|
296
|
+
@client.create_candidate_note(
|
297
|
+
1,
|
298
|
+
{
|
299
|
+
user_id: 2,
|
300
|
+
visibility: "public"
|
301
|
+
},
|
302
|
+
2
|
303
|
+
)
|
304
|
+
}.to raise_error(GreenhouseIo::Error)
|
305
|
+
end
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
228
309
|
describe "#applications" do
|
229
310
|
context "given no id" do
|
230
311
|
before do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: greenhouse_io
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greenhouse Software
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-04-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httmultiparty
|
@@ -140,6 +140,11 @@ files:
|
|
140
140
|
- spec/fixtures/cassettes/client/applications.yml
|
141
141
|
- spec/fixtures/cassettes/client/candidate.yml
|
142
142
|
- spec/fixtures/cassettes/client/candidates.yml
|
143
|
+
- spec/fixtures/cassettes/client/create_candidate_note.yml
|
144
|
+
- spec/fixtures/cassettes/client/create_candidate_note_invalid_candidate_id.yml
|
145
|
+
- spec/fixtures/cassettes/client/create_candidate_note_invalid_missing_field.yml
|
146
|
+
- spec/fixtures/cassettes/client/create_candidate_note_invalid_on_behalf_of.yml
|
147
|
+
- spec/fixtures/cassettes/client/create_candidate_note_invalid_user_id.yml
|
143
148
|
- spec/fixtures/cassettes/client/department.yml
|
144
149
|
- spec/fixtures/cassettes/client/departments.yml
|
145
150
|
- spec/fixtures/cassettes/client/job.yml
|
@@ -206,6 +211,11 @@ test_files:
|
|
206
211
|
- spec/fixtures/cassettes/client/applications.yml
|
207
212
|
- spec/fixtures/cassettes/client/candidate.yml
|
208
213
|
- spec/fixtures/cassettes/client/candidates.yml
|
214
|
+
- spec/fixtures/cassettes/client/create_candidate_note.yml
|
215
|
+
- spec/fixtures/cassettes/client/create_candidate_note_invalid_candidate_id.yml
|
216
|
+
- spec/fixtures/cassettes/client/create_candidate_note_invalid_missing_field.yml
|
217
|
+
- spec/fixtures/cassettes/client/create_candidate_note_invalid_on_behalf_of.yml
|
218
|
+
- spec/fixtures/cassettes/client/create_candidate_note_invalid_user_id.yml
|
209
219
|
- spec/fixtures/cassettes/client/department.yml
|
210
220
|
- spec/fixtures/cassettes/client/departments.yml
|
211
221
|
- spec/fixtures/cassettes/client/job.yml
|