class Weimark::Response

Attributes

application[R]
message[R]
parsed_response[R]
report[R]
response[R]
status[R]

Public Class Methods

new(response) click to toggle source

{“application”=>{“id”=>“3x7gda8bz6drq5d4d79faee07x80y5i0”, “timestamp”=>“08/21/2018 14:43:24”, “link”=>“secure.weimark.com/applications/view/380854”, “status”=>“COMPLETED”}, “report”=>{“decision”=>“Excellent”, “ficoscores”=>{“applicants”=>{“applicant”=>{“name”=>“John Doe”, “score”=>“850”}}}, “fullreport”=>“”}}}

# 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

Public Instance Methods

errors() click to toggle source
# File lib/weimark/client.rb, line 105
def errors
  successful? ? [] : [parsed_response['message']]
end
successful?() click to toggle source
# File lib/weimark/client.rb, line 101
def successful?
  status != 'ERROR'
end