diff --git a/CHANGELOG.md b/CHANGELOG.md index 551844a..31229ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ ### New Features +* [#62](https://github.com/Skookum/bamboozled/issues/62): Add applicant tracking API interface ([@danhealy][]) + ### Changes ### Bug Fixes @@ -46,3 +48,4 @@ [@chrisman]: https://github.com/chrisman [@ivanovv]: https://github.com/ivanovv [@nlively]: https://github.com/nlively +[@danhealy]: https://github.com/danhealy diff --git a/README.md b/README.md index e36afe8..9ea9a24 100644 --- a/README.md +++ b/README.md @@ -136,6 +136,31 @@ client.report.custom(fields, format = "JSON") client.report.find(report_number, format = "JSON", fd = true) ``` +### Applicant Tracking System +The ATS API is currently in **beta**. Please note that BambooHR may make breaking changes without +warning. Refer to the [documentation](https://www.bamboohr.com/api/documentation/ats.php) for +details. + +```ruby +# Get a list of job summaries +client.applicant_tracking.job_summaries + +# Get a list of applications, following pagination +client.applicant_tracking.applications(page_limit: 10) + +# Get the details of an application +client.applicant_tracking.application(123) + +# Add comments to an application +client.applicant_tracking.add_comment(123, "Great Application!") + +# Get a list of statuses for a company +client.applicant_tracking.statuses + +# Change applicant's status +client.applicant_tracking.change_status(123, 3) +``` + ### Metadata ```ruby diff --git a/lib/bamboozled.rb b/lib/bamboozled.rb index 2b72948..7bd5077 100644 --- a/lib/bamboozled.rb +++ b/lib/bamboozled.rb @@ -8,6 +8,7 @@ require "bamboozled/ext/yesno" require "bamboozled/api/base" require "bamboozled/api/field_collection" +require "bamboozled/api/applicant_tracking" require "bamboozled/api/employee" require "bamboozled/api/report" require "bamboozled/api/time_off" diff --git a/lib/bamboozled/api/applicant_tracking.rb b/lib/bamboozled/api/applicant_tracking.rb new file mode 100644 index 0000000..b0fb44b --- /dev/null +++ b/lib/bamboozled/api/applicant_tracking.rb @@ -0,0 +1,77 @@ +# Implement endpoints for Bamboo HR's Applicant Tracking System +# https://www.bamboohr.com/api/documentation/ats.php +module Bamboozled + module API + class ApplicantTracking < Base + APPLICATION_STATUS_GROUPS = %w[ALL ALL_ACTIVE NEW ACTIVE INACTIVE HIRED].freeze + + JOB_STATUS_GROUPS = [ + "ALL", "DRAFT_AND_OPEN", "Open", "Filled", "Draft", "Deleted", "On Hold", "Canceled" + ].freeze + + # Get a list of job summaries -- GET /jobs + def job_summaries(params = {}) # rubocop:disable Style/OptionHash + query = { + "statusGroups": "ALL", # JOB_STATUS_GROUPS + "sortBy": "created", # "count", "title", "lead", "created", "status" + "sortOrder": "ASC" # "ASC", "DESC" + }.merge(params) + + request(:get, "applicant_tracking/jobs", query: query) + end + + # Get a list of applications, following pagination -- GET /applications + def applications(params = {}) # rubocop:disable Style/OptionHash + page_limit = params.delete(:page_limit) { 1 } + + applications_array = [] + 1.upto page_limit do |i| + response = request_applications(params.merge(page: i)) + applications_array += response["applications"] + break if response["paginationComplete"] + end + applications_array + end + + # Get the details of an application -- GET /applications/:id + def application(applicant_id) + request(:get, "applicant_tracking/applications/#{applicant_id}") + end + + # Add comments to an application -- POST /applications/:id/comments + def add_comment(applicant_id, comment) + details = { type: "comment", comment: comment }.to_json + options = { body: details, headers: { "Content-Type" => "application/json" } } + + request(:post, "applicant_tracking/applications/#{applicant_id}/comments", options) + end + + # Get a list of statuses for a company -- GET /statuses + def statuses + request(:get, "applicant_tracking/statuses") + end + + # Change applicant's status -- POST /applications/:id/status + def change_status(applicant_id, status_id) + details = { status: status_id.to_i }.to_json + options = { body: details, headers: { "Content-Type" => "application/json" } } + + request(:post, "applicant_tracking/applications/#{applicant_id}/status", options) + end + + protected + + def request_applications(params = {}) # rubocop:disable Style/OptionHash + # Also supported: + # page, jobId, applicationStatusId, applicationStatus (APPLICATION_STATUS_GROUPS), + # jobStatusGroups (JOB_STATUS_GROUPS), searchString + query = { + "sortBy": "created_date", # "first_name", "job_title", "rating", "phone", "status", "last_updated", "created_date" + "sortOrder": "ASC" # "ASC", "DESC" + }.merge(params) + + request(:get, "applicant_tracking/applications", query: query) + end + end + end +end diff --git a/lib/bamboozled/base.rb b/lib/bamboozled/base.rb index 231ff84..edc52b7 100644 --- a/lib/bamboozled/base.rb +++ b/lib/bamboozled/base.rb @@ -27,5 +27,9 @@ def time_off def time_tracking @time_tracking ||= Bamboozled::API::TimeTracking.new(@subdomain, @api_key, @httparty_options) end + + def applicant_tracking + @applicant_tracking ||= Bamboozled::API::ApplicantTracking.new(@subdomain, @api_key, @httparty_options) + end end end diff --git a/spec/fixtures/applicant_statuses.json b/spec/fixtures/applicant_statuses.json new file mode 100644 index 0000000..334c34a --- /dev/null +++ b/spec/fixtures/applicant_statuses.json @@ -0,0 +1,177 @@ +HTTP/1.1 200 OK +content-type: application/json; charset=utf-8 +date: Tue, 28 May 2019 19:25:35 UTC + +[ + { + "code": "NEW", + "description": null, + "enabled": true, + "id": "1", + "manageable": false, + "name": "New", + "translatedName": "New" + }, + { + "code": "REVIEWED", + "description": null, + "enabled": true, + "id": "2", + "manageable": false, + "name": "Reviewed", + "translatedName": "Reviewed" + }, + { + "code": "SCHEDPHONE", + "description": null, + "enabled": true, + "id": "3", + "manageable": false, + "name": "Schedule Phone Screen", + "translatedName": "Schedule Phone Screen" + }, + { + "code": "PHONED", + "description": null, + "enabled": true, + "id": "4", + "manageable": false, + "name": "Phone Screened", + "translatedName": "Phone Screened" + }, + { + "code": "SCHEDINT", + "description": null, + "enabled": true, + "id": "5", + "manageable": false, + "name": "Schedule Interview", + "translatedName": "Schedule Interview" + }, + { + "code": "INTERVIEW", + "description": null, + "enabled": true, + "id": "6", + "manageable": false, + "name": "Interviewed", + "translatedName": "Interviewed" + }, + { + "code": "ONHOLD", + "description": null, + "enabled": true, + "id": "7", + "manageable": false, + "name": "Put on Hold", + "translatedName": "Put on Hold" + }, + { + "code": "REFCHECK", + "description": null, + "enabled": true, + "id": "8", + "manageable": false, + "name": "Checking References", + "translatedName": "Checking References" + }, + { + "code": "OFFER", + "description": null, + "enabled": false, + "id": "9", + "manageable": false, + "name": "Made an Offer", + "translatedName": "Made an Offer" + }, + { + "code": "NOFIT", + "description": null, + "enabled": true, + "id": "10", + "manageable": false, + "name": "Not a Fit", + "translatedName": "Not a Fit" + }, + { + "code": "DECLINED", + "description": null, + "enabled": true, + "id": "11", + "manageable": false, + "name": "Declined Offer", + "translatedName": "Declined Offer" + }, + { + "code": "NOQUAL", + "description": null, + "enabled": true, + "id": "12", + "manageable": false, + "name": "Not Qualified", + "translatedName": "Not Qualified" + }, + { + "code": "OVERQUAL", + "description": null, + "enabled": true, + "id": "13", + "manageable": false, + "name": "Over Qualified", + "translatedName": "Over Qualified" + }, + { + "code": "POACHED", + "description": null, + "enabled": true, + "id": "14", + "manageable": false, + "name": "Hired Elsewhere", + "translatedName": "Hired Elsewhere" + }, + { + "code": "HIRED", + "description": null, + "enabled": true, + "id": "15", + "manageable": false, + "name": "Hired", + "translatedName": "Hired" + }, + { + "code": "OLSENT", + "description": null, + "enabled": true, + "id": "16", + "manageable": false, + "name": "Offer Sent", + "translatedName": "Offer Sent" + }, + { + "code": "OLSIGNED", + "description": null, + "enabled": true, + "id": "17", + "manageable": false, + "name": "Offer Signed", + "translatedName": "Offer Signed" + }, + { + "code": "DELETED", + "description": null, + "enabled": false, + "id": "18", + "manageable": false, + "name": "Deleted", + "translatedName": "Deleted" + }, + { + "code": "MOVED", + "description": null, + "enabled": false, + "id": "19", + "manageable": false, + "name": "Moved", + "translatedName": "Moved" + } +] diff --git a/spec/fixtures/application.json b/spec/fixtures/application.json new file mode 100644 index 0000000..6809e64 --- /dev/null +++ b/spec/fixtures/application.json @@ -0,0 +1,106 @@ +HTTP/1.1 200 OK +content-type: application/json; charset=utf-8 +date: Tue, 28 May 2019 19:25:35 UTC + +{ + "id": 33, + "appliedDate": "2019-02-05T21:03:16+00:00", + "status": { + "id": 5, + "label": "Schedule Interview", + "dateChanged": "2019-02-11T19:25:03+00:00", + "changedByUser": { + "id": 2388, + "firstName": "Ashley", + "lastName": "Adams", + "avatar": "https://d5a0f4a55e0f8389d6c9-937e97f4c2c35ce54def04e9eaa5f869.ssl.cf1.rackcdn.com/photos/5-0-3.jpg", + "jobTitle": { + "id": 18236, + "label": "HR Administrator" + } + } + }, + "rating": 5, + "resumeFileId": 177, + "coverLetterFileId": null, + "movedTo": null, + "movedFrom": null, + "alsoConsideredForCount": 0, + "duplicateApplicationCount": 0, + "referredBy": null, + "desiredSalary": "₤85,000", + "commentCount": 2, + "emailCount": 3, + "eventCount": 4, + "questionsAndAnswers": [ + { + "question": { + "id": 36, + "label": "References (Name, Company, and Contact Info)" + }, + "answer": { + "id": 146, + "label": "Paul Clayton\r\nDirector of Digital Security\r\nSoftware Company\r\nDirectorofsecurity@efficientoffice.com\r\n+44 20 5555 0920\r\n\r\nJanet Allen\r\nSystems Administrator\r\nABC Corporation\r\nsecuritymanager@efficientoffice.com\r\n+44 20 5555 1233 " + } + }, + { + "question": { + "id": 37, + "label": "How did you hear about this position?" + }, + "answer": { + "id": 147, + "label": "My friend told me to apply to this position." + } + }, + { + "question": { + "id": 41, + "label": "Who referred you to this position?" + }, + "answer": { + "id": 148, + "label": "Ashley Adams" + } + } + ], + "applicationReferences": null, + "applicant": { + "email": "nathan@efficientoffice.com", + "phoneNumber": "+44 20 5555 2023", + "address": { + "addressLine1": "33 Bothwell St", + "addressLine2": null, + "city": null, + "state": "Glasgow City", + "zipcode": "G2 6AU", + "country": "United Kingdom" + }, + "linkedinUrl": "http://www.linkedin.com", + "twitterUsername": null, + "websiteUrl": "http://www.blogger.com", + "availableStartDate": "2019-02-15", + "education": null, + "id": 95, + "firstName": "Nathan", + "lastName": "Rose", + "avatar": null + }, + "job": { + "hiringLead": { + "employeeId": 12, + "firstName": "Eric", + "lastName": "Pasture", + "avatar": "https://d5a0f4a55e0f8389d6c9-937e97f4c2c35ce54def04e9eaa5f869.ssl.cf1.rackcdn.com/photos/12-0-4.jpg", + "jobTitle": { + "id": 18318, + "label": "VP of IT" + } + }, + "id": 15, + "title": { + "id": null, + "label": "IT Security Engineer" + } + } +} diff --git a/spec/fixtures/application_comment.json b/spec/fixtures/application_comment.json new file mode 100644 index 0000000..d218dee --- /dev/null +++ b/spec/fixtures/application_comment.json @@ -0,0 +1,8 @@ +HTTP/1.1 200 OK +content-type: application/json; charset=utf-8 +date: Tue, 28 May 2019 19:25:35 UTC + +{ + "type": "comment", + "id": 28 +} diff --git a/spec/fixtures/applications.json b/spec/fixtures/applications.json new file mode 100644 index 0000000..d4a5adf --- /dev/null +++ b/spec/fixtures/applications.json @@ -0,0 +1,309 @@ +HTTP/1.1 200 OK +content-type: application/json; charset=utf-8 +date: Tue, 28 May 2019 19:25:35 UTC + +{ + "paginationComplete": true, + "applications": [ + { + "id": 33, + "appliedDate": "2019-02-05T21:03:16+00:00", + "status": { + "id": 5, + "label": "Schedule Interview" + }, + "rating": 5, + "applicant": { + "id": 95, + "firstName": "Nathan", + "lastName": "Rose", + "avatar": "https://resources.bamboohr.com/employees/photos/initials.php?initials=NR", + "email": "nathan@efficientoffice.com" + }, + "job": { + "id": 15, + "title": { + "id": null, + "label": "IT Security Engineer" + } + } + }, + { + "id": 32, + "appliedDate": "2019-02-05T21:00:30+00:00", + "status": { + "id": 4, + "label": "Phone Screened" + }, + "rating": null, + "applicant": { + "id": 94, + "firstName": "Jodi", + "lastName": "Edwards", + "avatar": "https://resources.bamboohr.com/employees/photos/initials.php?initials=JE", + "email": "jodi@efficientoffice.com" + }, + "job": { + "id": 15, + "title": { + "id": null, + "label": "IT Security Engineer" + } + } + }, + { + "id": 31, + "appliedDate": "2019-02-05T20:57:10+00:00", + "status": { + "id": 2, + "label": "Reviewed" + }, + "rating": 5, + "applicant": { + "id": 93, + "firstName": "Jacob", + "lastName": "Parks", + "avatar": "https://resources.bamboohr.com/employees/photos/initials.php?initials=JP", + "email": "jacob@efficientoffice.com" + }, + "job": { + "id": 15, + "title": { + "id": null, + "label": "IT Security Engineer" + } + } + }, + { + "id": 30, + "appliedDate": "2019-02-05T20:53:05+00:00", + "status": { + "id": 2, + "label": "Reviewed" + }, + "rating": 4, + "applicant": { + "id": 92, + "firstName": "Fred", + "lastName": "Hunt", + "avatar": "https://resources.bamboohr.com/employees/photos/initials.php?initials=FH", + "email": "fred@efficientoffice.com" + }, + "job": { + "id": 15, + "title": { + "id": null, + "label": "IT Security Engineer" + } + } + }, + { + "id": 29, + "appliedDate": "2019-01-27T17:00:05+00:00", + "status": { + "id": 16, + "label": "Offer Sent" + }, + "rating": 5, + "applicant": { + "id": 91, + "firstName": "Cora", + "lastName": "Parsons", + "avatar": "https://resources.bamboohr.com/employees/photos/initials.php?initials=CP", + "email": "cora@efficientoffice.com" + }, + "job": { + "id": 17, + "title": { + "id": null, + "label": "Account Executive" + } + } + }, + { + "id": 28, + "appliedDate": "2019-01-27T16:58:25+00:00", + "status": { + "id": 1, + "label": "New" + }, + "rating": null, + "applicant": { + "id": 90, + "firstName": "Craig", + "lastName": "Douglas", + "avatar": "https://resources.bamboohr.com/employees/photos/initials.php?initials=CD", + "email": "craig@efficientoffice.com" + }, + "job": { + "id": 17, + "title": { + "id": null, + "label": "Account Executive" + } + } + }, + { + "id": 27, + "appliedDate": "2019-01-27T16:56:49+00:00", + "status": { + "id": 1, + "label": "New" + }, + "rating": null, + "applicant": { + "id": 89, + "firstName": "Lloyd", + "lastName": "Cruz", + "avatar": "https://resources.bamboohr.com/employees/photos/initials.php?initials=LC", + "email": "lloyd@efficientoffice.com" + }, + "job": { + "id": 17, + "title": { + "id": null, + "label": "Account Executive" + } + } + }, + { + "id": 26, + "appliedDate": "2019-01-27T16:55:04+00:00", + "status": { + "id": 1, + "label": "New" + }, + "rating": null, + "applicant": { + "id": 88, + "firstName": "Jamie", + "lastName": "Graves", + "avatar": "https://resources.bamboohr.com/employees/photos/initials.php?initials=JG", + "email": "jamie@efficientoffice.com" + }, + "job": { + "id": 17, + "title": { + "id": null, + "label": "Account Executive" + } + } + }, + { + "id": 25, + "appliedDate": "2019-01-27T16:49:36+00:00", + "status": { + "id": 16, + "label": "Offer Sent" + }, + "rating": 4, + "applicant": { + "id": 87, + "firstName": "Katrina", + "lastName": "Cox", + "avatar": "https://resources.bamboohr.com/employees/photos/initials.php?initials=KC", + "email": "katrina@efficientoffice.com" + }, + "job": { + "id": 20, + "title": { + "id": null, + "label": "Software Engineer" + } + } + }, + { + "id": 23, + "appliedDate": "2019-01-27T16:45:46+00:00", + "status": { + "id": 1, + "label": "New" + }, + "rating": 5, + "applicant": { + "id": 85, + "firstName": "Gene", + "lastName": "Owen", + "avatar": "https://resources.bamboohr.com/employees/photos/initials.php?initials=GO", + "email": "gene@efficientoffice.com" + }, + "job": { + "id": 20, + "title": { + "id": null, + "label": "Software Engineer" + } + } + }, + { + "id": 22, + "appliedDate": "2019-01-27T16:41:33+00:00", + "status": { + "id": 7, + "label": "Put on Hold" + }, + "rating": 2, + "applicant": { + "id": 84, + "firstName": "Frank", + "lastName": "Baldwin", + "avatar": "https://resources.bamboohr.com/employees/photos/initials.php?initials=FB", + "email": "frank@efficientoffice.com" + }, + "job": { + "id": 20, + "title": { + "id": null, + "label": "Software Engineer" + } + } + }, + { + "id": 21, + "appliedDate": "2019-01-27T16:39:10+00:00", + "status": { + "id": 8, + "label": "Checking References" + }, + "rating": 5, + "applicant": { + "id": 83, + "firstName": "Janice", + "lastName": "Hall", + "avatar": "https://resources.bamboohr.com/employees/photos/initials.php?initials=JH", + "email": "Janice@efficientoffice.com" + }, + "job": { + "id": 20, + "title": { + "id": null, + "label": "Software Engineer" + } + } + }, + { + "id": 20, + "appliedDate": "2019-01-27T16:37:35+00:00", + "status": { + "id": 3, + "label": "Schedule Phone Screen" + }, + "rating": 4, + "applicant": { + "id": 82, + "firstName": "Kimberly", + "lastName": "Hughes", + "avatar": "https://resources.bamboohr.com/employees/photos/initials.php?initials=KH", + "email": "kimberly@efficientoffice.com" + }, + "job": { + "id": 20, + "title": { + "id": null, + "label": "Software Engineer" + } + } + } + ], + "nextPageUrl": null +} diff --git a/spec/fixtures/change_applicant_status.json b/spec/fixtures/change_applicant_status.json new file mode 100644 index 0000000..f7a6752 --- /dev/null +++ b/spec/fixtures/change_applicant_status.json @@ -0,0 +1,8 @@ +HTTP/1.1 200 OK +content-type: application/json; charset=utf-8 +date: Tue, 28 May 2019 19:25:35 UTC + +{ + "type": "positionApplicantStatus", + "id": 254 +} diff --git a/spec/fixtures/job_summaries.json b/spec/fixtures/job_summaries.json new file mode 100644 index 0000000..2169396 --- /dev/null +++ b/spec/fixtures/job_summaries.json @@ -0,0 +1,131 @@ +HTTP/1.1 200 OK +content-type: application/json; charset=utf-8 +date: Tue, 28 May 2019 19:25:35 UTC + +[ + { + "postedDate": "2019-01-27T16:21:08+00:00", + "location": { + "id": 18240, + "label": "Sydney, New South Wales", + "address": null + }, + "department": { + "id": 18264, + "label": "Product" + }, + "status": { + "id": 1, + "label": "Open" + }, + "newApplicantsCount": 1, + "activeApplicantsCount": 5, + "totalApplicantsCount": 6, + "postingUrl": "https://x.bamboohr.com/jobs/view.php?id=20", + "id": 20, + "title": { + "id": null, + "label": "Software Engineer" + } + }, + { + "postedDate": "2019-05-28T17:10:57+00:00", + "location": { + "id": 18235, + "label": "Lindon, Utah", + "address": null + }, + "department": { + "id": 18234, + "label": "Human Resources" + }, + "status": { + "id": 2, + "label": "Draft" + }, + "newApplicantsCount": 0, + "activeApplicantsCount": 0, + "totalApplicantsCount": 0, + "postingUrl": "https://x.bamboohr.com/jobs/view.php?id=19", + "id": 19, + "title": { + "id": null, + "label": "General Application" + } + }, + { + "postedDate": "2019-05-28T17:10:57+00:00", + "location": { + "id": 18235, + "label": "Lindon, Utah", + "address": null + }, + "department": { + "id": 18256, + "label": "Marketing" + }, + "status": { + "id": 2, + "label": "Draft" + }, + "newApplicantsCount": 0, + "activeApplicantsCount": 0, + "totalApplicantsCount": 0, + "postingUrl": "https://x.bamboohr.com/jobs/view.php?id=18", + "id": 18, + "title": { + "id": null, + "label": "Videographer" + } + }, + { + "postedDate": "2019-01-25T21:31:31+00:00", + "location": { + "id": 18243, + "label": "Vancouver, British Columbia", + "address": null + }, + "department": { + "id": 18249, + "label": "Sales" + }, + "status": { + "id": 1, + "label": "Open" + }, + "newApplicantsCount": 3, + "activeApplicantsCount": 4, + "totalApplicantsCount": 4, + "postingUrl": "https://x.bamboohr.com/jobs/view.php?id=17", + "id": 17, + "title": { + "id": null, + "label": "Account Executive" + } + }, + { + "postedDate": "2019-01-25T21:28:37+00:00", + "location": { + "id": 18238, + "label": "Mayfaird, London, City of", + "address": null + }, + "department": { + "id": 18251, + "label": "IT" + }, + "status": { + "id": 1, + "label": "Open" + }, + "newApplicantsCount": 0, + "activeApplicantsCount": 4, + "totalApplicantsCount": 4, + "postingUrl": "https://x.bamboohr.com/jobs/view.php?id=15", + "id": 15, + "title": { + "id": null, + "label": "IT Security Engineer" + } + } +] diff --git a/spec/lib/bamboozled/api/applicant_tracking_spec.rb b/spec/lib/bamboozled/api/applicant_tracking_spec.rb new file mode 100644 index 0000000..09dc870 --- /dev/null +++ b/spec/lib/bamboozled/api/applicant_tracking_spec.rb @@ -0,0 +1,68 @@ +require "spec_helper" + +RSpec.describe "ApplicantTracking" do + before do + @client = Bamboozled.client(subdomain: "x", api_key: "x") + end + + it "gets job summaries" do + response = File.new("spec/fixtures/job_summaries.json") + stub_request(:any, /.*api\.bamboohr\.com.*/).to_return(response) + + jobs = @client.applicant_tracking.job_summaries + + expect(jobs).to be_a Array + expect(jobs.count).to eq 5 + end + + it "gets applicant statuses" do + response = File.new("spec/fixtures/applicant_statuses.json") + stub_request(:any, /.*api\.bamboohr\.com.*/).to_return(response) + + statuses = @client.applicant_tracking.statuses + + expect(statuses).to be_a Array + expect(statuses.count).to eq 19 + end + + it "gets a list of applications" do + response = File.new("spec/fixtures/applications.json") + stub_request(:any, /.*api\.bamboohr\.com.*/).to_return(response) + + applications = @client.applicant_tracking.applications(page_limit: 10) + + expect(applications).to be_a Array + expect(applications.count).to eq 13 + end + + it "gets details of an application" do + response = File.new("spec/fixtures/application.json") + stub_request(:any, /.*api\.bamboohr\.com.*/).to_return(response) + + application = @client.applicant_tracking.application(33) + required_email = "nathan@efficientoffice.com" + + expect(application).to be_a Hash + expect(application["applicant"]["email"]).to eq required_email + end + + it "can change the status of an application" do + response = File.new("spec/fixtures/change_applicant_status.json") + stub_request(:post, /.*api\.bamboohr\.com.*/).to_return(response) + + status_change = @client.applicant_tracking.change_status(33, 3) + + expect(status_change).to be_a Hash + expect(status_change["type"]).to eq "positionApplicantStatus" + end + + it "can add a comment to an application" do + response = File.new("spec/fixtures/application_comment.json") + stub_request(:post, /.*api\.bamboohr\.com.*/).to_return(response) + + comment = @client.applicant_tracking.add_comment(33, "Test comment") + + expect(comment).to be_a Hash + expect(comment["type"]).to eq "comment" + end +end