Sha256: 26f5d6abb2551d82aa452fb1f74c5b0698b63e9cb8114fead32ea4d9e07ab3a4

Contents?: true

Size: 742 Bytes

Versions: 14

Compression:

Stored size: 742 Bytes

Contents

class OpenpayException < StandardError

  attr_reader :description
  attr_reader :http_code
  attr_reader :http_body
  attr_reader :json_body
  attr_reader :error_code
  attr_reader :category

  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

end

Version data entries

14 entries across 12 versions & 1 rubygems

Version Path
openpay-2.0.1 lib/openpay/errors/openpay_exception.rb
openpay-2.0.0 lib/openpay/errors/openpay_exception.rb
openpay-2.0.0b lib/openpay/errors/openpay_exception.rb
openpay-1.0.10 lib/openpay/errors/openpay_exception.rb
openpay-1.0.8 lib/openpay/errors/openpay_exception.rb
openpay-1.0.7 lib/openpay/errors/openpay_exception.rb
openpay-1.0.6 lib/openpay/errors/openpay_exception.rb
openpay-1.0.5 lib/openpay/errors/openpay_exception.rb
openpay-1.0.4 lib/openpay/errors/openpay_exception.rb
openpay-1.0.3 lib/openpay/errors/openpay_exception.rb
openpay-1.0.3 lib/OpenPay/errors/openpay_exception.rb
openpay-1.0.2 lib/openpay/errors/openpay_exception.rb
openpay-1.0.2 lib/OpenPay/errors/openpay_exception.rb
openpay-1.0.1 lib/OpenPay/errors/openpay_exception.rb