First things first. You're going to need to get a developer key from Careerbuilder. Developer keys are available to Partners. You can fill out the form at http://developer.careerbuilder.com/partner_messages/new to become a Partner.
Now that you have a key, lets get to the good stuff.
You can find an example rails site that uses the gem here: https://github.com/cbdr/ruby-cb-api-demo
If you are interested in helping out / contributing to this project please read CONTRIBUTING guide
We have dropped support for ruby 1.8, 1.9, and 2.0. This gem may continue to work in those versions but we are not going to offically support it going forward.
Install required gems:
gem install cb-api
Require the library in your Ruby script:
require 'cb'
Set your dev key, and any other configuration settings in a place that will run prior to your API calls.
Cb.configure do |config|
config.dev_key = 'your-dev-key-goes-here'
config.time_out = 5
end
https://github.com/careerbuilder/ruby-cb-api/blob/master/lib/cb/config.rb
Use the Cb convenience methods to access the job client (Cb::Clients::Job)
job_client = Cb.job
Using the job client you can search through the listings
job_client.search({ location: 'Atlanta' })
Or you can search for one job via it's details
job_client.find_by_criteria({ })
Or you can search for one job via it's did
job_client.find_by_did('J3H4CK6XNXYQ07RHSYL')
When using the job client to do a search you will receive back a search response instance (Response::Job::Search)
search_response = job_client.search({ location: 'Atlanta' })
Which can be used to retrieve an search result model instance (Cb::Models::JobResults)
search_result_model = search_response.model
Which encapsulates details of the search result
search_result.total_count
search_result.last_item_index
search_result.city
search_result.state
search_result.postal_code
search_result.search_location
As well as returning back the jobs from the search result (Cb::Models::Job instances)
jobs = search_result.jobs
Each returned job object contains details of one job listing
jobs.each do |job|
puts "#{job.did}: #{job.company_name} - #{job.title}"
end
The search response can also return you any errors which occured during the job search (Cb::Responses::Errors). The parsed errors will contain an Array of error messages. If it is not empty an error occurred during the request.
search_response.errors.parsed
When performing a job search you can provide a Hash of search parameters. For example
search_params = { location: 'Atlanta', keywords: 'Database Admin' }
Cb.job.search(search_params)
The search params hash can include the following keys:
- keywords
- location
- postedwithin
- excludeapplyrequirments
- orderdirection
- orderby
- pagenumber
- hostsite
- siteentity
- countrycode
Cb::Models::Job has many accessor methods which are used to get the details of the job
If you have preformed a job search, such as
Cb.job.search({ location: 'Atlanta' }).results.model.jobs.each do |job|
puts "Job Details: #{job.company_name} - #{job.title}"
end
The following data is available from a job
didtitlejob_skinjob_skin_didjob_brandingpaypay_percommissionbonuspay_othercategoriescategory_codesdegree_requiredexperience_requiredtravel_requiredindustry_codesmanages_others_codecontact_email_urlcontact_faxcontact_namecontact_phonecompany_namecompany_didcompany_details_urlcompany_image_urlcompanydescription_teaserexternal_apply_urljob_tracking_urllocationdistancelatitudelongitudelocation_formatteddescriptionrequirementsemployment_typedetails_urlservice_urlsimilar_jobs_urlapply_urlbegin_dateend_dateposted_dateposted_timerelevancystatecityzipcan_be_quick_appliedapply_requirementsdivisonindustrylocation_street_1relocation_optionslocation_street_2display_job_idmanages_others_stringdegree_required_codetravel_required_codeemployment_type_codeexternal_application?relocation_covered?manages_others?screener_apply?shared_job?can_be_quick_applied?has_questionnaire?find_company