Exception: GMO::Payment::Error

Inherits:
GMOError
  • Object
show all
Defined in:
lib/gmo/errors.rb

Direct Known Subclasses

APIError, ServerError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response_body = "", error_info = nil) ⇒ Error

Returns a new instance of Error.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/gmo/errors.rb', line 18

def initialize(response_body = "", error_info = nil)
  if response_body &&  response_body.is_a?(String)
    self.response_body = response_body.strip
  else
    self.response_body = ''
  end
  if error_info.nil?
    begin
      error_info = Rack::Utils.parse_nested_query(response_body.to_s)
    rescue
      error_info ||= {}
    end
  end
  self.error_info = error_info
  message = self.response_body
  super(message)
end

Instance Attribute Details

#error_infoObject

Returns the value of attribute error_info.



16
17
18
# File 'lib/gmo/errors.rb', line 16

def error_info
  @error_info
end

#response_bodyObject

Returns the value of attribute response_body.



16
17
18
# File 'lib/gmo/errors.rb', line 16

def response_body
  @response_body
end