Exception: OpenpayException

Inherits:
StandardError
  • Object
show all
Defined in:
lib/openpay/errors/openpay_exception.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, json_message = true) ⇒ OpenpayException

Returns a new instance of OpenpayException.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# 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

Instance Attribute Details

#categoryObject (readonly)

Returns the value of attribute category.



8
9
10
# File 'lib/openpay/errors/openpay_exception.rb', line 8

def category
  @category
end

#descriptionObject (readonly)

Returns the value of attribute description.



3
4
5
# File 'lib/openpay/errors/openpay_exception.rb', line 3

def description
  @description
end

#error_codeObject (readonly)

Returns the value of attribute error_code.



7
8
9
# File 'lib/openpay/errors/openpay_exception.rb', line 7

def error_code
  @error_code
end

#http_bodyObject (readonly)

Returns the value of attribute http_body.



5
6
7
# File 'lib/openpay/errors/openpay_exception.rb', line 5

def http_body
  @http_body
end

#http_codeObject (readonly)

Returns the value of attribute http_code.



4
5
6
# File 'lib/openpay/errors/openpay_exception.rb', line 4

def http_code
  @http_code
end

#json_bodyObject (readonly)

Returns the value of attribute json_body.



6
7
8
# File 'lib/openpay/errors/openpay_exception.rb', line 6

def json_body
  @json_body
end