Exception: Ingenico::Connect::SDK::ResponseException
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- Ingenico::Connect::SDK::ResponseException
- Defined in:
- lib/ingenico/connect/sdk/response_exception.rb
Overview
Exception used internally in the SDK to indicate an error response was received from the Ingenico ePayments platform.
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Response object that was returned by the Ingenico ePayments platform.
Instance Method Summary collapse
-
#body ⇒ Object
string HTTP message body that was returned by the Ingenico ePayments platform.
-
#get_header(header_name) ⇒ Object
Returns the ResponseHeader that corresponds to the given header_name used in the HTTP response from the Ingenico ePayments platform, or nil if the header was not present in the response.
-
#get_header_value(header_name) ⇒ Object
Returns the header value received that corresponds to the header named by header_name, or nil if header_name was not a header present in the HTTP response.
-
#headers ⇒ Object
List of ResponseHeader that represent the HTTP headers used in the response from the Ingenico ePayments platform.
-
#initialize(response) ⇒ ResponseException
constructor
A new instance of ResponseException.
-
#status_code ⇒ Object
HTTP status code that was returned by the Ingenico ePayments platform.
- #to_s ⇒ Object
Constructor Details
#initialize(response) ⇒ ResponseException
Returns a new instance of ResponseException.
6 7 8 9 |
# File 'lib/ingenico/connect/sdk/response_exception.rb', line 6 def initialize(response) super('the Ingenico ePayments platform returned an error response') @response = response end |
Instance Attribute Details
#response ⇒ Object (readonly)
Ingenico::Connect::SDK::Response object that was returned by the Ingenico ePayments platform
12 13 14 |
# File 'lib/ingenico/connect/sdk/response_exception.rb', line 12 def response @response end |
Instance Method Details
#body ⇒ Object
string HTTP message body that was returned by the Ingenico ePayments platform
20 21 22 |
# File 'lib/ingenico/connect/sdk/response_exception.rb', line 20 def body @response.body end |
#get_header(header_name) ⇒ Object
Returns the Ingenico::Connect::SDK::ResponseHeader that corresponds to the given header_name used in the HTTP response from the Ingenico ePayments platform, or nil if the header was not present in the response.
31 32 33 |
# File 'lib/ingenico/connect/sdk/response_exception.rb', line 31 def get_header(header_name) @response.get_header(header_name) end |
#get_header_value(header_name) ⇒ Object
Returns the header value received that corresponds to the header named by header_name, or nil if header_name was not a header present in the HTTP response.
37 38 39 |
# File 'lib/ingenico/connect/sdk/response_exception.rb', line 37 def get_header_value(header_name) @response.get_header_value(header_name) end |
#headers ⇒ Object
List of Ingenico::Connect::SDK::ResponseHeader that represent the HTTP headers used in the response from the Ingenico ePayments platform
25 26 27 |
# File 'lib/ingenico/connect/sdk/response_exception.rb', line 25 def headers @response.headers end |
#status_code ⇒ Object
HTTP status code that was returned by the Ingenico ePayments platform
15 16 17 |
# File 'lib/ingenico/connect/sdk/response_exception.rb', line 15 def status_code @response.status_code end |
#to_s ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/ingenico/connect/sdk/response_exception.rb', line 41 def to_s str = super.to_s status_code = @response.status_code if status_code > 0 str += '; status_code=' + status_code.to_s end response_body = @response.body if !response_body.nil? && response_body.length > 0 str += "; response_body='" + response_body + "'" end str.to_s end |