Exception: Gonebusy::EntitiesErrorErrorException

Inherits:
APIException
  • Object
show all
Defined in:
lib/gonebusy/exceptions/entities_error_error_exception.rb

Instance Attribute Summary collapse

Attributes inherited from APIException

#context, #response_code

Instance Method Summary collapse

Constructor Details

#initialize(reason, context) ⇒ EntitiesErrorErrorException

The constructor.

Parameters:

  • The (String)

    reason for raising an exception

  • The (HttpContext)

    HttpContext of the API call.



12
13
14
15
16
17
18
19
# File 'lib/gonebusy/exceptions/entities_error_error_exception.rb', line 12

def initialize(reason, context)
  super(reason, context)
  begin
    hash = APIHelper.json_deserialize(@context.response.raw_body)
    unbox(hash)
  rescue TypeError
  end
end

Instance Attribute Details

#messageString

description of error

Returns:



7
8
9
# File 'lib/gonebusy/exceptions/entities_error_error_exception.rb', line 7

def message
  @message
end

Instance Method Details

#unbox(hash) ⇒ Object

Populates this object by extracting properties from a hash.

Parameters:

  • The (Hash)

    deserialized response sent by the server in the response body.



23
24
25
# File 'lib/gonebusy/exceptions/entities_error_error_exception.rb', line 23

def unbox(hash)
  @message = hash['message']
end