class OpenpayException

Attributes

category[R]
description[R]
error_code[R]
http_body[R]
http_code[R]
json_body[R]

Public Class Methods

new(message=nil,json_message=true) click to toggle source
# File lib/openpay/errors/openpay_exception.rb, line 10
def initialize(message=nil,json_message=true)
#openpay errors  have a json error string
 if json_message
    json= JSON.parse message
    @description = json['description']
    @http_code =   json['http_code']
    @error_code = json['error_code']
    @json_body = message
   @category   = json['category']
 #other errors may or not have a json error string, so this case is for them
 else
   @description = message
   @http_code  =   ''
   @http_body  =  ''
   @json_body  =  ''
   @error_code = ''
  end
end