Class: Workable::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/workable/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



3
4
5
6
# File 'lib/workable/client.rb', line 3

def initialize(options = {})
  @api_key   = options.fetch(:api_key)   { fail Errors::InvalidConfiguration, "Missing api_key argument"   }
  @subdomain = options.fetch(:subdomain) { fail Errors::InvalidConfiguration, "Missing subdomain argument" }
end

Instance Method Details

#job_candidates(shortcode, stage_slug = nil) ⇒ Object



18
19
20
21
# File 'lib/workable/client.rb', line 18

def job_candidates(shortcode, stage_slug = nil)
  shortcode = "#{shortcode}/#{stage_slug}" unless stage_slug.nil?
  get_request("jobs/#{shortcode}/candidates")['candidates']
end

#job_details(shortcode) ⇒ Object



14
15
16
# File 'lib/workable/client.rb', line 14

def job_details(shortcode)
  Job.new(get_request"jobs/#{shortcode}")
end

#job_questions(shortcode) ⇒ Object



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

def job_questions(shortcode)
  get_request("jobs/#{shortcode}/questions")['questions']
end

#jobs(type = 'published') ⇒ Object



8
9
10
11
12
# File 'lib/workable/client.rb', line 8

def jobs(type = 'published')
  get_request("jobs?phase=#{type}")['jobs'].map do |params|
    Job.new(params)
  end
end

#stagesObject



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

def stages
  get_request("stages")['stages']
end