Exception: Finix::Errors
- Inherits:
-
StandardError
- Object
- StandardError
- Finix::Errors
- Includes:
- HalResource
- Defined in:
- lib/finix/errors.rb
Direct Known Subclasses
BadRequest, Forbidden, InternalServerError, MethodNotAllowed, NotFound, PaymentRequired, Unauthorized, UnprocessableEntity
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Attributes included from HalResource
Instance Method Summary collapse
-
#initialize(response = nil) ⇒ Errors
constructor
A new instance of Errors.
- #to_s ⇒ Object
Methods included from HalResource
#load_page_from_response!, #method_missing
Constructor Details
#initialize(response = nil) ⇒ Errors
Returns a new instance of Errors.
9 10 11 12 13 14 15 16 |
# File 'lib/finix/errors.rb', line 9 def initialize(response=nil) @code = response[:status].to_i @total = response[:body]['total'].to_i load_page_from_response! response @attributes['errors'] = @attributes.delete 'items' @attributes.delete 'page' end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Finix::HalResource
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
6 7 8 |
# File 'lib/finix/errors.rb', line 6 def code @code end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
7 8 9 |
# File 'lib/finix/errors.rb', line 7 def total @total end |
Instance Method Details
#to_s ⇒ Object
18 19 20 |
# File 'lib/finix/errors.rb', line 18 def to_s "#{@errors}" end |