Exception: Adyen::REST::ResponseError
- Defined in:
- lib/adyen/rest/errors.rb
Overview
Exception class for error responses from the Adyen API.
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#initialize(response_body) ⇒ ResponseError
constructor
A new instance of ResponseError.
Constructor Details
#initialize(response_body) ⇒ ResponseError
Returns a new instance of ResponseError.
23 24 25 26 27 28 29 30 |
# File 'lib/adyen/rest/errors.rb', line 23 def initialize(response_body) if match = /\A(\w+)\s(\d+)\s(.*)\z/.match(response_body) @category, @code, @description = match[1], match[2].to_i, match[3] super("API request error: #{description} (code: #{code}/#{category})") else super("API request error: #{response_body}") end end |
Instance Attribute Details
#category ⇒ String?
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/adyen/rest/errors.rb', line 20 class ResponseError < Adyen::REST::Error attr_accessor :category, :code, :description def initialize(response_body) if match = /\A(\w+)\s(\d+)\s(.*)\z/.match(response_body) @category, @code, @description = match[1], match[2].to_i, match[3] super("API request error: #{description} (code: #{code}/#{category})") else super("API request error: #{response_body}") end end end |
#code ⇒ Integer?
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/adyen/rest/errors.rb', line 20 class ResponseError < Adyen::REST::Error attr_accessor :category, :code, :description def initialize(response_body) if match = /\A(\w+)\s(\d+)\s(.*)\z/.match(response_body) @category, @code, @description = match[1], match[2].to_i, match[3] super("API request error: #{description} (code: #{code}/#{category})") else super("API request error: #{response_body}") end end end |
#description ⇒ String?
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/adyen/rest/errors.rb', line 20 class ResponseError < Adyen::REST::Error attr_accessor :category, :code, :description def initialize(response_body) if match = /\A(\w+)\s(\d+)\s(.*)\z/.match(response_body) @category, @code, @description = match[1], match[2].to_i, match[3] super("API request error: #{description} (code: #{code}/#{category})") else super("API request error: #{response_body}") end end end |