Exception: Warrant::WarrantError
- Inherits:
-
StandardError
- Object
- StandardError
- Warrant::WarrantError
- Defined in:
- lib/warrant/errors.rb
Direct Known Subclasses
DuplicateRecordError, ForbiddenError, InternalError, InvalidParameterError, InvalidRequestError, MissingRequiredParameterError, NotFoundError, UnauthorizedError
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#http_body ⇒ Object
readonly
Returns the value of attribute http_body.
-
#http_headers ⇒ Object
readonly
Returns the value of attribute http_headers.
-
#http_status ⇒ Object
readonly
Returns the value of attribute http_status.
-
#json_body ⇒ Object
readonly
Returns the value of attribute json_body.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(code = nil, message = nil, http_status = nil, http_headers = nil, http_body = nil, json_body = nil) ⇒ WarrantError
constructor
A new instance of WarrantError.
Constructor Details
#initialize(code = nil, message = nil, http_status = nil, http_headers = nil, http_body = nil, json_body = nil) ⇒ WarrantError
Returns a new instance of WarrantError.
18 19 20 21 22 23 24 25 26 |
# File 'lib/warrant/errors.rb', line 18 def initialize(code = nil, = nil, http_status = nil, http_headers = nil, http_body = nil, json_body = nil) @code = code @headers = headers @message = @http_status = http_status @http_headers = http_headers @http_body = http_body @json_body = json_body end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
16 17 18 |
# File 'lib/warrant/errors.rb', line 16 def code @code end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
16 17 18 |
# File 'lib/warrant/errors.rb', line 16 def headers @headers end |
#http_body ⇒ Object (readonly)
Returns the value of attribute http_body.
16 17 18 |
# File 'lib/warrant/errors.rb', line 16 def http_body @http_body end |
#http_headers ⇒ Object (readonly)
Returns the value of attribute http_headers.
16 17 18 |
# File 'lib/warrant/errors.rb', line 16 def http_headers @http_headers end |
#http_status ⇒ Object (readonly)
Returns the value of attribute http_status.
16 17 18 |
# File 'lib/warrant/errors.rb', line 16 def http_status @http_status end |
#json_body ⇒ Object (readonly)
Returns the value of attribute json_body.
16 17 18 |
# File 'lib/warrant/errors.rb', line 16 def json_body @json_body end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
16 17 18 |
# File 'lib/warrant/errors.rb', line 16 def @message end |
Class Method Details
.initialize_error_from_response(response) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/warrant/errors.rb', line 28 def self.initialize_error_from_response(response) response_json = JSON.parse(response.body) self.new( response_json['code'], Util.snake_case(response_json['message']), response.code, response.to_hash, response.body, response_json ) end |