greenhouse_io-gitlab 2.5.3

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 (66) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +19 -0
  3. data/.travis.yml +11 -0
  4. data/CHANGES.md +41 -0
  5. data/Gemfile +11 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +200 -0
  8. data/Rakefile +8 -0
  9. data/greenhouse_io.gemspec +29 -0
  10. data/lib/greenhouse_io.rb +9 -0
  11. data/lib/greenhouse_io/api.rb +19 -0
  12. data/lib/greenhouse_io/api/client.rb +145 -0
  13. data/lib/greenhouse_io/api/job_board.rb +66 -0
  14. data/lib/greenhouse_io/configuration.rb +21 -0
  15. data/lib/greenhouse_io/error.rb +10 -0
  16. data/lib/greenhouse_io/version.rb +3 -0
  17. data/spec/fixtures/cassettes/apply_to_job.yml +44 -0
  18. data/spec/fixtures/cassettes/client/activity_feed.yml +36 -0
  19. data/spec/fixtures/cassettes/client/all_scorecards.yml +38 -0
  20. data/spec/fixtures/cassettes/client/application.yml +36 -0
  21. data/spec/fixtures/cassettes/client/application_by_job_id.yml +139 -0
  22. data/spec/fixtures/cassettes/client/applications.yml +43 -0
  23. data/spec/fixtures/cassettes/client/candidate.yml +36 -0
  24. data/spec/fixtures/cassettes/client/candidates.yml +38 -0
  25. data/spec/fixtures/cassettes/client/create_candidate_note.yml +42 -0
  26. data/spec/fixtures/cassettes/client/create_candidate_note_invalid_candidate_id.yml +42 -0
  27. data/spec/fixtures/cassettes/client/create_candidate_note_invalid_missing_field.yml +42 -0
  28. data/spec/fixtures/cassettes/client/create_candidate_note_invalid_on_behalf_of.yml +42 -0
  29. data/spec/fixtures/cassettes/client/create_candidate_note_invalid_user_id.yml +42 -0
  30. data/spec/fixtures/cassettes/client/current_offer_for_application.yml +40 -0
  31. data/spec/fixtures/cassettes/client/department.yml +36 -0
  32. data/spec/fixtures/cassettes/client/departments.yml +38 -0
  33. data/spec/fixtures/cassettes/client/headers.yml +38 -0
  34. data/spec/fixtures/cassettes/client/job.yml +37 -0
  35. data/spec/fixtures/cassettes/client/job_post.yml +49 -0
  36. data/spec/fixtures/cassettes/client/jobs.yml +39 -0
  37. data/spec/fixtures/cassettes/client/offer.yml +48 -0
  38. data/spec/fixtures/cassettes/client/offers.yml +51 -0
  39. data/spec/fixtures/cassettes/client/offers_for_application.yml +40 -0
  40. data/spec/fixtures/cassettes/client/office.yml +36 -0
  41. data/spec/fixtures/cassettes/client/offices.yml +46 -0
  42. data/spec/fixtures/cassettes/client/scheduled_interviews.yml +38 -0
  43. data/spec/fixtures/cassettes/client/scorecards.yml +37 -0
  44. data/spec/fixtures/cassettes/client/source.yml +39 -0
  45. data/spec/fixtures/cassettes/client/sources.yml +37 -0
  46. data/spec/fixtures/cassettes/client/stages.yml +36 -0
  47. data/spec/fixtures/cassettes/client/user.yml +36 -0
  48. data/spec/fixtures/cassettes/client/users.yml +38 -0
  49. data/spec/fixtures/cassettes/department.yml +45 -0
  50. data/spec/fixtures/cassettes/departments.yml +45 -0
  51. data/spec/fixtures/cassettes/invalid_application.yml +43 -0
  52. data/spec/fixtures/cassettes/invalid_application_id.yml +44 -0
  53. data/spec/fixtures/cassettes/invalid_id.yml +40 -0
  54. data/spec/fixtures/cassettes/invalid_organization.yml +40 -0
  55. data/spec/fixtures/cassettes/job.yml +80 -0
  56. data/spec/fixtures/cassettes/job_with_questions.yml +85 -0
  57. data/spec/fixtures/cassettes/jobs.yml +44 -0
  58. data/spec/fixtures/cassettes/jobs_with_content.yml +118 -0
  59. data/spec/fixtures/cassettes/office.yml +45 -0
  60. data/spec/fixtures/cassettes/offices.yml +45 -0
  61. data/spec/greenhouse_io/api/client_spec.rb +679 -0
  62. data/spec/greenhouse_io/api/job_board_spec.rb +187 -0
  63. data/spec/greenhouse_io/configuration_spec.rb +71 -0
  64. data/spec/greenhouse_io/error_spec.rb +23 -0
  65. data/spec/spec_helper.rb +22 -0
  66. metadata +242 -0
@@ -0,0 +1,85 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.greenhouse.io/v1/boards/generalassembly/embed/job?id=721&questions=true
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Cache-Control:
16
+ - max-age=0, private, must-revalidate
17
+ Content-Type:
18
+ - text/html; charset=utf-8
19
+ Date:
20
+ - Mon, 16 Sep 2013 16:18:07 GMT
21
+ Etag:
22
+ - ! '"77aef19ad20c2bc27695390ec4f83e39"'
23
+ Status:
24
+ - 200 OK
25
+ Vary:
26
+ - Accept-Encoding
27
+ X-Request-Id:
28
+ - cce50db6be2de5ad8c55fd59fa1b9cde
29
+ X-Runtime:
30
+ - '0.019582'
31
+ X-Ua-Compatible:
32
+ - IE=Edge,chrome=1
33
+ Content-Length:
34
+ - '4046'
35
+ Connection:
36
+ - keep-alive
37
+ body:
38
+ encoding: US-ASCII
39
+ string: ! '{"id":721,"title":"Application developer","content":"<h3>Who
40
+ this job is right for</h3>\n<p>Anim wes anderson mixtape, flexitarian
41
+ cosby sweater craft beer cardigan aliquip. Qui pork belly labore ad cray.
42
+ Twee kogi sartorial, fanny pack pickled jean shorts occaecat hoodie mumblecore
43
+ truffaut VHS. Gluten-free literally intelligentsia, next level keffiyeh ad
44
+ cardigan dolor nihil fanny pack. Sartorial beard meggings, pug farm-to-table
45
+ banksy deep v. Hella banh mi swag flannel, authentic carles ethical. Sustainable
46
+ terry richardson raw denim ullamco brooklyn.</p>\n<h3>What we
47
+ are looking for</h3>\n<p>Dreamcatcher master cleanse esse odio
48
+ ullamco, raw denim farm-to-table selvage. Farm-to-table nesciunt fingerstache
49
+ narwhal echo park accusamus. Adipisicing vero consequat aesthetic:</p>\n<ul>\n<li>Bespoke
50
+ exercitation viral typewriter.</li>\n<li>Do small batch vinyl
51
+ gluten-free commodo portland.</li>\n<li>DIY pickled dolore, nostrud
52
+ biodiesel messenger bag</li>\n<li>Wayfarers brunch fingerstache
53
+ bespoke.</li>\n</ul>\n<p>Brooklyn aliqua hoodie literally
54
+ laborum PBR. Typewriter shoreditch photo booth odio, sustainable put a bird
55
+ on it ethical pinterest skateboard cosby sweater quinoa. Proident hashtag
56
+ officia trust fund nulla nisi. Stumptown odio veniam quinoa. Typewriter keffiyeh
57
+ bicycle rights, semiotics irure nihil vice freegan brooklyn pop-up culpa cardigan.
58
+ Blue bottle marfa voluptate, selfies four loko scenester quis. Pariatur ethnic
59
+ intelligentsia, tempor polaroid reprehenderit hella typewriter vice ugh bushwick
60
+ fap umami you probably haven't heard of them cred.</p>\n<h3>About
61
+ our work environment</h3>\n<p>DIY echo park cupidatat, cred odio
62
+ aute truffaut master cleanse dolor polaroid sustainable viral ad stumptown
63
+ pork belly. Flannel nesciunt enim non, sapiente occupy qui. Minim cosby sweater
64
+ vinyl bushwick nesciunt ea. American apparel polaroid laborum pickled, cosby
65
+ sweater carles street art exercitation literally disrupt in shoreditch lo-fi
66
+ incididunt. Food truck chambray pariatur, occupy selvage brooklyn consectetur
67
+ ennui aute. Polaroid fashion axe lo-fi vero, brooklyn odd future aesthetic.
68
+ Cupidatat yr nisi church-key craft beer.</p>\n<h3>Required skills
69
+ & experience</h3>\n<p>Deserunt hashtag qui tempor american
70
+ apparel irure. Gastropub forage nulla four loko thundercats carles. Raw denim
71
+ letterpress sartorial portland shoreditch neutra, PBR sint fixie consectetur
72
+ commodo. Leggings actually bushwick echo park cred, aliquip officia letterpress
73
+ artisan gastropub odd future single-origin coffee ex. Retro consectetur veniam
74
+ pug fap et. Vice butcher commodo, vegan synth incididunt banjo bespoke quinoa
75
+ +1 cillum. VHS trust fund mollit, cliche wolf dreamcatcher salvia tattooed
76
+ do thundercats carles.</p>","updated_at":"2013-09-12T21:01:50Z","location":{"name":"New
77
+ York, NY"},"absolute_url":"http://boards.greenhouse.io/generalassembly/jobs/721","departments":[],"offices":[],"questions":[{"required":true,"label":"First
78
+ Name","fields":[{"name":"first_name","type":"input_text"}]},{"required":true,"label":"Last
79
+ Name","fields":[{"name":"last_name","type":"input_text"}]},{"required":true,"label":"Email","fields":[{"name":"email","type":"input_text"}]},{"required":false,"label":"Phone","fields":[{"name":"phone","type":"input_text"}]},{"required":false,"label":"Resume","fields":[{"name":"resume","type":"input_file"},{"name":"resume_text","type":"textarea"}]},{"required":false,"label":"Cover
80
+ Letter","fields":[{"name":"cover_letter","type":"input_file"},{"name":"cover_letter_text","type":"textarea"}]},{"required":false,"label":"LinkedIn
81
+ Profile","fields":[{"name":"question_2720","type":"input_text"}]},{"required":false,"label":"Website","fields":[{"name":"question_2721","type":"input_text"}]},{"required":false,"label":"How
82
+ did you hear about this job?","fields":[{"name":"question_2722","type":"input_text"}]}]}'
83
+ http_version:
84
+ recorded_at: Mon, 16 Sep 2013 16:18:12 GMT
85
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,44 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.greenhouse.io/v1/boards/generalassembly/embed/jobs?content=
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Cache-Control:
16
+ - max-age=0, private, must-revalidate
17
+ Content-Type:
18
+ - text/html; charset=utf-8
19
+ Date:
20
+ - Mon, 16 Sep 2013 16:13:44 GMT
21
+ Etag:
22
+ - ! '"f918582f81e056febd7826368ee8eed6"'
23
+ Status:
24
+ - 200 OK
25
+ Vary:
26
+ - Accept-Encoding
27
+ X-Request-Id:
28
+ - 8fed45aa98c0b75293eacb62ecc32fa2
29
+ X-Runtime:
30
+ - '0.091448'
31
+ X-Ua-Compatible:
32
+ - IE=Edge,chrome=1
33
+ Content-Length:
34
+ - '368'
35
+ Connection:
36
+ - keep-alive
37
+ body:
38
+ encoding: US-ASCII
39
+ string: ! '{"jobs":[{"id":721,"title":"Application developer","updated_at":"2013-09-12T21:01:50Z","location":{"name":"New
40
+ York, NY"},"absolute_url":"http://boards.greenhouse.io/generalassembly/jobs/721"},{"id":722,"title":"Finance
41
+ Analyst","updated_at":"2013-09-12T21:01:50Z","location":{"name":"New York"},"absolute_url":"http://boards.greenhouse.io/generalassembly/jobs/722"}]}'
42
+ http_version:
43
+ recorded_at: Mon, 16 Sep 2013 16:13:48 GMT
44
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,118 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.greenhouse.io/v1/boards/generalassembly/embed/jobs?content=true
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Cache-Control:
16
+ - max-age=0, private, must-revalidate
17
+ Content-Type:
18
+ - text/html; charset=utf-8
19
+ Date:
20
+ - Mon, 16 Sep 2013 16:14:57 GMT
21
+ Etag:
22
+ - ! '"0280d69204eefbe5e96a8f82f29a8e84"'
23
+ Status:
24
+ - 200 OK
25
+ Vary:
26
+ - Accept-Encoding
27
+ X-Request-Id:
28
+ - 60b51e964a50edb88aa7a4d4c35da3e1
29
+ X-Runtime:
30
+ - '0.184783'
31
+ X-Ua-Compatible:
32
+ - IE=Edge,chrome=1
33
+ Content-Length:
34
+ - '6233'
35
+ Connection:
36
+ - keep-alive
37
+ body:
38
+ encoding: US-ASCII
39
+ string: ! '{"jobs":[{"id":721,"title":"Application developer","content":"<h3>Who
40
+ this job is right for</h3>\n<p>Anim wes anderson mixtape, flexitarian
41
+ cosby sweater craft beer cardigan aliquip. Qui pork belly labore ad cray.
42
+ Twee kogi sartorial, fanny pack pickled jean shorts occaecat hoodie mumblecore
43
+ truffaut VHS. Gluten-free literally intelligentsia, next level keffiyeh ad
44
+ cardigan dolor nihil fanny pack. Sartorial beard meggings, pug farm-to-table
45
+ banksy deep v. Hella banh mi swag flannel, authentic carles ethical. Sustainable
46
+ terry richardson raw denim ullamco brooklyn.</p>\n<h3>What we
47
+ are looking for</h3>\n<p>Dreamcatcher master cleanse esse odio
48
+ ullamco, raw denim farm-to-table selvage. Farm-to-table nesciunt fingerstache
49
+ narwhal echo park accusamus. Adipisicing vero consequat aesthetic:</p>\n<ul>\n<li>Bespoke
50
+ exercitation viral typewriter.</li>\n<li>Do small batch vinyl
51
+ gluten-free commodo portland.</li>\n<li>DIY pickled dolore, nostrud
52
+ biodiesel messenger bag</li>\n<li>Wayfarers brunch fingerstache
53
+ bespoke.</li>\n</ul>\n<p>Brooklyn aliqua hoodie literally
54
+ laborum PBR. Typewriter shoreditch photo booth odio, sustainable put a bird
55
+ on it ethical pinterest skateboard cosby sweater quinoa. Proident hashtag
56
+ officia trust fund nulla nisi. Stumptown odio veniam quinoa. Typewriter keffiyeh
57
+ bicycle rights, semiotics irure nihil vice freegan brooklyn pop-up culpa cardigan.
58
+ Blue bottle marfa voluptate, selfies four loko scenester quis. Pariatur ethnic
59
+ intelligentsia, tempor polaroid reprehenderit hella typewriter vice ugh bushwick
60
+ fap umami you probably haven't heard of them cred.</p>\n<h3>About
61
+ our work environment</h3>\n<p>DIY echo park cupidatat, cred odio
62
+ aute truffaut master cleanse dolor polaroid sustainable viral ad stumptown
63
+ pork belly. Flannel nesciunt enim non, sapiente occupy qui. Minim cosby sweater
64
+ vinyl bushwick nesciunt ea. American apparel polaroid laborum pickled, cosby
65
+ sweater carles street art exercitation literally disrupt in shoreditch lo-fi
66
+ incididunt. Food truck chambray pariatur, occupy selvage brooklyn consectetur
67
+ ennui aute. Polaroid fashion axe lo-fi vero, brooklyn odd future aesthetic.
68
+ Cupidatat yr nisi church-key craft beer.</p>\n<h3>Required skills
69
+ & experience</h3>\n<p>Deserunt hashtag qui tempor american
70
+ apparel irure. Gastropub forage nulla four loko thundercats carles. Raw denim
71
+ letterpress sartorial portland shoreditch neutra, PBR sint fixie consectetur
72
+ commodo. Leggings actually bushwick echo park cred, aliquip officia letterpress
73
+ artisan gastropub odd future single-origin coffee ex. Retro consectetur veniam
74
+ pug fap et. Vice butcher commodo, vegan synth incididunt banjo bespoke quinoa
75
+ +1 cillum. VHS trust fund mollit, cliche wolf dreamcatcher salvia tattooed
76
+ do thundercats carles.</p>","updated_at":"2013-09-12T21:01:50Z","location":{"name":"New
77
+ York, NY"},"absolute_url":"http://boards.greenhouse.io/generalassembly/jobs/721","departments":[],"offices":[]},{"id":722,"title":"Finance
78
+ Analyst","content":"<h3>Who this job is right for</h3>\n<p>Anim
79
+ wes anderson mixtape, flexitarian cosby sweater craft beer cardigan aliquip.
80
+ Qui pork belly labore ad cray. Twee kogi sartorial, fanny pack pickled jean
81
+ shorts occaecat hoodie mumblecore truffaut VHS. Gluten-free literally intelligentsia,
82
+ next level keffiyeh ad cardigan dolor nihil fanny pack. Sartorial beard meggings,
83
+ pug farm-to-table banksy deep v. Hella banh mi swag flannel, authentic carles
84
+ ethical. Sustainable terry richardson raw denim ullamco brooklyn.</p>\n<h3>What
85
+ we are looking for</h3>\n<p>Dreamcatcher master cleanse esse odio
86
+ ullamco, raw denim farm-to-table selvage. Farm-to-table nesciunt fingerstache
87
+ narwhal echo park accusamus. Adipisicing vero consequat aesthetic:</p>\n<ul>\n<li>Bespoke
88
+ exercitation viral typewriter.</li>\n<li>Do small batch vinyl
89
+ gluten-free commodo portland.</li>\n<li>DIY pickled dolore, nostrud
90
+ biodiesel messenger bag</li>\n<li>Wayfarers brunch fingerstache
91
+ bespoke.</li>\n</ul>\n<p>Brooklyn aliqua hoodie literally
92
+ laborum PBR. Typewriter shoreditch photo booth odio, sustainable put a bird
93
+ on it ethical pinterest skateboard cosby sweater quinoa. Proident hashtag
94
+ officia trust fund nulla nisi. Stumptown odio veniam quinoa. Typewriter keffiyeh
95
+ bicycle rights, semiotics irure nihil vice freegan brooklyn pop-up culpa cardigan.
96
+ Blue bottle marfa voluptate, selfies four loko scenester quis. Pariatur ethnic
97
+ intelligentsia, tempor polaroid reprehenderit hella typewriter vice ugh bushwick
98
+ fap umami you probably haven't heard of them cred.</p>\n<h3>About
99
+ our work environment</h3>\n<p>DIY echo park cupidatat, cred odio
100
+ aute truffaut master cleanse dolor polaroid sustainable viral ad stumptown
101
+ pork belly. Flannel nesciunt enim non, sapiente occupy qui. Minim cosby sweater
102
+ vinyl bushwick nesciunt ea. American apparel polaroid laborum pickled, cosby
103
+ sweater carles street art exercitation literally disrupt in shoreditch lo-fi
104
+ incididunt. Food truck chambray pariatur, occupy selvage brooklyn consectetur
105
+ ennui aute. Polaroid fashion axe lo-fi vero, brooklyn odd future aesthetic.
106
+ Cupidatat yr nisi church-key craft beer.</p>\n<h3>Required skills
107
+ & experience</h3>\n<p>Deserunt hashtag qui tempor american
108
+ apparel irure. Gastropub forage nulla four loko thundercats carles. Raw denim
109
+ letterpress sartorial portland shoreditch neutra, PBR sint fixie consectetur
110
+ commodo. Leggings actually bushwick echo park cred, aliquip officia letterpress
111
+ artisan gastropub odd future single-origin coffee ex. Retro consectetur veniam
112
+ pug fap et. Vice butcher commodo, vegan synth incididunt banjo bespoke quinoa
113
+ +1 cillum. VHS trust fund mollit, cliche wolf dreamcatcher salvia tattooed
114
+ do thundercats carles.</p>","updated_at":"2013-09-12T21:01:50Z","location":{"name":"New
115
+ York"},"absolute_url":"http://boards.greenhouse.io/generalassembly/jobs/722","departments":[{"id":188,"name":"Finance"}],"offices":[]}]}'
116
+ http_version:
117
+ recorded_at: Mon, 16 Sep 2013 16:15:02 GMT
118
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,45 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.greenhouse.io/v1/boards/generalassembly/embed/office?id=0
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Cache-Control:
16
+ - max-age=0, private, must-revalidate
17
+ Content-Type:
18
+ - text/html; charset=utf-8
19
+ Date:
20
+ - Mon, 16 Sep 2013 16:04:17 GMT
21
+ Etag:
22
+ - ! '"8cbe966f113629b0ab3e59aadf42ff0f"'
23
+ Status:
24
+ - 200 OK
25
+ Vary:
26
+ - Accept-Encoding
27
+ X-Request-Id:
28
+ - a15edfde1538bab59946b9a03f10c674
29
+ X-Runtime:
30
+ - '0.155822'
31
+ X-Ua-Compatible:
32
+ - IE=Edge,chrome=1
33
+ Content-Length:
34
+ - '521'
35
+ Connection:
36
+ - keep-alive
37
+ body:
38
+ encoding: US-ASCII
39
+ string: ! '{"id":0,"name":"No Office","departments":[{"id":187,"name":"Engineering","jobs":[]},{"id":188,"name":"Finance","jobs":[{"id":722,"title":"Finance
40
+ Analyst","updated_at":"2013-09-12T21:01:50Z","location":{"name":"New York"},"absolute_url":"http://boards.greenhouse.io/generalassembly/jobs/722"}]},{"id":0,"name":"No
41
+ Department","jobs":[{"id":721,"title":"Application developer","updated_at":"2013-09-12T21:01:50Z","location":{"name":"New
42
+ York, NY"},"absolute_url":"http://boards.greenhouse.io/generalassembly/jobs/721"}]}]}'
43
+ http_version:
44
+ recorded_at: Mon, 16 Sep 2013 16:04:22 GMT
45
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,45 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.greenhouse.io/v1/boards/generalassembly/embed/offices
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Cache-Control:
16
+ - max-age=0, private, must-revalidate
17
+ Content-Type:
18
+ - text/html; charset=utf-8
19
+ Date:
20
+ - Mon, 16 Sep 2013 16:04:17 GMT
21
+ Etag:
22
+ - ! '"80777909660bca19af3cbefaa6840719"'
23
+ Status:
24
+ - 200 OK
25
+ Vary:
26
+ - Accept-Encoding
27
+ X-Request-Id:
28
+ - 01860b0b55d4de4c1de3efff5ea66d4b
29
+ X-Runtime:
30
+ - '0.009176'
31
+ X-Ua-Compatible:
32
+ - IE=Edge,chrome=1
33
+ Content-Length:
34
+ - '535'
35
+ Connection:
36
+ - keep-alive
37
+ body:
38
+ encoding: US-ASCII
39
+ string: ! '{"offices":[{"id":0,"name":"No Office","departments":[{"id":187,"name":"Engineering","jobs":[]},{"id":188,"name":"Finance","jobs":[{"id":722,"title":"Finance
40
+ Analyst","updated_at":"2013-09-12T21:01:50Z","location":{"name":"New York"},"absolute_url":"http://boards.greenhouse.io/generalassembly/jobs/722"}]},{"id":0,"name":"No
41
+ Department","jobs":[{"id":721,"title":"Application developer","updated_at":"2013-09-12T21:01:50Z","location":{"name":"New
42
+ York, NY"},"absolute_url":"http://boards.greenhouse.io/generalassembly/jobs/721"}]}]}]}'
43
+ http_version:
44
+ recorded_at: Mon, 16 Sep 2013 16:04:21 GMT
45
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,679 @@
1
+ require 'spec_helper'
2
+
3
+ describe GreenhouseIo::Client do
4
+
5
+ FAKE_API_TOKEN = '123FakeToken'
6
+
7
+ it "should have a base url for an API endpoint" do
8
+ expect(GreenhouseIo::Client.base_uri).to eq("https://harvest.greenhouse.io/v1")
9
+ end
10
+
11
+ context "given an instance of GreenhouseIo::Client" do
12
+
13
+ before do
14
+ GreenhouseIo.configuration.symbolize_keys = true
15
+ @client = GreenhouseIo::Client.new(FAKE_API_TOKEN)
16
+ end
17
+
18
+ describe "#initialize" do
19
+ it "has an api_token" do
20
+ expect(@client.api_token).to eq(FAKE_API_TOKEN)
21
+ end
22
+
23
+ it "uses the configuration value when token is not specified" do
24
+ GreenhouseIo.configuration.api_token = '123FakeENV'
25
+ default_client = GreenhouseIo::Client.new
26
+ expect(default_client.api_token).to eq('123FakeENV')
27
+ end
28
+ end
29
+
30
+ describe "#path_id" do
31
+ context "given an id" do
32
+ it "returns an id path" do
33
+ output = @client.send(:path_id, 1)
34
+ expect(output).to eq('/1')
35
+ end
36
+ end
37
+
38
+ context "given no id" do
39
+ it "returns nothing" do
40
+ output = @client.send(:path_id)
41
+ expect(output).to be_nil
42
+ end
43
+ end
44
+ end
45
+
46
+ describe "#set_headers_info" do
47
+ before do
48
+ VCR.use_cassette('client/headers') do
49
+ @client.candidates
50
+ end
51
+ end
52
+
53
+ it "sets the rate limit" do
54
+ expect(@client.rate_limit).to eq(20)
55
+ end
56
+
57
+ it "sets the remaining rate limit" do
58
+ expect(@client.rate_limit_remaining).to eq(19)
59
+ end
60
+
61
+ it "sets rest link" do
62
+ expect(@client.link).to eq('<https://harvest.greenhouse.io/v1/candidates/?page=1&per_page=100>; rel="last"')
63
+ end
64
+ end
65
+
66
+ describe "#permitted_options" do
67
+ let(:options) { GreenhouseIo::Client::PERMITTED_OPTIONS + [:where] }
68
+
69
+ it "allows permitted options" do
70
+ output = @client.send(:permitted_options, options)
71
+ GreenhouseIo::Client::PERMITTED_OPTIONS.each do |option|
72
+ expect(output).to include(option)
73
+ end
74
+ end
75
+
76
+ it "discards non-permitted options" do
77
+ output = @client.send(:permitted_options, options)
78
+ expect(output).to_not include(:where)
79
+ end
80
+ end
81
+
82
+ describe "#offices" do
83
+ context "given no id" do
84
+ before do
85
+ VCR.use_cassette('client/offices') do
86
+ @offices_response = @client.offices
87
+ end
88
+ end
89
+
90
+ it "returns a response" do
91
+ expect(@offices_response).to_not be_nil
92
+ end
93
+
94
+ it "returns an array of offices" do
95
+ expect(@offices_response).to be_an_instance_of(Array)
96
+ end
97
+
98
+ it "returns office details" do
99
+ expect(@offices_response.first).to have_key(:name)
100
+ end
101
+ end
102
+
103
+ context "given an id" do
104
+ before do
105
+ VCR.use_cassette('client/office') do
106
+ @office_response = @client.offices(220)
107
+ end
108
+ end
109
+
110
+ it "returns a response" do
111
+ expect(@office_response).to_not be_nil
112
+ end
113
+
114
+ it "returns an office hash" do
115
+ expect(@office_response).to be_an_instance_of(Hash)
116
+ end
117
+
118
+ it "returns an office's details" do
119
+ expect(@office_response).to have_key(:name)
120
+ end
121
+ end
122
+ end
123
+
124
+ describe "#departments" do
125
+ context "given no id" do
126
+ before do
127
+ VCR.use_cassette('client/departments') do
128
+ @departments_response = @client.departments
129
+ end
130
+ end
131
+
132
+ it "returns a response" do
133
+ expect(@departments_response).to_not be_nil
134
+ end
135
+
136
+ it "returns an array of departments" do
137
+ expect(@departments_response).to be_an_instance_of(Array)
138
+ end
139
+
140
+ it "returns office details" do
141
+ expect(@departments_response.first).to have_key(:name)
142
+ end
143
+ end
144
+
145
+ context "given an id" do
146
+ before do
147
+ VCR.use_cassette('client/department') do
148
+ @department_response = @client.departments(187)
149
+ end
150
+ end
151
+
152
+ it "returns a response" do
153
+ expect(@department_response).to_not be_nil
154
+ end
155
+
156
+ it "returns a department hash" do
157
+ expect(@department_response).to be_an_instance_of(Hash)
158
+ end
159
+
160
+ it "returns a department's details" do
161
+ expect(@department_response).to have_key(:name)
162
+ end
163
+ end
164
+ end
165
+
166
+ describe "#candidates" do
167
+ context "given no id" do
168
+
169
+ before do
170
+ VCR.use_cassette('client/candidates') do
171
+ @candidates_response = @client.candidates
172
+ end
173
+ end
174
+
175
+ it "returns a response" do
176
+ expect(@candidates_response).to_not be_nil
177
+ end
178
+
179
+ it "returns an array of candidates" do
180
+ expect(@candidates_response).to be_an_instance_of(Array)
181
+ end
182
+
183
+ it "returns details of candidates" do
184
+ expect(@candidates_response.first).to have_key(:first_name)
185
+ end
186
+ end
187
+
188
+ context "given an id" do
189
+ before do
190
+ VCR.use_cassette('client/candidate') do
191
+ @candidate_response = @client.candidates(1)
192
+ end
193
+ end
194
+
195
+ it "returns a response" do
196
+ expect(@candidate_response).to_not be_nil
197
+ end
198
+
199
+ it "returns a candidate hash" do
200
+ expect(@candidate_response).to be_an_instance_of(Hash)
201
+ end
202
+
203
+ it "returns a candidate's details" do
204
+ expect(@candidate_response).to have_key(:first_name)
205
+ end
206
+ end
207
+ end
208
+
209
+ describe "#activity_feed" do
210
+ before do
211
+ VCR.use_cassette('client/activity_feed') do
212
+ @activity_feed = @client.activity_feed(1)
213
+ end
214
+ end
215
+
216
+ it "returns a response" do
217
+ expect(@activity_feed).to_not be_nil
218
+ end
219
+
220
+ it "returns an activity feed" do
221
+ expect(@activity_feed).to be_an_instance_of(Hash)
222
+ end
223
+
224
+ it "returns details of the activity feed" do
225
+ expect(@activity_feed).to have_key(:activities)
226
+ end
227
+ end
228
+
229
+ describe "#create_candidate_note" do
230
+ it "posts an note for a specified candidate" do
231
+ VCR.use_cassette('client/create_candidate_note') do
232
+ create_candidate_note = @client.create_candidate_note(
233
+ 1,
234
+ {
235
+ user_id: 2,
236
+ message: "Candidate on vacation",
237
+ visibility: "public"
238
+ },
239
+ 2
240
+ )
241
+ expect(create_candidate_note).to_not be_nil
242
+ expect(create_candidate_note).to include :body => 'Candidate on vacation'
243
+ end
244
+ end
245
+
246
+ it "errors when given invalid On-Behalf-Of id" do
247
+ VCR.use_cassette('client/create_candidate_note_invalid_on_behalf_of') do
248
+ expect {
249
+ @client.create_candidate_note(
250
+ 1,
251
+ {
252
+ user_id: 2,
253
+ message: "Candidate on vacation",
254
+ visibility: "public"
255
+ },
256
+ 99
257
+ )
258
+ }.to raise_error(GreenhouseIo::Error)
259
+ end
260
+ end
261
+
262
+ it "errors when given an invalid candidate id" do
263
+ VCR.use_cassette('client/create_candidate_note_invalid_candidate_id') do
264
+ expect {
265
+ @client.create_candidate_note(
266
+ 99,
267
+ {
268
+ user_id: 2,
269
+ message: "Candidate on vacation",
270
+ visibility: "public"
271
+ },
272
+ 2
273
+ )
274
+ }.to raise_error(GreenhouseIo::Error)
275
+ end
276
+ end
277
+
278
+ it "errors when given an invalid user_id" do
279
+ VCR.use_cassette('client/create_candidate_note_invalid_user_id') do
280
+ expect {
281
+ @client.create_candidate_note(
282
+ 1,
283
+ {
284
+ user_id: 99,
285
+ message: "Candidate on vacation",
286
+ visibility: "public"
287
+ },
288
+ 2
289
+ )
290
+ }.to raise_error(GreenhouseIo::Error)
291
+ end
292
+ end
293
+
294
+ it "errors when missing required field" do
295
+ VCR.use_cassette('client/create_candidate_note_invalid_missing_field') do
296
+ expect {
297
+ @client.create_candidate_note(
298
+ 1,
299
+ {
300
+ user_id: 2,
301
+ visibility: "public"
302
+ },
303
+ 2
304
+ )
305
+ }.to raise_error(GreenhouseIo::Error)
306
+ end
307
+ end
308
+ end
309
+
310
+ describe "#applications" do
311
+ context "given no id" do
312
+ before do
313
+ VCR.use_cassette('client/applications') do
314
+ @applications = @client.applications
315
+ end
316
+ end
317
+
318
+ it "returns a response" do
319
+ expect(@applications).to_not be_nil
320
+ end
321
+
322
+ it "returns an array of applications" do
323
+ expect(@applications).to be_an_instance_of(Array)
324
+ end
325
+
326
+ it "returns application details" do
327
+ expect(@applications.first).to have_key(:person_id)
328
+ end
329
+ end
330
+
331
+ context "given an id" do
332
+ before do
333
+ VCR.use_cassette('client/application') do
334
+ @application = @client.applications(1)
335
+ end
336
+ end
337
+
338
+ it "returns a response" do
339
+ expect(@application).to_not be_nil
340
+ end
341
+
342
+ it "returns an application hash" do
343
+ expect(@application).to be_an_instance_of(Hash)
344
+ end
345
+
346
+ it "returns an application's details" do
347
+ expect(@application).to have_key(:person_id)
348
+ end
349
+ end
350
+
351
+ context "given a job_id" do
352
+ before do
353
+ VCR.use_cassette('client/application_by_job_id') do
354
+ @applications = @client.applications(nil, :job_id => 144371)
355
+ end
356
+ end
357
+
358
+ it "returns a response" do
359
+ expect(@applications).to_not be_nil
360
+ end
361
+
362
+ it "returns an array of applications" do
363
+ expect(@applications).to be_an_instance_of(Array)
364
+ expect(@applications.first).to be_an_instance_of(Hash)
365
+ expect(@applications.first).to have_key(:prospect)
366
+ end
367
+ end
368
+ end
369
+
370
+ describe "#scorecards" do
371
+ before do
372
+ VCR.use_cassette('client/scorecards') do
373
+ @scorecard = @client.scorecards(1)
374
+ end
375
+ end
376
+
377
+ it "returns a response" do
378
+ expect(@scorecard).to_not be_nil
379
+ end
380
+
381
+ it "returns an array of scorecards" do
382
+ expect(@scorecard).to be_an_instance_of(Array)
383
+ end
384
+
385
+ it "returns details of the scorecards" do
386
+ expect(@scorecard.first).to have_key(:interview)
387
+ end
388
+ end
389
+
390
+ describe "#all_scorecards" do
391
+ before do
392
+ VCR.use_cassette('client/all_scorecards') do
393
+ @scorecard = @client.all_scorecards
394
+ end
395
+ end
396
+
397
+ it "returns a response" do
398
+ expect(@scorecard).to_not be_nil
399
+ end
400
+
401
+ it "returns an array of scorecards" do
402
+ expect(@scorecard).to be_an_instance_of(Array)
403
+ end
404
+
405
+ it "returns details of the scorecards" do
406
+ expect(@scorecard.first).to have_key(:interview)
407
+ end
408
+ end
409
+
410
+ describe "#scheduled_interviews" do
411
+ before do
412
+ VCR.use_cassette('client/scheduled_interviews') do
413
+ @scheduled_interviews = @client.scheduled_interviews(1)
414
+ end
415
+ end
416
+
417
+ it "returns a response" do
418
+ expect(@scheduled_interviews).to_not be_nil
419
+ end
420
+
421
+ it "returns an array of scheduled interviews" do
422
+ expect(@scheduled_interviews).to be_an_instance_of(Array)
423
+ end
424
+
425
+ it "returns details of the interview" do
426
+ expect(@scheduled_interviews.first).to have_key(:starts_at)
427
+ end
428
+ end
429
+
430
+ describe "#jobs" do
431
+ context "given no id" do
432
+ before do
433
+ VCR.use_cassette('client/jobs') do
434
+ @jobs = @client.jobs
435
+ end
436
+ end
437
+
438
+ it "returns a response" do
439
+ expect(@jobs).to_not be_nil
440
+ end
441
+
442
+ it "returns an array of applications" do
443
+ expect(@jobs).to be_an_instance_of(Array)
444
+ end
445
+
446
+ it "returns application details" do
447
+ expect(@jobs.first).to have_key(:employment_type)
448
+ end
449
+ end
450
+
451
+ context "given an id" do
452
+ before do
453
+ VCR.use_cassette('client/job') do
454
+ @job = @client.jobs(4690)
455
+ end
456
+ end
457
+
458
+ it "returns a response" do
459
+ expect(@job).to_not be_nil
460
+ end
461
+
462
+ it "returns an application hash" do
463
+ expect(@job).to be_an_instance_of(Hash)
464
+ end
465
+
466
+ it "returns an application's details" do
467
+ expect(@job).to have_key(:employment_type)
468
+ end
469
+ end
470
+ end
471
+
472
+ describe "#stages" do
473
+ before do
474
+ VCR.use_cassette('client/stages') do
475
+ @stages = @client.stages(4690)
476
+ end
477
+ end
478
+
479
+ it "returns a response" do
480
+ expect(@stages).to_not be_nil
481
+ end
482
+
483
+ it "returns an array of scheduled interviews" do
484
+ expect(@stages).to be_an_instance_of(Array)
485
+ end
486
+
487
+ it "returns details of the interview" do
488
+ expect(@stages.first).to have_key(:name)
489
+ end
490
+ end
491
+
492
+ describe "#job_post" do
493
+ before do
494
+ VCR.use_cassette('client/job_post') do
495
+ @job_post = @client.job_post(4690)
496
+ end
497
+ end
498
+
499
+ it "returns a response" do
500
+ expect(@job_post).to_not be_nil
501
+ end
502
+
503
+ it "returns an array of scheduled interviews" do
504
+ expect(@job_post).to be_an_instance_of(Hash)
505
+ end
506
+
507
+ it "returns details of the interview" do
508
+ expect(@job_post).to have_key(:title)
509
+ end
510
+ end
511
+
512
+ describe "#users" do
513
+ context "given no id" do
514
+ before do
515
+ VCR.use_cassette('client/users') do
516
+ @users = @client.users
517
+ end
518
+ end
519
+
520
+ it "returns a response" do
521
+ expect(@users).to_not be_nil
522
+ end
523
+
524
+ it "returns an array of applications" do
525
+ expect(@users).to be_an_instance_of(Array)
526
+ end
527
+
528
+ it "returns application details" do
529
+ expect(@users.first).to have_key(:name)
530
+ end
531
+ end
532
+
533
+ context "given an id" do
534
+ before do
535
+ VCR.use_cassette('client/user') do
536
+ @job = @client.users(10327)
537
+ end
538
+ end
539
+
540
+ it "returns a response" do
541
+ expect(@job).to_not be_nil
542
+ end
543
+
544
+ it "returns an application hash" do
545
+ expect(@job).to be_an_instance_of(Hash)
546
+ end
547
+
548
+ it "returns an application's details" do
549
+ expect(@job).to have_key(:name)
550
+ end
551
+ end
552
+ end
553
+
554
+ describe "#sources" do
555
+ context "given no id" do
556
+ before do
557
+ VCR.use_cassette('client/sources') do
558
+ @sources = @client.sources
559
+ end
560
+ end
561
+
562
+ it "returns a response" do
563
+ expect(@sources).to_not be_nil
564
+ end
565
+
566
+ it "returns an array of applications" do
567
+ expect(@sources).to be_an_instance_of(Array)
568
+ end
569
+
570
+ it "returns application details" do
571
+ expect(@sources.first).to have_key(:name)
572
+ end
573
+ end
574
+
575
+ context "given an id" do
576
+ before do
577
+ VCR.use_cassette('client/source') do
578
+ @source = @client.sources(1)
579
+ end
580
+ end
581
+
582
+ it "returns a response" do
583
+ expect(@source).to_not be_nil
584
+ end
585
+
586
+ it "returns an application hash" do
587
+ expect(@source).to be_an_instance_of(Hash)
588
+ end
589
+
590
+ it "returns an application's details" do
591
+ expect(@source).to have_key(:name)
592
+ end
593
+ end
594
+ end
595
+
596
+ describe "#offers" do
597
+ context "given no id" do
598
+ before do
599
+ VCR.use_cassette('client/offers') do
600
+ @offers = @client.offers
601
+ end
602
+ end
603
+
604
+ it "returns a response" do
605
+ expect(@offers).to_not be nil
606
+ end
607
+
608
+ it "returns an array of offers" do
609
+ expect(@offers).to be_an_instance_of(Array)
610
+ expect(@offers.first[:id]).to be_a(Integer).and be > 0
611
+ expect(@offers.first[:created_at]).to be_a(String)
612
+ expect(@offers.first[:version]).to be_a(Integer).and be > 0
613
+ expect(@offers.first[:status]).to be_a(String)
614
+ end
615
+ end
616
+
617
+ context "given an id" do
618
+ before do
619
+ VCR.use_cassette('client/offer') do
620
+ @offer = @client.offers(221598)
621
+ end
622
+ end
623
+
624
+ it "returns a response" do
625
+ expect(@offer).to_not be nil
626
+ end
627
+
628
+ it "returns an offer object" do
629
+ expect(@offer).to be_an_instance_of(Hash)
630
+ expect(@offer[:id]).to be_a(Integer).and be > 0
631
+ expect(@offer[:created_at]).to be_a(String)
632
+ expect(@offer[:version]).to be_a(Integer).and be > 0
633
+ expect(@offer[:status]).to be_a(String)
634
+ end
635
+ end
636
+ end
637
+
638
+ describe "#offers_for_application" do
639
+ before do
640
+ VCR.use_cassette('client/offers_for_application') do
641
+ @offers = @client.offers_for_application(123)
642
+ end
643
+ end
644
+
645
+ it "returns a response" do
646
+ expect(@offers).to_not be_nil
647
+ end
648
+
649
+ it "returns an array of offers" do
650
+ expect(@offers).to be_an_instance_of(Array)
651
+
652
+ return unless @offers.size > 0
653
+ expect(@offers.first).to have_key(:application_id)
654
+ expect(@offers.first).to have_key(:version)
655
+ expect(@offers.first).to have_key(:status)
656
+ end
657
+ end
658
+
659
+ describe "#current_offer_for_application" do
660
+ before do
661
+ VCR.use_cassette('client/current_offer_for_application') do
662
+ @offer = @client.current_offer_for_application(123)
663
+ end
664
+ end
665
+
666
+ it "returns a response" do
667
+ expect(@offer).to_not be_nil
668
+ end
669
+
670
+ it "returns an offer object" do
671
+ expect(@offer).to be_an_instance_of(Hash)
672
+ expect(@offer[:id]).to be_a(Integer).and be > 0
673
+ expect(@offer[:created_at]).to be_a(String)
674
+ expect(@offer[:version]).to be_a(Integer).and be > 0
675
+ expect(@offer[:status]).to be_a(String)
676
+ end
677
+ end
678
+ end
679
+ end