Class: Cb::JobApi
- Inherits:
-
Object
- Object
- Cb::JobApi
- Defined in:
- lib/cb/clients/job_api.rb
Class Method Summary collapse
-
.find_by_criteria(criteria) ⇒ Object
Retrieve a job by did.
- .find_by_did(did) ⇒ Object
-
.search(*args) ⇒ Object
Run a job search against the given criteria.
Class Method Details
.find_by_criteria(criteria) ⇒ Object
Retrieve a job by did
For detailed information around this API please visit: http://api.careerbuilder.com/JobInfo.aspx
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/cb/clients/job_api.rb', line 40 def self.find_by_criteria(criteria) my_api = Cb::Utils::Api.new() params = my_api.class.criteria_to_hash(criteria) json_hash = my_api.cb_get(Cb.configuration.uri_job_find, :query => params) if json_hash.has_key?('ResponseJob') if json_hash['ResponseJob'].has_key?('Job') job = CbJob.new(json_hash['ResponseJob']['Job']) end my_api.append_api_responses(job, json_hash['ResponseJob']) end my_api.append_api_responses(job, json_hash) return job end |
.find_by_did(did) ⇒ Object
56 57 58 59 60 |
# File 'lib/cb/clients/job_api.rb', line 56 def self.find_by_did(did) criteria = Cb::JobDetailsCriteria.new() criteria.did = did return find_by_criteria(criteria) end |
.search(*args) ⇒ Object
Run a job search against the given criteria
For detailed information around this API please visit: http://api.careerbuilder.com/JobSearchInfo.aspx
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/cb/clients/job_api.rb', line 12 def self.search(*args) args = args[0] if args.is_a?(Array) && args.count == 1 my_api = Cb::Utils::Api.new() json_hash = my_api.cb_get(Cb.configuration.uri_job_search, :query => args) jobs = [] if json_hash.has_key?('ResponseJobSearch') if json_hash['ResponseJobSearch'].has_key?('Results') && json_hash['ResponseJobSearch']['Results'].present? json_hash['ResponseJobSearch']['Results']['JobSearchResult'].each do | cur_job | jobs << CbJob.new(cur_job) end end my_api.append_api_responses(jobs, json_hash['ResponseJobSearch']) end my_api.append_api_responses(jobs, json_hash) return jobs end |