Exception: Finix::Errors

Inherits:
StandardError
  • Object
show all
Includes:
HalResource
Defined in:
lib/finix/errors.rb

Instance Attribute Summary collapse

Attributes included from HalResource

#attributes, #hyperlinks

Instance Method Summary collapse

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

#codeObject (readonly)

Returns the value of attribute code.



6
7
8
# File 'lib/finix/errors.rb', line 6

def code
  @code
end

#totalObject (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_sObject



18
19
20
# File 'lib/finix/errors.rb', line 18

def to_s
  "#{@errors}"
end