Class: Workable::Client
- Inherits:
-
Object
- Object
- Workable::Client
- Defined in:
- lib/workable/client.rb
Instance Method Summary collapse
-
#create_job_candidate(candidate, shortcode, stage_slug = nil) ⇒ Hash
create new candidate for given job.
-
#initialize(options = {}) ⇒ Client
constructor
set access to workable and data transformation methods.
-
#job_candidates(shortcode, options = {}) ⇒ Object
list candidates for given job.
-
#job_details(shortcode) ⇒ Object
request detailed information about job.
-
#job_questions(shortcode) ⇒ Object
list of questions for job.
-
#jobs(type = 'published') ⇒ Object
request jobs of given type.
-
#recruiters ⇒ Object
list of external recruiters for company.
-
#stages ⇒ Object
list of stages defined for company.
Constructor Details
#initialize(options = {}) ⇒ Client
set access to workable and data transformation methods
31 32 33 34 35 36 |
# File 'lib/workable/client.rb', line 31 def initialize( = {}) @api_key = .fetch(:api_key) { fail Errors::InvalidConfiguration, "Missing api_key argument" } @subdomain = .fetch(:subdomain) { fail Errors::InvalidConfiguration, "Missing subdomain argument" } @transform_to = [:transform_to] || {} @transform_from = [:transform_from] || {} end |
Instance Method Details
#create_job_candidate(candidate, shortcode, stage_slug = nil) ⇒ Hash
create new candidate for given job
73 74 75 76 |
# File 'lib/workable/client.rb', line 73 def create_job_candidate(candidate, shortcode, stage_slug = nil) shortcode = "#{shortcode}/#{stage_slug}" unless stage_slug.nil? transform_to(:candidate, post_request("jobs/#{shortcode}/candidates", candidate)["candidate"]) end |
#job_candidates(shortcode, options = {}) ⇒ Object
list candidates for given job
55 56 57 58 |
# File 'lib/workable/client.rb', line 55 def job_candidates(shortcode, = {}) url = build_job_candidates_url(shortcode, ) transform_to(:candidate, get_request(url)['candidates']) end |
#job_details(shortcode) ⇒ Object
request detailed information about job
46 47 48 |
# File 'lib/workable/client.rb', line 46 def job_details(shortcode) transform_to(:job, get_request("jobs/#{shortcode}")) end |
#job_questions(shortcode) ⇒ Object
list of questions for job
62 63 64 |
# File 'lib/workable/client.rb', line 62 def job_questions(shortcode) transform_to(:question, get_request("jobs/#{shortcode}/questions")['questions']) end |
#jobs(type = 'published') ⇒ Object
request jobs of given type
40 41 42 |
# File 'lib/workable/client.rb', line 40 def jobs(type = 'published') transform_to(:job, get_request("jobs?phase=#{type}")['jobs']) end |
#recruiters ⇒ Object
list of external recruiters for company
84 85 86 |
# File 'lib/workable/client.rb', line 84 def recruiters transform_to(:stage, get_request("recruiters")['recruiters']) end |
#stages ⇒ Object
list of stages defined for company
79 80 81 |
# File 'lib/workable/client.rb', line 79 def stages transform_to(:stage, get_request("stages")['stages']) end |