greenhouse_io 1.0.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -1,22 +1,10 @@
1
1
  module GreenhouseIo
2
2
  class Error < StandardError
3
- attr_reader :msg, :code
3
+ attr_reader :code
4
4
 
5
- def initialize(msg = nil, code = nil)
6
- @msg = msg
5
+ def initialize(message, code = nil)
6
+ super message
7
7
  @code = code
8
8
  end
9
-
10
- def inspect
11
- if @code
12
- "GreenhouseIo::Error: #{ @code } response from server"
13
- else
14
- "GreenhouseIo::Error: #{ @msg }"
15
- end
16
- end
17
-
18
- def message
19
- @msg
20
- end
21
9
  end
22
10
  end
@@ -1,3 +1,3 @@
1
1
  module GreenhouseIo
2
- VERSION = "1.0.2"
2
+ VERSION = "2.0.0"
3
3
  end
@@ -0,0 +1,36 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://123FakeToken:@harvest.greenhouse.io/v1/candidates/1/activity_feed
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
+ - Wed, 23 Apr 2014 23:42:00 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
+ - '310'
29
+ Connection:
30
+ - keep-alive
31
+ body:
32
+ encoding: UTF-8
33
+ string: "{\"notes\":[],\"emails\":[],\"activities\":[{\"created_at\":\"2014-04-22T19:29:14Z\",\"subject\":null,\"body\":\"User One was moved into Preliminary Phone Screen for Bermuda Admissions on 04/01/2014\",\"user\":null},{\"created_at\":\"2014-04-18T18:54:14Z\",\"subject\":null,\"body\":\"User One applied online.\",\"user\":null}]}"
34
+ http_version:
35
+ recorded_at: Wed, 23 Apr 2014 23:42:01 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/applications/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
+ - Wed, 23 Apr 2014 23:45:18 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
+ - '29003'
29
+ Connection:
30
+ - keep-alive
31
+ body:
32
+ encoding: UTF-8
33
+ string: "{\"id\":1,\"person_id\":1,\"prospect\":false,\"applied_at\":\"2014-01-23T23:14:23Z\",\"last_activity_at\":\"2014-04-23T23:14:22Z\",\"source\":{\"id\":1,\"public_name\":\"Jobs page on your website\"},\"credited_to\":null,\"jobs\":[{\"id\":4595,\"name\":\"Associate Admissions Producer (Bermuda)\"}],\"status\":\"active\",\"current_stage\":{\"id\":1,\"name\":\"Application Review\"}}"
34
+ http_version:
35
+ recorded_at: Wed, 23 Apr 2014 23:45:19 GMT
36
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,43 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://123FakeToken:@harvest.greenhouse.io/v1/applications
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
+ - Wed, 23 Apr 2014 23:45:18 GMT
19
+ Link:
20
+ - "<https://harvest.greenhouse.io/v1/applications?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
+ - '29003'
31
+ Connection:
32
+ - keep-alive
33
+ body:
34
+ encoding: UTF-8
35
+ string: "[{\"id\":1,\"person_id\":1,\"prospect\":false,\"applied_at\":\"2012-03-15T00:00:00Z\",\"last_activity_at\":\"2013-10-23T16:00:33Z\",\"source\":{\"id\":700,\"public_name\":\"Legacy
36
+ Resumator Sources\"},\"credited_to\":null,\"jobs\":[{\"id\":4385,\"name\":\"Educational
37
+ Programs Producer\"}],\"status\":\"active\",\"current_stage\":{\"id\":1,\"name\":\"Preliminary
38
+ Phone Screen\"}},{\"id\":1,\"person_id\":1,\"prospect\":false,\"applied_at\":\"2012-03-17T00:00:00Z\",\"last_activity_at\":\"2013-10-23T16:00:33Z\",\"source\":null,\"credited_to\":null,\"jobs\":[{\"id\":4385,\"name\":\"Educational
39
+ Programs Producer\"}],\"status\":\"accepted\",\"current_stage\":{\"id\":12,\"name\":\"Application
40
+ Review\"}}]"
41
+ http_version:
42
+ recorded_at: Wed, 23 Apr 2014 23:45:19 GMT
43
+ 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/candidates/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
+ - Wed, 23 Apr 2014 23:23:01 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
+ - '68109'
29
+ Connection:
30
+ - keep-alive
31
+ body:
32
+ encoding: UTF-8
33
+ string: "{\"id\":1,\"first_name\":\"User\",\"last_name\":\"One\",\"company\":null,\"title\":null,\"created_at\":\"2013-10-17T15:32:26Z\",\"last_activity\":\"2013-10-30T14:37:10Z\",\"photo_url\":null,\"attachments\":[{\"filename\":\"USER_1_Resume_10.13.pdf\",\"url\":\"https://prod-heroku.s3.amazonaws.com/person_attachments/USER_1_Resume_10.13.pdf\",\"type\":\"cover_letter\"},{\"filename\":\"USER_1_Resume_10.13.pdf\",\"url\":\"https://resume.com/USER_1_Resume_10.13.pdf\",\"type\":\"resume\"}],\"application_ids\":[1234],\"phone_numbers\":[{\"value\":\"123-345-5678\",\"type\":\"other\"}],\"addresses\":[],\"email_addresses\":[{\"value\":\"user_one@email.com\",\"type\":\"personal\"}],\"website_addresses\":[],\"social_media_addresses\":[]}"
34
+ http_version:
35
+ recorded_at: Wed, 23 Apr 2014 23:23:02 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/candidates
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
+ - Wed, 23 Apr 2014 23:23:01 GMT
19
+ Link:
20
+ - "<https://harvest.greenhouse.io/v1/candidates?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
+ - '68109'
31
+ Connection:
32
+ - keep-alive
33
+ body:
34
+ encoding: UTF-8
35
+ string: "[{\"id\":1,\"first_name\":\"User\",\"last_name\":\"One\",\"company\":null,\"title\":null,\"created_at\":\"2013-10-17T15:32:26Z\",\"last_activity\":\"2013-10-30T14:37:10Z\",\"photo_url\":null,\"attachments\":[{\"filename\":\"USER_1_Resume_10.13.pdf\",\"url\":\"https://resumes.com/USER_1_Resume_10.13.pdf\",\"type\":\"cover_letter\"},{\"filename\":\"USER_1_Resume_10.13.pdf\",\"url\":\"https://prod-heroku.s3.amazonaws.com/person_attachments/USER_1_Resume_10.13.pdf\",\"type\":\"resume\"}],\"application_ids\":[1234],\"phone_numbers\":[{\"value\":\"123-345-5678\",\"type\":\"other\"}],\"addresses\":[],\"email_addresses\":[{\"value\":\"user_one@email.com\",\"type\":\"personal\"}],\"website_addresses\":[],\"social_media_addresses\":[]}]"
36
+ http_version:
37
+ recorded_at: Wed, 23 Apr 2014 23:23:02 GMT
38
+ 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/departments/187
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
+ - Tue, 22 Apr 2014 02:35:58 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
+ - '31'
29
+ Connection:
30
+ - keep-alive
31
+ body:
32
+ encoding: UTF-8
33
+ string: "{\"id\":187,\"name\":\"Engineering\"}"
34
+ http_version:
35
+ recorded_at: Tue, 22 Apr 2014 02:35:58 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/departments
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
+ - Tue, 22 Apr 2014 02:35:25 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
+ - '427'
29
+ Connection:
30
+ - keep-alive
31
+ body:
32
+ encoding: UTF-8
33
+ string: "[{\"id\":187,\"name\":\"Engineering\"},{\"id\":188,\"name\":\"Finance\"},{\"id\":364,\"name\":\"HR\"},{\"id\":365,\"name\":\"Marketing\"},{\"id\":366,\"name\":\"Curriculum\"},{\"id\":367,\"name\":\"Enterprise\"},{\"id\":368,\"name\":\"Online\"},{\"id\":369,\"name\":\"Education
34
+ Operations\"},{\"id\":370,\"name\":\"Frontlines\"},{\"id\":371,\"name\":\"Real
35
+ Estate\"},{\"id\":372,\"name\":\"Admissions\"},{\"id\":373,\"name\":\"Design\"},{\"id\":374,\"name\":\"Executive\"},{\"id\":499,\"name\":\"Instruction\"}]"
36
+ http_version:
37
+ recorded_at: Tue, 22 Apr 2014 02:35:25 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/jobs/4690
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:30:08 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
+ - '340'
29
+ Connection:
30
+ - keep-alive
31
+ body:
32
+ encoding: UTF-8
33
+ string: "{\"id\":4690,\"name\":\"Position Opening 1\",\"requisition_id\":\"\",\"notes\":null,\"status\":\"open\",\"employment_type\":null,\"created_at\":\"2013-11-06T16:26:34Z\",\"opened_at\":\"2013-11-06T16:26:34Z\",\"closed_at\":null,\"departments\":[{\"id\":367,\"name\":\"Enterprise\"}],\"offices\":[{\"id\":214,\"name\":\"New
34
+ York\",\"location\":{\"name\":\"New York, NY\"}}]}"
35
+ http_version:
36
+ recorded_at: Sun, 11 May 2014 23:30:09 GMT
37
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,49 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://123FakeToken:@harvest.greenhouse.io/v1/jobs/4690/job_post
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:33:42 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
+ - '5283'
29
+ Connection:
30
+ - keep-alive
31
+ body:
32
+ encoding: UTF-8
33
+ string: "{\"title\":\"Open Position 1\",\"location\":{\"name\":\"New
34
+ York\"},\"content\":\"<div>\\n<p><strong>Who are we?</strong></p>\\n<p><a
35
+ href=\\\"https://generalassemb.ly/\\\">General Assembly</a>&nbsp;is a successful,
36
+ venture backed, NYC based start-up focusing on delivering excellence in offline,
37
+ and online applied learning.&nbsp; We have campuses in NY, London, Berlin,
38
+ Sydney, Hong Kong, Boston and SF and provide educational programming, space,
39
+ and support to facilitate collaborative learning opportunities across a community
40
+ ranging from individual students to large enterprises</p>\",\"updated_at\":\"2014-02-12T22:58:27Z\",\"questions\":[{\"required\":true,\"private\":false,\"label\":\"First
41
+ Name\",\"type\":\"short_text\",\"values\":[]},{\"required\":true,\"private\":false,\"label\":\"Last
42
+ Name\",\"type\":\"short_text\",\"values\":[]},{\"required\":true,\"private\":false,\"label\":\"Email\",\"type\":\"short_text\",\"values\":[]},{\"required\":false,\"private\":false,\"label\":\"Phone\",\"type\":\"short_text\",\"values\":[]},{\"required\":true,\"private\":false,\"label\":\"Resume\",\"type\":\"attachment\",\"values\":[]},{\"required\":false,\"private\":false,\"label\":\"Cover
43
+ Letter\",\"type\":\"attachment\",\"values\":[]},{\"required\":true,\"private\":false,\"label\":\"LinkedIn
44
+ Profile\",\"type\":\"short_text\",\"values\":[]},{\"required\":false,\"private\":false,\"label\":\"Website\",\"type\":\"short_text\",\"values\":[]},{\"required\":true,\"private\":false,\"label\":\"In
45
+ a few sentences, tell us what makes you unique\",\"type\":\"long_text\",\"values\":[]},{\"required\":true,\"private\":false,\"label\":\"In
46
+ a few sentences, tell us why this job, why now?\",\"type\":\"long_text\",\"values\":[]}]}"
47
+ http_version:
48
+ recorded_at: Sun, 11 May 2014 23:33:43 GMT
49
+ 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/jobs
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:28:32 GMT
19
+ Link:
20
+ - "<https://harvest.greenhouse.io/v1/jobs?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
+ - '47597'
31
+ Connection:
32
+ - keep-alive
33
+ body:
34
+ encoding: UTF-8
35
+ string: "[{\"id\":4690,\"name\":\"Position Opening 1\",\"requisition_id\":\"\",\"notes\":null,\"status\":\"open\",\"employment_type\":null,\"created_at\":\"2013-11-06T16:26:34Z\",\"opened_at\":\"2013-11-06T16:26:34Z\",\"closed_at\":null,\"departments\":[{\"id\":367,\"name\":\"Enterprise\"}],\"offices\":[{\"id\":214,\"name\":\"New
36
+ York\",\"location\":{\"name\":\"New York, NY\"}}]}]"
37
+ http_version:
38
+ recorded_at: Sun, 11 May 2014 23:28:33 GMT
39
+ 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/offices/220
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:59:11 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
+ - '59'
29
+ Connection:
30
+ - keep-alive
31
+ body:
32
+ encoding: UTF-8
33
+ string: "{\"id\":220,\"name\":\"Boston\",\"location\":{\"name\":\"Boston, MA\"}}"
34
+ http_version:
35
+ recorded_at: Mon, 21 Apr 2014 23:59:11 GMT
36
+ recorded_with: VCR 2.5.0