Class: Cb::RecommendationApi
- Inherits:
-
Object
- Object
- Cb::RecommendationApi
- Defined in:
- lib/cb/clients/recommendation_api.rb
Class Method Summary collapse
-
.for_company(company_did) ⇒ Object
Get recommendations for a company.
-
.for_job(did, countlimit = '25', site_id = '', co_brand = '') ⇒ Object
Get recommendations for a job.
-
.for_user(external_id, countlimit = '25', site_id = '', co_brand = '') ⇒ Object
Get recommendations for a user.
Class Method Details
.for_company(company_did) ⇒ Object
Get recommendations for a company
For detailed information around this API please visit: http://api.careerbuilder.com/Recommendations.aspx
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/cb/clients/recommendation_api.rb', line 62 def self.for_company(company_did) my_api = Cb::Utils::Api.new() cb_response = my_api.cb_get(Cb.configuration.uri_recommendation_for_company, :query => {:CompanyDID => company_did}) json_hash = JSON.parse(cb_response.response.body) jobs = [] unless json_hash['Results']['JobRecommendation'].nil? json_hash['Results']['JobRecommendation']['Jobs'].each do |cur_job| jobs << CbJob.new(cur_job) end end my_api.append_api_responses(jobs, json_hash['Results']) my_api.append_api_responses(jobs, json_hash['Results']['JobRecommendation']) return jobs end |
.for_job(did, countlimit = '25', site_id = '', co_brand = '') ⇒ Object
Get recommendations for a job
For detailed information around this API please visit: http://api.careerbuilder.com/Recommendations.aspx
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/cb/clients/recommendation_api.rb', line 11 def self.for_job(did, countlimit = '25', site_id = '', co_brand = '') my_api = Cb::Utils::Api.new() cb_response = my_api.cb_get(Cb.configuration.uri_recommendation_for_job, :query => {:JobDID => did, :CountLimit => countlimit, :SiteID => site_id, :CoBrand => co_brand, :HostSite => Cb.configuration.host_site}) json_hash = JSON.parse(cb_response.response.body) jobs = [] unless json_hash['ResponseRecommendJob']['RecommendJobResults'].nil? json_hash['ResponseRecommendJob']['RecommendJobResults']['RecommendJobResult'].each do |cur_job| jobs << CbJob.new(cur_job) end end my_api.append_api_responses(jobs, json_hash['ResponseRecommendJob']) my_api.append_api_responses(jobs, json_hash['ResponseRecommendJob']['Request']) return jobs end |
.for_user(external_id, countlimit = '25', site_id = '', co_brand = '') ⇒ Object
Get recommendations for a user
For detailed information around this API please visit: http://api.careerbuilder.com/Recommendations.aspx
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/cb/clients/recommendation_api.rb', line 37 def self.for_user(external_id, countlimit = '25', site_id = '', co_brand = '') my_api = Cb::Utils::Api.new() cb_response = my_api.cb_get(Cb.configuration.uri_recommendation_for_user, :query => {:ExternalID => external_id, :CountLimit => countlimit, :SiteID => site_id, :CoBrand => co_brand, :HostSite => Cb.configuration.host_site}) json_hash = JSON.parse(cb_response.response.body) jobs = [] unless json_hash['ResponseRecommendUser']['RecommendJobResults'].nil? json_hash['ResponseRecommendUser']['RecommendJobResults']['RecommendJobResult'].each do |cur_job| jobs << CbJob.new(cur_job) end end my_api.append_api_responses(jobs, json_hash['ResponseRecommendUser']) my_api.append_api_responses(jobs, json_hash['ResponseRecommendUser']['Request']) return jobs end |