Exception: QuickPay::API::Error
- Inherits:
-
StandardError
- Object
- StandardError
- QuickPay::API::Error
- Defined in:
- lib/quickpay/api/error.rb
Direct Known Subclasses
BadGateway, BadRequest, Conflict, Forbidden, GatewayTimeout, InternalServerError, MethodNotAllowed, NotAcceptable, NotFound, PaymentRequired, ServiceUnavailable, TooManyRequest, Unauthorized
Defined Under Namespace
Classes: BadGateway, BadRequest, Conflict, Forbidden, GatewayTimeout, InternalServerError, MethodNotAllowed, NotAcceptable, NotFound, PaymentRequired, ServiceUnavailable, TooManyRequest, Unauthorized
Constant Summary collapse
- CLASS_MAP =
{ 400 => BadRequest, 401 => Unauthorized, 402 => PaymentRequired, 403 => Forbidden, 404 => NotFound, 405 => MethodNotAllowed, 406 => NotAcceptable, 409 => Conflict, 429 => TooManyRequest, 500 => InternalServerError, 502 => BadGateway, 503 => ServiceUnavailable, 504 => GatewayTimeout }.freeze
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(status, body, headers, request) ⇒ Error
constructor
A new instance of Error.
- #to_s ⇒ Object (also: #inspect)
Constructor Details
#initialize(status, body, headers, request) ⇒ Error
Returns a new instance of Error.
48 49 50 51 52 53 |
# File 'lib/quickpay/api/error.rb', line 48 def initialize(status, body, headers, request) @status = status @body = body @headers = headers @request = request end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
46 47 48 |
# File 'lib/quickpay/api/error.rb', line 46 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
46 47 48 |
# File 'lib/quickpay/api/error.rb', line 46 def headers @headers end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
46 47 48 |
# File 'lib/quickpay/api/error.rb', line 46 def request @request end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
46 47 48 |
# File 'lib/quickpay/api/error.rb', line 46 def status @status end |
Class Method Details
Instance Method Details
#to_s ⇒ Object Also known as: inspect
55 56 57 58 |
# File 'lib/quickpay/api/error.rb', line 55 def to_s "#<#{self.class}: status=#{status}, body=#{body.inspect}, " \ "headers=#{headers.inspect} request=#{request.inspect}>" end |