Class: Verizon::EdgeDiscoveryResultException

Inherits:
APIException
  • Object
show all
Defined in:
lib/verizon/exceptions/edge_discovery_result_exception.rb

Overview

Base type for all errors.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reason, response) ⇒ EdgeDiscoveryResultException

The constructor.

Parameters:

  • The (String)

    reason for raising an exception.

  • The (HttpResponse)

    HttpReponse of the API call.



28
29
30
31
32
# File 'lib/verizon/exceptions/edge_discovery_result_exception.rb', line 28

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

Instance Attribute Details

#dataEdgeDiscoveryResultData

For cases where user input exceeds the boundary values an additional ‘data’ key will be returned with a relevant description.



23
24
25
# File 'lib/verizon/exceptions/edge_discovery_result_exception.rb', line 23

def data
  @data
end

#messageString

Error details.

Returns:

  • (String)


18
19
20
# File 'lib/verizon/exceptions/edge_discovery_result_exception.rb', line 18

def message
  @message
end

#statusString

HTTP status code or status of response.

Returns:

  • (String)


14
15
16
# File 'lib/verizon/exceptions/edge_discovery_result_exception.rb', line 14

def status
  @status
end

Instance Method Details

#unbox(hash) ⇒ Object

Populates this object by extracting properties from a hash. response body.

Parameters:

  • The (Hash)

    deserialized response sent by the server in the



37
38
39
40
41
# File 'lib/verizon/exceptions/edge_discovery_result_exception.rb', line 37

def unbox(hash)
  @status = hash.key?('status') ? hash['status'] : nil
  @message = hash.key?('message') ? hash['message'] : nil
  @data = EdgeDiscoveryResultData.from_hash(hash['data']) if hash['data']
end