NOTE: This Repo is archived and in read-only mode.
A Ruby interface to Greenhouse.io's API (requires Ruby 1.9.3 or greater).
Add the gem to your application's Gemfile:
gem 'greenhouse_io'
Or install it yourself as:
$ gem install greenhouse_io
You can assign default configuration values when using this gem.
Here is an example config/initializers/greenhouse_io.rb
file used in a Rails application:
GreenhouseIo.configure do |config|
config.symbolize_keys = true # set response keys as strings or symbols, default is false
config.organization = 'General Assembly'
config.api_token = ENV['GREENHOUSE_API_TOKEN']
end
Greenhouse's two APIs, Harvest and JobBoard, can now be accessed through the gem. The GreenhouseIo::JobBoard
is nearly identical to the old GreenhouseIo::API
class. GreenhouseIo::Client
connects to the new Harvest API.
Creating an instance of the JobBoard client:
gh = GreenhouseIo::JobBoard.new("api_token", organization: "your_organization")
If you've configured the gem with a default organization
and api_token
, then you can just instantiate the class.
gh = GreenhouseIo::JobBoard.new
api_token
is only required for #apply_to_job
and organization
is also optional during initialization if an organization is passed in during method requests.
gh.offices
gh.offices(organization: 'different_organization')
# returns a hash containing all of the organization's department and jobs grouped by office
gh.office(id)
gh.office(id, organization: 'different_organization')
# returns a hash containing the departments and jobs of a specific office
gh.departments
gh.departments(organization: 'different_organizaton')
gh.department(id)
gh.department(id, organization: 'different_organization')
gh.jobs
gh.jobs(content: 'true')
# includes the job description in the response
gh.jobs(organization: 'different_organization')
gh.job(id)
gh.job(id, questions: true)
# returns the specified job and the array of questions on the application
gh.job(id, organization: 'different_organization')
This is the only API method that requires an API token from Greenhouse
gh.apply_to_job(form_parameter_hash)
# form_parameter_hash should match the questions array of a given job opening
# there should be a hidden input with name id in your form that
# has the value of the job ID on Greenhouse.io
Creating an instance of the API client:
gh_client = GreenhouseIo::Client.new("api_token")
If you've configured the gem with a default api_token
, then you can just instantiate the class.
gh_client = GreenhouseIo::Client.new
Rate limit and rate limit remaining are available after making an API request with an API client:
gh_client.rate_limit # => 20
gh_client.rate_limit_remaining # => 20
All GreenhouseIo::Client
API methods accept :page
and :per_page
options to get specific results of a paginated response from Greenhouse.
gh_client.offices(id, page: 1, per_page: 2)
Methods in which an id
is optional:
offices
departments
candidates
applications
jobs
users
sources
Methods in which an id
is required:
activity_feed
(requires a candidate ID)scorecards
(requires an application ID)scheduled_interviews
(requires an application ID)stages
(requires a job ID)job_post
(requires a job ID)
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request