Class: Cb::Clients::Application
- Inherits:
-
Object
- Object
- Cb::Clients::Application
- Defined in:
- lib/cb/clients/application.rb
Class Method Summary collapse
- .for_job(job) ⇒ Object
- .send_to_api(uri, app) ⇒ Object
- .submit_app(app) ⇒ Object
- .submit_registered_app(app) ⇒ Object
Class Method Details
.for_job(job) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/cb/clients/application.rb', line 7 def self.for_job(job) job.is_a?(Cb::Models::Job) ? 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::Models::ApplicationSchema.new(json_hash['ResponseBlankApplication']['BlankApplication']) end my_api.append_api_responses(app, json_hash['ResponseBlankApplication']) end my_api.append_api_responses(app, json_hash) end |
.send_to_api(uri, app) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/cb/clients/application.rb', line 31 def self.send_to_api(uri, app) raise Cb::IncomingParamIsWrongTypeException unless app.is_a?(Cb::Models::Application) my_api = Cb::Utils::Api.new json_hash = my_api.cb_post("#{uri}?ipath=#{app.ipath}", :body => app.to_xml) 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 my_api.append_api_responses(app, json_hash) end |
.submit_app(app) ⇒ Object
27 28 29 |
# File 'lib/cb/clients/application.rb', line 27 def self.submit_app(app) return send_to_api(Cb.configuration.uri_application_submit, app) end |
.submit_registered_app(app) ⇒ Object
23 24 25 |
# File 'lib/cb/clients/application.rb', line 23 def self.submit_registered_app(app) return send_to_api(Cb.configuration.uri_application_registered, app) end |