Class: Cb::ApplicationApi

Inherits:
Object
  • Object
show all
Defined in:
lib/cb/clients/application_api.rb

Class Method Summary collapse

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
# 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()
  cb_response = my_api.cb_get(Cb.configuration.uri_application, :query => {:JobDID => did})
  json_hash = JSON.parse(cb_response.response.body)

  app = Cb::CbApplicationSchema.new(json_hash['ResponseBlankApplication']['BlankApplication'])
  my_api.append_api_responses(app, json_hash['ResponseBlankApplication'])

  return app
end

.send_to_api(uri, app) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/cb/clients/application_api.rb', line 46

def self.send_to_api(uri, app)
  raise Cb::IncomingParamIsWrongTypeException unless app.is_a?(Cb::CbApplication)

  my_api = Cb::Utils::Api.new()
  cb_response = my_api.cb_post("#{uri}?ipath=#{app.ipath}", :body => app.to_xml)
  my_api.append_api_responses(app, cb_response['ResponseApplication'])

  begin
    app.redirect_url = cb_response['ResponseApplication']['RedirectURL'] || ''
  end

  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



42
43
44
# File 'lib/cb/clients/application_api.rb', line 42

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



32
33
34
# File 'lib/cb/clients/application_api.rb', line 32

def self.submit_registered_app(app)
  return send_to_api(Cb.configuration.uri_application_registered, app)
end