Exception: Payfort::PayfortError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/payfort/errors/payfort_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, code = nil, http_status = nil) ⇒ PayfortError

Returns a new instance of PayfortError.



7
8
9
10
11
# File 'lib/payfort/errors/payfort_error.rb', line 7

def initialize(message=nil, code=nil, http_status=nil)
  @message = message
  @code = code
  @http_status = http_status
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



4
5
6
# File 'lib/payfort/errors/payfort_error.rb', line 4

def code
  @code
end

#http_statusObject (readonly)

Returns the value of attribute http_status.



5
6
7
# File 'lib/payfort/errors/payfort_error.rb', line 5

def http_status
  @http_status
end

#messageObject (readonly)

Returns the value of attribute message.



3
4
5
# File 'lib/payfort/errors/payfort_error.rb', line 3

def message
  @message
end

Instance Method Details

#to_sObject



13
14
15
16
# File 'lib/payfort/errors/payfort_error.rb', line 13

def to_s
  status_string = @http_status.nil? ? "" : "(#{@code}Error - Status #{@http_status}) "
  "#{status_string}#{@message}"
end