Class: Cb::ApplicationApi
- Inherits:
-
Object
- Object
- Cb::ApplicationApi
- Defined in:
- lib/cb/clients/application_api.rb
Class Method Summary collapse
-
.for_job(job) ⇒ Object
Get an application for a job Takes in either a Cb::CbJob, or a string (which should contain a did).
- .send_to_api(uri, app) ⇒ Object
-
.submit_app(app) ⇒ Object
Submit a job application.
-
.submit_registered_app(app) ⇒ Object
Submit a job application for a registered user.
Class Method Details
.for_job(job) ⇒ Object
Get an application for a job Takes in either a Cb::CbJob, or a string (which should contain a did)
For detailed information around this API please visit: http://api.careerbuilder.com/ApplicationInfo.aspx
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/cb/clients/application_api.rb', line 13 def self.for_job(job) job.is_a?(Cb::CbJob) ? did = job.did : did = job my_api = Cb::Utils::Api.new() json_hash = my_api.cb_get(Cb.configuration.uri_application, :query => {:JobDID => did}) if json_hash.has_key?('ResponseBlankApplication') if json_hash['ResponseBlankApplication'].has_key?('BlankApplication') app = Cb::CbApplicationSchema.new(json_hash['ResponseBlankApplication']['BlankApplication']) end my_api.append_api_responses(app, json_hash['ResponseBlankApplication']) end my_api.append_api_responses(app, json_hash) return app end |
.send_to_api(uri, app) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/cb/clients/application_api.rb', line 52 def self.send_to_api(uri, app) raise Cb::IncomingParamIsWrongTypeException unless app.is_a?(Cb::CbApplication) my_api = Cb::Utils::Api.new() json_hash = my_api.cb_post("#{uri}?ipath=#{app.ipath}", :body => app.to_xml) begin if json_hash.has_key? 'ResponseApplication' if json_hash['ResponseApplication'].has_key? 'RedirectURL' app.redirect_url = json_hash['ResponseApplication']['RedirectURL'] else app.redirect_url = '' end my_api.append_api_responses(app, json_hash['ResponseApplication']) else app.redirect_url = '' end end my_api.append_api_responses(app, json_hash) return app end |
.submit_app(app) ⇒ Object
Submit a job application
For detailed information around this API please visit: http://api.careerbuilder.com/ApplicationInfo.aspx
48 49 50 |
# File 'lib/cb/clients/application_api.rb', line 48 def self.submit_app(app) return send_to_api(Cb.configuration.uri_application_submit, app) end |
.submit_registered_app(app) ⇒ Object
Submit a job application for a registered user
For detailed information around this API please visit: http://api.careerbuilder.com/ApplicationInfo.aspx
38 39 40 |
# File 'lib/cb/clients/application_api.rb', line 38 def self.submit_registered_app(app) return send_to_api(Cb.configuration.uri_application_registered, app) end |