Class: GreenhouseIo::Client
- Inherits:
-
Object
- Object
- GreenhouseIo::Client
show all
- Includes:
- API
- Defined in:
- lib/greenhouse_io/api/client.rb
Constant Summary
collapse
- PERMITTED_OPTIONS =
[:page, :per_page, :job_id]
- PERMITTED_OPTIONS_PER_ENDPOINT =
{
'offers' => [:status, :resolved_after],
'candidates' => [:updated_after, :email]
}
- BASE_URL =
'https://harvest.greenhouse.io/v1'
Instance Attribute Summary collapse
Instance Method Summary
collapse
-
#activity_feed(id, options = {}) ⇒ Object
-
#all_scorecards(id = nil, options = {}) ⇒ Object
-
#applications(id = nil, options = {}) ⇒ Object
-
#candidates(id = nil, options = {}) ⇒ Object
-
#create_candidate_note(candidate_id, note_hash, on_behalf_of) ⇒ Object
-
#current_offer_for_application(id, options = {}) ⇒ Object
-
#departments(id = nil, options = {}) ⇒ Object
-
#initialize(api_token = nil) ⇒ Client
constructor
A new instance of Client.
-
#job_post(id, options = {}) ⇒ Object
-
#job_posts(options = {}) ⇒ Object
-
#jobs(id = nil, options = {}) ⇒ Object
-
#offers(id = nil, options = {}) ⇒ Object
-
#offers_for_application(id, options = {}) ⇒ Object
-
#offices(id = nil, options = {}) ⇒ Object
-
#scheduled_interviews(id, options = {}) ⇒ Object
-
#scorecards(id, options = {}) ⇒ Object
-
#sources(id = nil, options = {}) ⇒ Object
-
#stages(id, options = {}) ⇒ Object
-
#users(id = nil, options = {}) ⇒ Object
Methods included from API
#get_response, #parse_json, #post_response
Constructor Details
#initialize(api_token = nil) ⇒ Client
Returns a new instance of Client.
14
15
16
|
# File 'lib/greenhouse_io/api/client.rb', line 14
def initialize(api_token = nil)
@api_token = api_token || GreenhouseIo.configuration.api_token
end
|
Instance Attribute Details
#api_token ⇒ Object
Returns the value of attribute api_token.
11
12
13
|
# File 'lib/greenhouse_io/api/client.rb', line 11
def api_token
@api_token
end
|
#link ⇒ Object
Returns the value of attribute link.
11
12
13
|
# File 'lib/greenhouse_io/api/client.rb', line 11
def link
@link
end
|
#rate_limit ⇒ Object
Returns the value of attribute rate_limit.
11
12
13
|
# File 'lib/greenhouse_io/api/client.rb', line 11
def rate_limit
@rate_limit
end
|
#rate_limit_remaining ⇒ Object
Returns the value of attribute rate_limit_remaining.
11
12
13
|
# File 'lib/greenhouse_io/api/client.rb', line 11
def rate_limit_remaining
@rate_limit_remaining
end
|
Instance Method Details
#activity_feed(id, options = {}) ⇒ Object
34
35
36
|
# File 'lib/greenhouse_io/api/client.rb', line 34
def activity_feed(id, options = {})
get_from_harvest_api "#{BASE_URL}/candidates/#{id}/activity_feed", options
end
|
#all_scorecards(id = nil, options = {}) ⇒ Object
62
63
64
|
# File 'lib/greenhouse_io/api/client.rb', line 62
def all_scorecards(id = nil, options = {})
get_from_harvest_api "#{BASE_URL}/scorecards/#{id}", options
end
|
#applications(id = nil, options = {}) ⇒ Object
46
47
48
|
# File 'lib/greenhouse_io/api/client.rb', line 46
def applications(id = nil, options = {})
get_from_harvest_api "#{BASE_URL}/applications#{path_id(id)}", options
end
|
#candidates(id = nil, options = {}) ⇒ Object
30
31
32
|
# File 'lib/greenhouse_io/api/client.rb', line 30
def candidates(id = nil, options = {})
get_from_harvest_api "#{BASE_URL}/candidates#{path_id(id)}", options, "candidates"
end
|
#create_candidate_note(candidate_id, note_hash, on_behalf_of) ⇒ Object
38
39
40
41
42
43
44
|
# File 'lib/greenhouse_io/api/client.rb', line 38
def create_candidate_note(candidate_id, note_hash, on_behalf_of)
post_to_harvest_api(
"#{BASE_URL}/candidates/#{candidate_id}/activity_feed/notes",
note_hash,
{ 'On-Behalf-Of' => on_behalf_of.to_s }
)
end
|
#current_offer_for_application(id, options = {}) ⇒ Object
54
55
56
|
# File 'lib/greenhouse_io/api/client.rb', line 54
def current_offer_for_application(id, options = {})
get_from_harvest_api "#{BASE_URL}/applications/#{id}/offers/current_offer", options
end
|
#departments(id = nil, options = {}) ⇒ Object
26
27
28
|
# File 'lib/greenhouse_io/api/client.rb', line 26
def departments(id = nil, options = {})
get_from_harvest_api "#{BASE_URL}/departments#{path_id(id)}", options
end
|
#job_post(id, options = {}) ⇒ Object
78
79
80
|
# File 'lib/greenhouse_io/api/client.rb', line 78
def job_post(id, options = {})
get_from_harvest_api "#{BASE_URL}/jobs/#{id}/job_post", options
end
|
#job_posts(options = {}) ⇒ Object
82
83
84
|
# File 'lib/greenhouse_io/api/client.rb', line 82
def job_posts(options = {})
get_from_harvest_api "#{BASE_URL}/job_posts", options
end
|
#jobs(id = nil, options = {}) ⇒ Object
70
71
72
|
# File 'lib/greenhouse_io/api/client.rb', line 70
def jobs(id = nil, options = {})
get_from_harvest_api "#{BASE_URL}/jobs#{path_id(id)}", options
end
|
#offers(id = nil, options = {}) ⇒ Object
22
23
24
|
# File 'lib/greenhouse_io/api/client.rb', line 22
def offers(id = nil, options = {})
get_from_harvest_api "#{BASE_URL}/offers#{path_id(id)}", options, "offers"
end
|
#offers_for_application(id, options = {}) ⇒ Object
50
51
52
|
# File 'lib/greenhouse_io/api/client.rb', line 50
def offers_for_application(id, options = {})
get_from_harvest_api "#{BASE_URL}/applications/#{id}/offers", options
end
|
#offices(id = nil, options = {}) ⇒ Object
18
19
20
|
# File 'lib/greenhouse_io/api/client.rb', line 18
def offices(id = nil, options = {})
get_from_harvest_api "#{BASE_URL}/offices#{path_id(id)}", options
end
|
#scheduled_interviews(id, options = {}) ⇒ Object
66
67
68
|
# File 'lib/greenhouse_io/api/client.rb', line 66
def scheduled_interviews(id, options = {})
get_from_harvest_api "#{BASE_URL}/applications/#{id}/scheduled_interviews", options
end
|
#scorecards(id, options = {}) ⇒ Object
58
59
60
|
# File 'lib/greenhouse_io/api/client.rb', line 58
def scorecards(id, options = {})
get_from_harvest_api "#{BASE_URL}/applications/#{id}/scorecards", options
end
|
#sources(id = nil, options = {}) ⇒ Object
90
91
92
|
# File 'lib/greenhouse_io/api/client.rb', line 90
def sources(id = nil, options = {})
get_from_harvest_api "#{BASE_URL}/sources#{path_id(id)}", options
end
|
#stages(id, options = {}) ⇒ Object
74
75
76
|
# File 'lib/greenhouse_io/api/client.rb', line 74
def stages(id, options = {})
get_from_harvest_api "#{BASE_URL}/jobs/#{id}/stages", options
end
|
#users(id = nil, options = {}) ⇒ Object
86
87
88
|
# File 'lib/greenhouse_io/api/client.rb', line 86
def users(id = nil, options = {})
get_from_harvest_api "#{BASE_URL}/users#{path_id(id)}", options
end
|