From 15b1410e97dd25ef28f6a0938f21efbb168f0ad2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Wojsznis?= Date: Mon, 6 Nov 2017 19:49:17 +0100 Subject: [PATCH] Update docs & unify codebase (#13) * Update docs, unify codebase * Bump version * Update travis config * Specify jruby version, skip 2.5 --- .travis.yml | 9 ++++----- CHANGELOG.md | 6 ++++++ README.md | 11 +++++++++++ lib/workable/client.rb | 38 +++++++++++++++++++------------------- lib/workable/version.rb | 2 +- 5 files changed, 41 insertions(+), 25 deletions(-) diff --git a/.travis.yml b/.travis.yml index 646f9ed..c3298c5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,11 +4,10 @@ cache: bundler rvm: - 2.1.10 - - 2.2.7 - - 2.3.4 - - 2.4.1 - - jruby-head - - ruby-head + - 2.2.8 + - 2.3.5 + - 2.4.2 + - jruby-9.1.6.0 # https://github.com/travis-ci/travis-ci/issues/5861 before_install: diff --git a/CHANGELOG.md b/CHANGELOG.md index 89f9966..562c834 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 2.2.0 + +Date: 2017-11-09 + +- manage candidates endpoints support [#12](https://github.com/emq/workable/pull/12) (@aquateen) + ## 2.1.0 Date: 2017-06-19 diff --git a/README.md b/README.md index 497008f..93ff907 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,8 @@ shortcode = client.jobs.first["shortcode"] client.stages # => Array of hashes client.recruiters # => Array of hashes +client.members # => Array of hashes + client.job_details(shortcode) # => Hash client.job_questions(shortcode) # => Array of hashes client.job_application_form(shortcode) # => Hash @@ -68,6 +70,15 @@ client.job_candidates(shortcode, :stage => stage_slug, :limit => 100) # => Array client.create_job_candidate(candidate, shortcode, stage_slug) # => Hash (stage_slug is optional) +# managing candidates +client.disqualify(candidate_id, member_id, reason) +client.revert(candidate_id, member_id) # reverts disqualification +client.copy(candidate_id, member_id, shortcode, stage) +client.relocate(candidate_id, member_id, shortcode, stage) +client.move(candidate_id, member_id, stage) +client.create_rating(candidate_id, member_id, comment, score) +client.create_comment(candidate_id, member_id, comment_text, attachment) + # Possible errors (each one inherits from Workable::Errors::WorkableError) Workable::Errors::InvalidConfiguration # missing api_key / subdomain Workable::Errors::NotAuthorized # wrong api key diff --git a/lib/workable/client.rb b/lib/workable/client.rb index 6204c80..52b7e38 100644 --- a/lib/workable/client.rb +++ b/lib/workable/client.rb @@ -134,46 +134,46 @@ def create_job_candidate(candidate, shortcode, stage_slug = nil) end # create a comment on the candidate's timeline - # @param candidate_id [Number|String] the candidate's id - # @param member_id [Number|String] id of the member leaving the comment + # @param candidate_id [String] the candidate's id + # @param member_id [String] id of the member leaving the comment # @param comment_text [String] the comment's text # @param policy [String] option to set the view rights of the comment # @param attachment [Hash] optional attachment for the comment # @param attachment :name [String] filename of the attachment # @param attachment :data [String] payload of the attachment, encoded in base64 - def create_comment(candidate_id, member_id, comment_text, policy=[], attachment=nil) + def create_comment(candidate_id, member_id, comment_text, policy = [], attachment = nil) comment = { body: comment_text, policy: policy, attachment: attachment } post_request("candidates/#{candidate_id}/comments") do |request| - request.body = {member_id: member_id.to_s, comment: comment}.to_json + request.body = { member_id: member_id, comment: comment }.to_json end end # disqualify a candidate - # @param candidate_id [Number|String] the candidate's id - # @param member_id [Number|String] id of the member performing the disqualification + # @param candidate_id [String] the candidate's id + # @param member_id [String] id of the member performing the disqualification # @param reason [String] why the candidate should be disqualified - def disqualify(candidate_id, member_id, reason=nil) + def disqualify(candidate_id, member_id, reason = nil) post_request("candidates/#{candidate_id}/disqualify") do |request| - request.body = {member_id: member_id.to_s, disqualification_reason: reason}.to_json + request.body = { member_id: member_id, disqualification_reason: reason }.to_json end end # revert a candidate's disqualification - # @param candidate_id [Number|String] the candidate's id - # @param member_id [Number|String] id of the member reverting the disqualification + # @param candidate_id [String] the candidate's id + # @param member_id [String] id of the member reverting the disqualification def revert(candidate_id, member_id) post_request("candidates/#{candidate_id}/revert") do |request| - request.body = {member_id: member_id.to_s}.to_json + request.body = { member_id: member_id }.to_json end end # copy a candidate to another job - # @param candidate_id [Number|String] the candidate's id - # @param member_id [Number|String] id of the member performing the copy + # @param candidate_id [String] the candidate's id + # @param member_id [String] id of the member performing the copy # @param shortcode [String] shortcode of the job that the candidate will be copied to # @param stage [String] stage the candidate should be copied to - def copy(candidate_id, member_id, shortcode, stage=nil) + def copy(candidate_id, member_id, shortcode, stage = nil) body = { member_id: member_id, target_job_shortcode: shortcode, @@ -192,7 +192,7 @@ def copy(candidate_id, member_id, shortcode, stage=nil) # @param member_id [Number|String] id of the member performing the relocation # @param shortcode [String] shortcode of the job that the candidate will be moved to # @param stage [String] stage the candidate should be moved to - def relocate(candidate_id, member_id, shortcode, stage=nil) + def relocate(candidate_id, member_id, shortcode, stage = nil) body = { member_id: member_id, target_job_shortcode: shortcode, @@ -207,8 +207,8 @@ def relocate(candidate_id, member_id, shortcode, stage=nil) end # moves a candidate to another stage - # @param candidate_id [Number|String] the candidate's id - # @param member_id [Number|String] id of the member performing the move + # @param candidate_id [String] the candidate's id + # @param member_id [String] id of the member performing the move # @param stage [String] stage the candidate should be moved to def move(candidate_id, member_id, stage) post_request("candidates/#{candidate_id}/move") do |request| @@ -217,8 +217,8 @@ def move(candidate_id, member_id, stage) end # creates a rating for a candidate - # @param candidate_id [Number|String] the candidate's id - # @param member_id [Number|String] id of the member adding the rating + # @param candidate_id [String] the candidate's id + # @param member_id [String] id of the member adding the rating # @param comment [String] a comment about the scoring of the candidate # @param score [String] one of 'negative', 'positive', or 'definitely' def create_rating(candidate_id, member_id, comment, score) diff --git a/lib/workable/version.rb b/lib/workable/version.rb index 23b1c50..bec5915 100644 --- a/lib/workable/version.rb +++ b/lib/workable/version.rb @@ -1,3 +1,3 @@ module Workable - VERSION = '2.1.0' + VERSION = '2.2.0' end