Exception: SixSaferpay::Error
- Inherits:
-
StandardError
- Object
- StandardError
- SixSaferpay::Error
- Defined in:
- lib/six_saferpay/errors/error.rb
Instance Attribute Summary collapse
-
#behavior ⇒ Object
Returns the value of attribute behavior.
-
#error_detail ⇒ Object
Returns the value of attribute error_detail.
-
#error_message ⇒ Object
Returns the value of attribute error_message.
-
#error_name ⇒ Object
Returns the value of attribute error_name.
-
#processor_message ⇒ Object
Returns the value of attribute processor_message.
-
#processor_name ⇒ Object
Returns the value of attribute processor_name.
-
#processor_result ⇒ Object
Returns the value of attribute processor_result.
-
#response_header ⇒ Object
Returns the value of attribute response_header.
-
#transaction_id ⇒ Object
Returns the value of attribute transaction_id.
Instance Method Summary collapse
- #full_message ⇒ Object
-
#initialize(response_header:, behavior:, error_name:, error_message:, transaction_id: nil, error_detail: nil, processor_name: nil, processor_result: nil, processor_message: nil) ⇒ Error
constructor
A new instance of Error.
- #message ⇒ Object
- #to_hash ⇒ Object (also: #to_h)
- #to_s ⇒ Object
Constructor Details
#initialize(response_header:, behavior:, error_name:, error_message:, transaction_id: nil, error_detail: nil, processor_name: nil, processor_result: nil, processor_message: nil) ⇒ Error
Returns a new instance of Error.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/six_saferpay/errors/error.rb', line 15 def initialize(response_header: , behavior: , error_name: , error_message: , transaction_id: nil, error_detail: nil, processor_name: nil, processor_result: nil, processor_message: nil ) @response_header = SixSaferpay::ResponseHeader.new(**response_header.to_h) if response_header @behavior = behavior @error_name = error_name @error_message = @transaction_id = transaction_id @error_detail = error_detail @processor_name = processor_name @processor_result = processor_result @processor_message = end |
Instance Attribute Details
#behavior ⇒ Object
Returns the value of attribute behavior.
4 5 6 |
# File 'lib/six_saferpay/errors/error.rb', line 4 def behavior @behavior end |
#error_detail ⇒ Object
Returns the value of attribute error_detail.
4 5 6 |
# File 'lib/six_saferpay/errors/error.rb', line 4 def error_detail @error_detail end |
#error_message ⇒ Object
Returns the value of attribute error_message.
4 5 6 |
# File 'lib/six_saferpay/errors/error.rb', line 4 def @error_message end |
#error_name ⇒ Object
Returns the value of attribute error_name.
4 5 6 |
# File 'lib/six_saferpay/errors/error.rb', line 4 def error_name @error_name end |
#processor_message ⇒ Object
Returns the value of attribute processor_message.
4 5 6 |
# File 'lib/six_saferpay/errors/error.rb', line 4 def @processor_message end |
#processor_name ⇒ Object
Returns the value of attribute processor_name.
4 5 6 |
# File 'lib/six_saferpay/errors/error.rb', line 4 def processor_name @processor_name end |
#processor_result ⇒ Object
Returns the value of attribute processor_result.
4 5 6 |
# File 'lib/six_saferpay/errors/error.rb', line 4 def processor_result @processor_result end |
#response_header ⇒ Object
Returns the value of attribute response_header.
4 5 6 |
# File 'lib/six_saferpay/errors/error.rb', line 4 def response_header @response_header end |
#transaction_id ⇒ Object
Returns the value of attribute transaction_id.
4 5 6 |
# File 'lib/six_saferpay/errors/error.rb', line 4 def transaction_id @transaction_id end |
Instance Method Details
#full_message ⇒ Object
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/six_saferpay/errors/error.rb', line 51 def error = "#{@behavior}: #{@error_name} - #{@error_message}" if @error_detail @error_detail.each do |detail| error << "\n" error << detail end end error end |
#message ⇒ Object
66 67 68 |
# File 'lib/six_saferpay/errors/error.rb', line 66 def end |
#to_hash ⇒ Object Also known as: to_h
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/six_saferpay/errors/error.rb', line 36 def to_hash hash = Hash.new hash.merge!(response_header: @response_header.to_h) if @response_header hash.merge!(behavior: @behavior) if @behavior hash.merge!(error_name: @error_name) if @error_name hash.merge!(error_message: @error_message) if @error_message hash.merge!(transaction_id: @transaction_id) if @transaction_id hash.merge!(error_detail: @error_detail) if @error_detail hash.merge!(processor_name: @processor_name) if @processor_name hash.merge!(processor_result: @processor_result) if @processor_result hash.merge!(processor_message: @processor_message) if @processor_message hash end |
#to_s ⇒ Object
62 63 64 |
# File 'lib/six_saferpay/errors/error.rb', line 62 def to_s end |