Skip to content

Commit

Permalink
Update docs & unify codebase (#13)
Browse files Browse the repository at this point in the history
* Update docs, unify codebase

* Bump version

* Update travis config

* Specify jruby version, skip 2.5
  • Loading branch information
rwojsznis authored Nov 6, 2017
1 parent 9d18e68 commit 15b1410
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 25 deletions.
9 changes: 4 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
38 changes: 19 additions & 19 deletions lib/workable/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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|
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lib/workable/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Workable
VERSION = '2.1.0'
VERSION = '2.2.0'
end

0 comments on commit 15b1410

Please sign in to comment.