greenhouse_io 1.0.2 → 2.0.0

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.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/README.md +86 -27
  4. data/lib/greenhouse_io.rb +3 -0
  5. data/lib/greenhouse_io/api.rb +8 -61
  6. data/lib/greenhouse_io/api/client.rb +88 -0
  7. data/lib/greenhouse_io/api/job_board.rb +66 -0
  8. data/lib/greenhouse_io/configuration.rb +21 -0
  9. data/lib/greenhouse_io/error.rb +3 -15
  10. data/lib/greenhouse_io/version.rb +1 -1
  11. data/spec/fixtures/cassettes/client/activity_feed.yml +36 -0
  12. data/spec/fixtures/cassettes/client/application.yml +36 -0
  13. data/spec/fixtures/cassettes/client/applications.yml +43 -0
  14. data/spec/fixtures/cassettes/client/candidate.yml +36 -0
  15. data/spec/fixtures/cassettes/client/candidates.yml +38 -0
  16. data/spec/fixtures/cassettes/client/department.yml +36 -0
  17. data/spec/fixtures/cassettes/client/departments.yml +38 -0
  18. data/spec/fixtures/cassettes/client/job.yml +37 -0
  19. data/spec/fixtures/cassettes/client/job_post.yml +49 -0
  20. data/spec/fixtures/cassettes/client/jobs.yml +39 -0
  21. data/spec/fixtures/cassettes/client/office.yml +36 -0
  22. data/spec/fixtures/cassettes/client/offices.yml +46 -0
  23. data/spec/fixtures/cassettes/client/scheduled_interviews.yml +38 -0
  24. data/spec/fixtures/cassettes/client/scorecards.yml +37 -0
  25. data/spec/fixtures/cassettes/client/source.yml +39 -0
  26. data/spec/fixtures/cassettes/client/sources.yml +37 -0
  27. data/spec/fixtures/cassettes/client/stages.yml +36 -0
  28. data/spec/fixtures/cassettes/client/user.yml +36 -0
  29. data/spec/fixtures/cassettes/client/users.yml +38 -0
  30. data/spec/fixtures/cassettes/invalid_id.yml +1 -1
  31. data/spec/fixtures/cassettes/job.yml +1 -1
  32. data/spec/greenhouse_io/api/client_spec.rb +474 -0
  33. data/spec/{greenhouse/api_spec.rb → greenhouse_io/api/job_board_spec.rb} +10 -9
  34. data/spec/greenhouse_io/configuration_spec.rb +71 -0
  35. data/spec/{greenhouse → greenhouse_io}/error_spec.rb +0 -2
  36. data/spec/spec_helper.rb +5 -0
  37. metadata +51 -6
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://123FakeToken:@harvest.greenhouse.io/v1/offices
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Content-Type:
16
+ - application/json;charset=utf-8
17
+ Date:
18
+ - Mon, 21 Apr 2014 23:39:41 GMT
19
+ Status:
20
+ - 200 OK
21
+ X-Content-Type-Options:
22
+ - nosniff
23
+ X-Ratelimit-Limit:
24
+ - '20'
25
+ X-Ratelimit-Remaining:
26
+ - '20'
27
+ Content-Length:
28
+ - '775'
29
+ Connection:
30
+ - keep-alive
31
+ body:
32
+ encoding: UTF-8
33
+ string: "[{\"id\":215,\"name\":\"Hong Kong\",\"location\":{\"name\":\"Hong Kong\"}},{\"id\":216,\"name\":\"London\",\"location\":{\"name\":\"London,
34
+ United Kingdom\"}},{\"id\":217,\"name\":\"San Francisco\",\"location\":{\"name\":\"San
35
+ Francisco, CA\"}},{\"id\":219,\"name\":\"Sydney\",\"location\":{\"name\":\"Sydney,
36
+ New South Wales, Australia\"}},{\"id\":220,\"name\":\"Boston\",\"location\":{\"name\":\"Boston,
37
+ MA\"}},{\"id\":221,\"name\":\"Washington DC\",\"location\":{\"name\":\"Washington,
38
+ DC\"}},{\"id\":214,\"name\":\"New York\",\"location\":{\"name\":\"New York,
39
+ NY\"}},{\"id\":218,\"name\":\"Los Angeles\",\"location\":{\"name\":\"Santa
40
+ Monica, CA\"}},{\"id\":856,\"name\":\"Seattle\",\"location\":{\"name\":\"Seattle,
41
+ WA\"}},{\"id\":857,\"name\":\"Chicago\",\"location\":{\"name\":\"Chicago,
42
+ IL, United States\"}},{\"id\":858,\"name\":\"Atlanta\",\"location\":{\"name\":\"Atlanta,
43
+ GA, United States\"}}]"
44
+ http_version:
45
+ recorded_at: Mon, 21 Apr 2014 23:39:41 GMT
46
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://123FakeToken:@harvest.greenhouse.io/v1/applications/1/scheduled_interviews
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Content-Type:
16
+ - application/json;charset=utf-8
17
+ Date:
18
+ - Sun, 11 May 2014 23:21:19 GMT
19
+ Status:
20
+ - 200 OK
21
+ X-Content-Type-Options:
22
+ - nosniff
23
+ X-Ratelimit-Limit:
24
+ - '20'
25
+ X-Ratelimit-Remaining:
26
+ - '20'
27
+ Content-Length:
28
+ - '562'
29
+ Connection:
30
+ - keep-alive
31
+ body:
32
+ encoding: UTF-8
33
+ string: "[{\"id\":435294,\"starts_at\":\"2014-01-10T21:00:00Z\",\"ends_at\":\"2014-01-10T21:15:00Z\",\"location\":null,\"status\":\"complete\",\"interview\":{\"id\":85265,\"name\":\"Task
34
+ Follow Up\"},\"organizer\":{\"id\":3850,\"name\":\"Test User\"},\"interviewers\":[{\"id\":3850,\"name\":\"Test User\",\"email\":null}]},{\"id\":435293,\"starts_at\":\"2014-01-11T13:00:00Z\",\"ends_at\":\"2014-01-11T13:45:00Z\",\"location\":\"Phone\",\"status\":\"complete\",\"interview\":{\"id\":39539,\"name\":\"Preliminary
35
+ Screening Call\"},\"organizer\":{\"id\":3850,\"name\":\"Test User\"},\"interviewers\":[{\"id\":3850,\"name\":\"Test User\",\"email\":null}]}]"
36
+ http_version:
37
+ recorded_at: Sun, 11 May 2014 23:21:20 GMT
38
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,37 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://123FakeToken:@harvest.greenhouse.io/v1/applications/1/scorecards
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Content-Type:
16
+ - application/json;charset=utf-8
17
+ Date:
18
+ - Sun, 11 May 2014 06:50:36 GMT
19
+ Status:
20
+ - 200 OK
21
+ X-Content-Type-Options:
22
+ - nosniff
23
+ X-Ratelimit-Limit:
24
+ - '20'
25
+ X-Ratelimit-Remaining:
26
+ - '20'
27
+ Content-Length:
28
+ - '2808'
29
+ Connection:
30
+ - keep-alive
31
+ body:
32
+ encoding: UTF-8
33
+ string: "[{\"interview\":\"Task Follow Up\",\"interviewed_at\":\"2014-01-13T00:00:00Z\",\"submitted_by\":{\"id\":3850,\"name\":\"Test User\"},\"submitted_at\":\"2014-01-13T22:06:55Z\",\"overall_recommendation\":\"no_decision\",\"ratings\":{\"definitely_not\":[],\"no\":[],\"mixed\":[],\"yes\":[],\"strong_yes\":[]},\"questions\":[{\"id\":null,\"question\":\"Key
34
+ Take-Aways\",\"answer\":\"\"},{\"id\":null,\"question\":\"Private Notes\",\"answer\":\"\"}]}]"
35
+ http_version:
36
+ recorded_at: Sun, 11 May 2014 06:50:37 GMT
37
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,39 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://123FakeToken:@harvest.greenhouse.io/v1/sources/1
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Content-Type:
16
+ - application/json;charset=utf-8
17
+ Date:
18
+ - Sun, 11 May 2014 23:46:48 GMT
19
+ Status:
20
+ - 200 OK
21
+ X-Cascade:
22
+ - pass
23
+ X-Content-Type-Options:
24
+ - nosniff
25
+ X-Ratelimit-Limit:
26
+ - '20'
27
+ X-Ratelimit-Remaining:
28
+ - '20'
29
+ Content-Length:
30
+ - '32'
31
+ Connection:
32
+ - keep-alive
33
+ body:
34
+ encoding: UTF-8
35
+ string: "{\"id\":1,\"name\":\"Customer newsletter\",\"type\":{\"id\":1,\"name\":\"Company
36
+ marketing\"}}"
37
+ http_version:
38
+ recorded_at: Sun, 11 May 2014 23:46:49 GMT
39
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,37 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://123FakeToken:@harvest.greenhouse.io/v1/sources
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Content-Type:
16
+ - application/json;charset=utf-8
17
+ Date:
18
+ - Sun, 11 May 2014 23:39:54 GMT
19
+ Status:
20
+ - 200 OK
21
+ X-Content-Type-Options:
22
+ - nosniff
23
+ X-Ratelimit-Limit:
24
+ - '20'
25
+ X-Ratelimit-Remaining:
26
+ - '20'
27
+ Content-Length:
28
+ - '3028'
29
+ Connection:
30
+ - keep-alive
31
+ body:
32
+ encoding: UTF-8
33
+ string: "[{\"id\":1,\"name\":\"Customer newsletter\",\"type\":{\"id\":1,\"name\":\"Company
34
+ marketing\"}}]"
35
+ http_version:
36
+ recorded_at: Sun, 11 May 2014 23:39:55 GMT
37
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,36 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://123FakeToken:@harvest.greenhouse.io/v1/jobs/4690/stages
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Content-Type:
16
+ - application/json;charset=utf-8
17
+ Date:
18
+ - Sun, 11 May 2014 23:32:17 GMT
19
+ Status:
20
+ - 200 OK
21
+ X-Content-Type-Options:
22
+ - nosniff
23
+ X-Ratelimit-Limit:
24
+ - '20'
25
+ X-Ratelimit-Remaining:
26
+ - '20'
27
+ Content-Length:
28
+ - '892'
29
+ Connection:
30
+ - keep-alive
31
+ body:
32
+ encoding: UTF-8
33
+ string: "[{\"id\":31416,\"name\":\"Offer\",\"interviews\":[]}]"
34
+ http_version:
35
+ recorded_at: Sun, 11 May 2014 23:32:18 GMT
36
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,36 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://123FakeToken:@harvest.greenhouse.io/v1/users/10327
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Content-Type:
16
+ - application/json;charset=utf-8
17
+ Date:
18
+ - Sun, 11 May 2014 23:37:54 GMT
19
+ Status:
20
+ - 200 OK
21
+ X-Content-Type-Options:
22
+ - nosniff
23
+ X-Ratelimit-Limit:
24
+ - '20'
25
+ X-Ratelimit-Remaining:
26
+ - '20'
27
+ Content-Length:
28
+ - '35'
29
+ Connection:
30
+ - keep-alive
31
+ body:
32
+ encoding: UTF-8
33
+ string: "{\"id\":10327,\"name\":\"Test User 1\"}"
34
+ http_version:
35
+ recorded_at: Sun, 11 May 2014 23:37:55 GMT
36
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://123FakeToken:@harvest.greenhouse.io/v1/users
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Content-Type:
16
+ - application/json;charset=utf-8
17
+ Date:
18
+ - Sun, 11 May 2014 23:36:20 GMT
19
+ Link:
20
+ - "<https://harvest.greenhouse.io/v1/users?page=2&per_page=100>; rel=\"next\""
21
+ Status:
22
+ - 200 OK
23
+ X-Content-Type-Options:
24
+ - nosniff
25
+ X-Ratelimit-Limit:
26
+ - '20'
27
+ X-Ratelimit-Remaining:
28
+ - '20'
29
+ Content-Length:
30
+ - '10824'
31
+ Connection:
32
+ - keep-alive
33
+ body:
34
+ encoding: UTF-8
35
+ string: "[{\"id\":10327,\"name\":\"Test User 1\",\"disabled\":false,\"site_admin\":false,\"emails\":[\"test_user@email.com\"]}]"
36
+ http_version:
37
+ recorded_at: Sun, 11 May 2014 23:36:21 GMT
38
+ recorded_with: VCR 2.5.0
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://api.greenhouse.io/v1/boards/generalassembly/embed/job?id=123&questions=false
5
+ uri: https://api.greenhouse.io/v1/boards/generalassembly/embed/job?id=123&questions=
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://api.greenhouse.io/v1/boards/generalassembly/embed/job?id=721&questions=false
5
+ uri: https://api.greenhouse.io/v1/boards/generalassembly/embed/job?id=721&questions=
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -0,0 +1,474 @@
1
+ require 'spec_helper'
2
+
3
+ describe GreenhouseIo::Client do
4
+
5
+ it "should have a base url for an API endpoint" do
6
+ expect(GreenhouseIo::Client.base_uri).to eq("https://harvest.greenhouse.io/v1")
7
+ end
8
+
9
+ context "given an instance of GreenhouseIo::Client" do
10
+
11
+ before do
12
+ GreenhouseIo.configuration.symbolize_keys = true
13
+ @client = GreenhouseIo::Client.new('123FakeToken')
14
+ end
15
+
16
+ describe "#initialize" do
17
+ it "has an api_token" do
18
+ expect(@client.api_token).to eq('123FakeToken')
19
+ end
20
+
21
+ it "uses the configuration value when token is not specified" do
22
+ GreenhouseIo.configuration.api_token = '123FakeENV'
23
+ default_client = GreenhouseIo::Client.new
24
+ expect(default_client.api_token).to eq('123FakeENV')
25
+ end
26
+ end
27
+
28
+ describe "#path_id" do
29
+ context "given an id" do
30
+ it "returns an id path" do
31
+ output = @client.send(:path_id, 1)
32
+ expect(output).to eq('/1')
33
+ end
34
+ end
35
+
36
+ context "given no id" do
37
+ it "returns nothing" do
38
+ output = @client.send(:path_id)
39
+ expect(output).to be_nil
40
+ end
41
+ end
42
+ end
43
+
44
+ describe "#set_rate_limits" do
45
+ before do
46
+ @headers = {
47
+ 'x-ratelimit-limit' => '20',
48
+ 'x-ratelimit-remaining' => '20'
49
+ }
50
+ end
51
+
52
+ it "sets the rate limit" do
53
+ @client.send(:set_rate_limits, @headers)
54
+ expect(@client.rate_limit).to eq(20)
55
+ end
56
+
57
+ it "sets the remaining rate limit" do
58
+ @client.send(:set_rate_limits, @headers)
59
+ expect(@client.rate_limit_remaining).to eq(20)
60
+ end
61
+ end
62
+
63
+ describe "#permitted_options" do
64
+ let(:options) { GreenhouseIo::Client::PERMITTED_OPTIONS + [:where] }
65
+
66
+ it "allows permitted options" do
67
+ output = @client.send(:permitted_options, options)
68
+ GreenhouseIo::Client::PERMITTED_OPTIONS.each do |option|
69
+ expect(output).to include(option)
70
+ end
71
+ end
72
+
73
+ it "discards non-permitted options" do
74
+ output = @client.send(:permitted_options, options)
75
+ expect(output).to_not include(:where)
76
+ end
77
+ end
78
+
79
+ describe "#offices" do
80
+ context "given no id" do
81
+ before do
82
+ VCR.use_cassette('client/offices') do
83
+ @offices_response = @client.offices
84
+ end
85
+ end
86
+
87
+ it "returns a response" do
88
+ expect(@offices_response).to_not be_nil
89
+ end
90
+
91
+ it "returns an array of offices" do
92
+ expect(@offices_response).to be_an_instance_of(Array)
93
+ end
94
+
95
+ it "returns office details" do
96
+ expect(@offices_response.first).to have_key(:name)
97
+ end
98
+ end
99
+
100
+ context "given an id" do
101
+ before do
102
+ VCR.use_cassette('client/office') do
103
+ @office_response = @client.offices(220)
104
+ end
105
+ end
106
+
107
+ it "returns a response" do
108
+ expect(@office_response).to_not be_nil
109
+ end
110
+
111
+ it "returns an office hash" do
112
+ expect(@office_response).to be_an_instance_of(Hash)
113
+ end
114
+
115
+ it "returns an office's details" do
116
+ expect(@office_response).to have_key(:name)
117
+ end
118
+ end
119
+ end
120
+
121
+ describe "#departments" do
122
+ context "given no id" do
123
+ before do
124
+ VCR.use_cassette('client/departments') do
125
+ @departments_response = @client.departments
126
+ end
127
+ end
128
+
129
+ it "returns a response" do
130
+ expect(@departments_response).to_not be_nil
131
+ end
132
+
133
+ it "returns an array of departments" do
134
+ expect(@departments_response).to be_an_instance_of(Array)
135
+ end
136
+
137
+ it "returns office details" do
138
+ expect(@departments_response.first).to have_key(:name)
139
+ end
140
+ end
141
+
142
+ context "given an id" do
143
+ before do
144
+ VCR.use_cassette('client/department') do
145
+ @department_response = @client.departments(187)
146
+ end
147
+ end
148
+
149
+ it "returns a response" do
150
+ expect(@department_response).to_not be_nil
151
+ end
152
+
153
+ it "returns a department hash" do
154
+ expect(@department_response).to be_an_instance_of(Hash)
155
+ end
156
+
157
+ it "returns a department's details" do
158
+ expect(@department_response).to have_key(:name)
159
+ end
160
+ end
161
+ end
162
+
163
+ describe "#candidates" do
164
+ context "given no id" do
165
+
166
+ before do
167
+ VCR.use_cassette('client/candidates') do
168
+ @candidates_response = @client.candidates
169
+ end
170
+ end
171
+
172
+ it "returns a response" do
173
+ expect(@candidates_response).to_not be_nil
174
+ end
175
+
176
+ it "returns an array of candidates" do
177
+ expect(@candidates_response).to be_an_instance_of(Array)
178
+ end
179
+
180
+ it "returns details of candidates" do
181
+ expect(@candidates_response.first).to have_key(:first_name)
182
+ end
183
+ end
184
+
185
+ context "given an id" do
186
+ before do
187
+ VCR.use_cassette('client/candidate') do
188
+ @candidate_response = @client.candidates(1)
189
+ end
190
+ end
191
+
192
+ it "returns a response" do
193
+ expect(@candidate_response).to_not be_nil
194
+ end
195
+
196
+ it "returns a candidate hash" do
197
+ expect(@candidate_response).to be_an_instance_of(Hash)
198
+ end
199
+
200
+ it "returns a candidate's details" do
201
+ expect(@candidate_response).to have_key(:first_name)
202
+ end
203
+ end
204
+ end
205
+
206
+ describe "#activity_feed" do
207
+ before do
208
+ VCR.use_cassette('client/activity_feed') do
209
+ @activity_feed = @client.activity_feed(1)
210
+ end
211
+ end
212
+
213
+ it "returns a response" do
214
+ expect(@activity_feed).to_not be_nil
215
+ end
216
+
217
+ it "returns an activity feed" do
218
+ expect(@activity_feed).to be_an_instance_of(Hash)
219
+ end
220
+
221
+ it "returns details of the activity feed" do
222
+ expect(@activity_feed).to have_key(:activities)
223
+ end
224
+ end
225
+
226
+ describe "#applications" do
227
+ context "given no id" do
228
+ before do
229
+ VCR.use_cassette('client/applications') do
230
+ @applications = @client.applications
231
+ end
232
+ end
233
+
234
+ it "returns a response" do
235
+ expect(@applications).to_not be_nil
236
+ end
237
+
238
+ it "returns an array of applications" do
239
+ expect(@applications).to be_an_instance_of(Array)
240
+ end
241
+
242
+ it "returns application details" do
243
+ expect(@applications.first).to have_key(:person_id)
244
+ end
245
+ end
246
+
247
+ context "given an id" do
248
+ before do
249
+ VCR.use_cassette('client/application') do
250
+ @application = @client.applications(1)
251
+ end
252
+ end
253
+
254
+ it "returns a response" do
255
+ expect(@application).to_not be_nil
256
+ end
257
+
258
+ it "returns an application hash" do
259
+ expect(@application).to be_an_instance_of(Hash)
260
+ end
261
+
262
+ it "returns an application's details" do
263
+ expect(@application).to have_key(:person_id)
264
+ end
265
+ end
266
+ end
267
+
268
+ describe "#scorecards" do
269
+ before do
270
+ VCR.use_cassette('client/scorecards') do
271
+ @scorecard = @client.scorecards(1)
272
+ end
273
+ end
274
+
275
+ it "returns a response" do
276
+ expect(@scorecard).to_not be_nil
277
+ end
278
+
279
+ it "returns an array of scorecards" do
280
+ expect(@scorecard).to be_an_instance_of(Array)
281
+ end
282
+
283
+ it "returns details of the scorecards" do
284
+ expect(@scorecard.first).to have_key(:interview)
285
+ end
286
+ end
287
+
288
+ describe "#scheduled_interviews" do
289
+ before do
290
+ VCR.use_cassette('client/scheduled_interviews') do
291
+ @scheduled_interviews = @client.scheduled_interviews(1)
292
+ end
293
+ end
294
+
295
+ it "returns a response" do
296
+ expect(@scheduled_interviews).to_not be_nil
297
+ end
298
+
299
+ it "returns an array of scheduled interviews" do
300
+ expect(@scheduled_interviews).to be_an_instance_of(Array)
301
+ end
302
+
303
+ it "returns details of the interview" do
304
+ expect(@scheduled_interviews.first).to have_key(:starts_at)
305
+ end
306
+ end
307
+
308
+ describe "#jobs" do
309
+ context "given no id" do
310
+ before do
311
+ VCR.use_cassette('client/jobs') do
312
+ @jobs = @client.jobs
313
+ end
314
+ end
315
+
316
+ it "returns a response" do
317
+ expect(@jobs).to_not be_nil
318
+ end
319
+
320
+ it "returns an array of applications" do
321
+ expect(@jobs).to be_an_instance_of(Array)
322
+ end
323
+
324
+ it "returns application details" do
325
+ expect(@jobs.first).to have_key(:employment_type)
326
+ end
327
+ end
328
+
329
+ context "given an id" do
330
+ before do
331
+ VCR.use_cassette('client/job') do
332
+ @job = @client.jobs(4690)
333
+ end
334
+ end
335
+
336
+ it "returns a response" do
337
+ expect(@job).to_not be_nil
338
+ end
339
+
340
+ it "returns an application hash" do
341
+ expect(@job).to be_an_instance_of(Hash)
342
+ end
343
+
344
+ it "returns an application's details" do
345
+ expect(@job).to have_key(:employment_type)
346
+ end
347
+ end
348
+ end
349
+
350
+ describe "#stages" do
351
+ before do
352
+ VCR.use_cassette('client/stages') do
353
+ @stages = @client.stages(4690)
354
+ end
355
+ end
356
+
357
+ it "returns a response" do
358
+ expect(@stages).to_not be_nil
359
+ end
360
+
361
+ it "returns an array of scheduled interviews" do
362
+ expect(@stages).to be_an_instance_of(Array)
363
+ end
364
+
365
+ it "returns details of the interview" do
366
+ expect(@stages.first).to have_key(:name)
367
+ end
368
+ end
369
+
370
+ describe "#job_post" do
371
+ before do
372
+ VCR.use_cassette('client/job_post') do
373
+ @job_post = @client.job_post(4690)
374
+ end
375
+ end
376
+
377
+ it "returns a response" do
378
+ expect(@job_post).to_not be_nil
379
+ end
380
+
381
+ it "returns an array of scheduled interviews" do
382
+ expect(@job_post).to be_an_instance_of(Hash)
383
+ end
384
+
385
+ it "returns details of the interview" do
386
+ expect(@job_post).to have_key(:title)
387
+ end
388
+ end
389
+
390
+ describe "#users" do
391
+ context "given no id" do
392
+ before do
393
+ VCR.use_cassette('client/users') do
394
+ @users = @client.users
395
+ end
396
+ end
397
+
398
+ it "returns a response" do
399
+ expect(@users).to_not be_nil
400
+ end
401
+
402
+ it "returns an array of applications" do
403
+ expect(@users).to be_an_instance_of(Array)
404
+ end
405
+
406
+ it "returns application details" do
407
+ expect(@users.first).to have_key(:name)
408
+ end
409
+ end
410
+
411
+ context "given an id" do
412
+ before do
413
+ VCR.use_cassette('client/user') do
414
+ @job = @client.users(10327)
415
+ end
416
+ end
417
+
418
+ it "returns a response" do
419
+ expect(@job).to_not be_nil
420
+ end
421
+
422
+ it "returns an application hash" do
423
+ expect(@job).to be_an_instance_of(Hash)
424
+ end
425
+
426
+ it "returns an application's details" do
427
+ expect(@job).to have_key(:name)
428
+ end
429
+ end
430
+ end
431
+
432
+ describe "#sources" do
433
+ context "given no id" do
434
+ before do
435
+ VCR.use_cassette('client/sources') do
436
+ @sources = @client.sources
437
+ end
438
+ end
439
+
440
+ it "returns a response" do
441
+ expect(@sources).to_not be_nil
442
+ end
443
+
444
+ it "returns an array of applications" do
445
+ expect(@sources).to be_an_instance_of(Array)
446
+ end
447
+
448
+ it "returns application details" do
449
+ expect(@sources.first).to have_key(:name)
450
+ end
451
+ end
452
+
453
+ context "given an id" do
454
+ before do
455
+ VCR.use_cassette('client/source') do
456
+ @source = @client.sources(1)
457
+ end
458
+ end
459
+
460
+ it "returns a response" do
461
+ expect(@source).to_not be_nil
462
+ end
463
+
464
+ it "returns an application hash" do
465
+ expect(@source).to be_an_instance_of(Hash)
466
+ end
467
+
468
+ it "returns an application's details" do
469
+ expect(@source).to have_key(:name)
470
+ end
471
+ end
472
+ end
473
+ end
474
+ end