Class: GreenhouseIo::Client

Inherits:
Object
  • Object
show all
Includes:
API, HTTMultiParty
Defined in:
lib/greenhouse_io/api/client.rb

Constant Summary collapse

PERMITTED_OPTIONS =
[:page, :per_page, :job_id]

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from API

#basic_auth, #get_response, #parse_json, #post_response

Constructor Details

#initialize(api_token = nil) ⇒ Client

Returns a new instance of Client.



11
12
13
# File 'lib/greenhouse_io/api/client.rb', line 11

def initialize(api_token = nil)
  @api_token = api_token || GreenhouseIo.configuration.api_token
end

Instance Attribute Details

#api_tokenObject

Returns the value of attribute api_token.



8
9
10
# File 'lib/greenhouse_io/api/client.rb', line 8

def api_token
  @api_token
end

Returns the value of attribute link.



8
9
10
# File 'lib/greenhouse_io/api/client.rb', line 8

def link
  @link
end

#rate_limitObject

Returns the value of attribute rate_limit.



8
9
10
# File 'lib/greenhouse_io/api/client.rb', line 8

def rate_limit
  @rate_limit
end

#rate_limit_remainingObject

Returns the value of attribute rate_limit_remaining.



8
9
10
# File 'lib/greenhouse_io/api/client.rb', line 8

def rate_limit_remaining
  @rate_limit_remaining
end

Instance Method Details

#activity_feed(id, options = {}) ⇒ Object



31
32
33
# File 'lib/greenhouse_io/api/client.rb', line 31

def activity_feed(id, options = {})
  get_from_harvest_api "/candidates/#{id}/activity_feed", options
end

#all_scorecards(id = nil, options = {}) ⇒ Object



51
52
53
# File 'lib/greenhouse_io/api/client.rb', line 51

def all_scorecards(id = nil, options = {})
  get_from_harvest_api "/scorecards/#{id}", options
end

#applications(id = nil, options = {}) ⇒ Object



43
44
45
# File 'lib/greenhouse_io/api/client.rb', line 43

def applications(id = nil, options = {})
  get_from_harvest_api "/applications#{path_id(id)}", options
end

#candidates(id = nil, options = {}) ⇒ Object



27
28
29
# File 'lib/greenhouse_io/api/client.rb', line 27

def candidates(id = nil, options = {})
  get_from_harvest_api "/candidates#{path_id(id)}", options
end

#create_candidate_note(candidate_id, note_hash, on_behalf_of) ⇒ Object



35
36
37
38
39
40
41
# File 'lib/greenhouse_io/api/client.rb', line 35

def create_candidate_note(candidate_id, note_hash, on_behalf_of)
  post_to_harvest_api(
    "/candidates/#{candidate_id}/activity_feed/notes",
    note_hash,
    { 'On-Behalf-Of' => on_behalf_of.to_s }
  )
end

#departments(id = nil, options = {}) ⇒ Object



23
24
25
# File 'lib/greenhouse_io/api/client.rb', line 23

def departments(id = nil, options = {})
  get_from_harvest_api "/departments#{path_id(id)}", options
end

#job_post(id, options = {}) ⇒ Object



67
68
69
# File 'lib/greenhouse_io/api/client.rb', line 67

def job_post(id, options = {})
  get_from_harvest_api "/jobs/#{id}/job_post", options
end

#jobs(id = nil, options = {}) ⇒ Object



59
60
61
# File 'lib/greenhouse_io/api/client.rb', line 59

def jobs(id = nil, options = {})
  get_from_harvest_api "/jobs#{path_id(id)}", options
end

#offers(id = nil, options = {}) ⇒ Object



19
20
21
# File 'lib/greenhouse_io/api/client.rb', line 19

def offers(id = nil, options = {})
  get_from_harvest_api "/offers#{path_id(id)}", options
end

#offices(id = nil, options = {}) ⇒ Object



15
16
17
# File 'lib/greenhouse_io/api/client.rb', line 15

def offices(id = nil, options = {})
  get_from_harvest_api "/offices#{path_id(id)}", options
end

#scheduled_interviews(id, options = {}) ⇒ Object



55
56
57
# File 'lib/greenhouse_io/api/client.rb', line 55

def scheduled_interviews(id, options = {})
  get_from_harvest_api "/applications/#{id}/scheduled_interviews", options
end

#scorecards(id, options = {}) ⇒ Object



47
48
49
# File 'lib/greenhouse_io/api/client.rb', line 47

def scorecards(id, options = {})
  get_from_harvest_api "/applications/#{id}/scorecards", options
end

#sources(id = nil, options = {}) ⇒ Object



75
76
77
# File 'lib/greenhouse_io/api/client.rb', line 75

def sources(id = nil, options = {})
  get_from_harvest_api "/sources#{path_id(id)}", options
end

#stages(id, options = {}) ⇒ Object



63
64
65
# File 'lib/greenhouse_io/api/client.rb', line 63

def stages(id, options = {})
  get_from_harvest_api "/jobs/#{id}/stages", options
end

#users(id = nil, options = {}) ⇒ Object



71
72
73
# File 'lib/greenhouse_io/api/client.rb', line 71

def users(id = nil, options = {})
  get_from_harvest_api "/users#{path_id(id)}", options
end