Class: GreenhouseIo::JobBoard

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

Constant Summary collapse

BASE_URL =
'https://api.greenhouse.io/v1'

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from API

#get_response, #parse_json, #post_response

Constructor Details

#initialize(api_token = nil, default_options = {}) ⇒ JobBoard

Returns a new instance of JobBoard.



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

def initialize(api_token = nil, default_options = {})
  @api_token = api_token || GreenhouseIo.configuration.api_token
  @organization = default_options.delete(:organization) || GreenhouseIo.configuration.organization
end

Instance Attribute Details

#api_tokenObject

Returns the value of attribute api_token.



4
5
6
# File 'lib/greenhouse_io/api/job_board.rb', line 4

def api_token
  @api_token
end

#organizationObject

Returns the value of attribute organization.



4
5
6
# File 'lib/greenhouse_io/api/job_board.rb', line 4

def organization
  @organization
end

Instance Method Details

#apply_to_job(job_form_hash) ⇒ Object



36
37
38
# File 'lib/greenhouse_io/api/job_board.rb', line 36

def apply_to_job(job_form_hash)
  post_to_job_board_api("#{BASE_URL}/applications", { :body => job_form_hash, :basic_auth => basic_auth })
end

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



24
25
26
# File 'lib/greenhouse_io/api/job_board.rb', line 24

def department(id, options = {})
  get_from_job_board_api("#{BASE_URL}/boards/#{ query_organization(options) }/embed/department", { id: id })
end

#departments(options = {}) ⇒ Object



20
21
22
# File 'lib/greenhouse_io/api/job_board.rb', line 20

def departments(options = {})
  get_from_job_board_api("#{BASE_URL}/boards/#{ query_organization(options) }/embed/departments")
end

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



32
33
34
# File 'lib/greenhouse_io/api/job_board.rb', line 32

def job(id, options = {})
  get_from_job_board_api("#{BASE_URL}/boards/#{ query_organization(options) }/embed/job", { id: id, questions: options[:questions] })
end

#jobs(options = {}) ⇒ Object



28
29
30
# File 'lib/greenhouse_io/api/job_board.rb', line 28

def jobs(options = {})
  get_from_job_board_api("#{BASE_URL}/boards/#{ query_organization(options) }/embed/jobs", { content: options[:content] })
end

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



16
17
18
# File 'lib/greenhouse_io/api/job_board.rb', line 16

def office(id, options = {})
  get_from_job_board_api("#{BASE_URL}/boards/#{ query_organization(options) }/embed/office", { id: id })
end

#offices(options = {}) ⇒ Object



12
13
14
# File 'lib/greenhouse_io/api/job_board.rb', line 12

def offices(options = {})
  get_from_job_board_api("#{BASE_URL}/boards/#{ query_organization(options) }/embed/offices")
end