Exception: GmoPayment::Errors::ResponseHasErrCodeError

Inherits:
GmoPayment::Errors show all
Defined in:
lib/gmo_payment/errors.rb

Overview

Error of response body has “ErrCode”.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(called_method = nil, response = nil) ⇒ ResponseHasErrCodeError

Returns a new instance of ResponseHasErrCodeError.

Parameters:

  • called_method (Symbol) (defaults to: nil)
  • response (Response) (defaults to: nil)


77
78
79
80
81
# File 'lib/gmo_payment/errors.rb', line 77

def initialize(called_method = nil, response = nil)
  self.called_method = called_method
  self.response = response
  super("HTTP response called from `#{called_method}' has ErrCode")
end

Instance Attribute Details

#called_methodObject



73
74
75
# File 'lib/gmo_payment/errors.rb', line 73

def called_method
  @called_method
end

#responseObject



73
# File 'lib/gmo_payment/errors.rb', line 73

attr_accessor :called_method, :response

Instance Method Details

#error_messages(file = nil) ⇒ Hash

Parameters:

  • file (String) (defaults to: nil)

Returns:

  • (Hash)


85
86
87
88
89
90
91
# File 'lib/gmo_payment/errors.rb', line 85

def error_messages(file = nil)
  require 'yaml'
  error_list = YAML.load_file(file || GmoPayment::Configure.error_list)
  self.response.err_info.each_with_object({}) do |error, hash|
    hash[error] = error_list[error]
  end
end