Class: Weimark::Response
- Inherits:
-
Object
- Object
- Weimark::Response
- Defined in:
- lib/weimark/client.rb
Instance Attribute Summary collapse
-
#application ⇒ Object
readonly
Returns the value of attribute application.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#parsed_response ⇒ Object
readonly
Returns the value of attribute parsed_response.
-
#report ⇒ Object
readonly
Returns the value of attribute report.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(response) ⇒ Response
constructor
“timestamp”=>“08/21/2018 14:43:24”, “link”=>“secure.weimark.com/applications/view/380854”, “status”=>“COMPLETED”, “report”=>“ficoscores”=>{“applicants”=>{“applicant”=>{“name”=>“John Doe”, “score”=>“850”}}, “fullreport”=>“”}}}.
- #successful? ⇒ Boolean
Constructor Details
#initialize(response) ⇒ Response
“timestamp”=>“08/21/2018 14:43:24”, “link”=>“secure.weimark.com/applications/view/380854”, “status”=>“COMPLETED”, “report”=>“ficoscores”=>{“applicants”=>{“applicant”=>{“name”=>“John Doe”, “score”=>“850”}}, “fullreport”=>“”}}}
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/weimark/client.rb', line 85 def initialize(response) @response = response @parsed_response = Hash.from_xml(response)['xml'] @status = parsed_response['status'] if successful? result = @parsed_response['result'] application = result['application'] application.merge!('id' => result['applicationid']) if result['applicationid'] @application = Weimark::Application.new(application) @report = Weimark::Report.new(result['report']) if result['report'] else @message = parsed_response['message'] end end |
Instance Attribute Details
#application ⇒ Object (readonly)
Returns the value of attribute application.
82 83 84 |
# File 'lib/weimark/client.rb', line 82 def application @application end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
82 83 84 |
# File 'lib/weimark/client.rb', line 82 def @message end |
#parsed_response ⇒ Object (readonly)
Returns the value of attribute parsed_response.
82 83 84 |
# File 'lib/weimark/client.rb', line 82 def parsed_response @parsed_response end |
#report ⇒ Object (readonly)
Returns the value of attribute report.
82 83 84 |
# File 'lib/weimark/client.rb', line 82 def report @report end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
82 83 84 |
# File 'lib/weimark/client.rb', line 82 def response @response end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
82 83 84 |
# File 'lib/weimark/client.rb', line 82 def status @status end |
Instance Method Details
#errors ⇒ Object
105 106 107 |
# File 'lib/weimark/client.rb', line 105 def errors successful? ? [] : [parsed_response['message']] end |
#successful? ⇒ Boolean
101 102 103 |
# File 'lib/weimark/client.rb', line 101 def successful? status != 'ERROR' end |