Exception: SuggestGrid::DeleteErrorResponseException

Inherits:
APIException
  • Object
show all
Defined in:
lib/suggest_grid/exceptions/delete_error_response_exception.rb

Instance Attribute Summary collapse

Attributes inherited from APIException

#context, #response_code

Instance Method Summary collapse

Constructor Details

#initialize(reason, context) ⇒ DeleteErrorResponseException

The constructor.

Parameters:

  • The (String)

    reason for raising an exception

  • The (HttpContext)

    HttpContext of the API call.



32
33
34
35
36
37
38
39
# File 'lib/suggest_grid/exceptions/delete_error_response_exception.rb', line 32

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

#deletedLong

The number of records deleted.

Returns:

  • (Long)


23
24
25
# File 'lib/suggest_grid/exceptions/delete_error_response_exception.rb', line 23

def deleted
  @deleted
end

#error_descriptionString

Description of the response.

Returns:



11
12
13
# File 'lib/suggest_grid/exceptions/delete_error_response_exception.rb', line 11

def error_description
  @error_description
end

#error_textString

Message of the response.

Returns:



7
8
9
# File 'lib/suggest_grid/exceptions/delete_error_response_exception.rb', line 7

def error_text
  @error_text
end

#error_uriString

The URI of the error for more details.

Returns:



15
16
17
# File 'lib/suggest_grid/exceptions/delete_error_response_exception.rb', line 15

def error_uri
  @error_uri
end

#failedLong

The number of records failed to be deleted.

Returns:

  • (Long)


27
28
29
# File 'lib/suggest_grid/exceptions/delete_error_response_exception.rb', line 27

def failed
  @failed
end

#foundLong

The number of records found.

Returns:

  • (Long)


19
20
21
# File 'lib/suggest_grid/exceptions/delete_error_response_exception.rb', line 19

def found
  @found
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.



43
44
45
46
47
48
49
50
# File 'lib/suggest_grid/exceptions/delete_error_response_exception.rb', line 43

def unbox(hash)
  @error_text = hash["error_text"]
  @error_description = hash["error_description"]
  @error_uri = hash["error_uri"]
  @found = hash["found"]
  @deleted = hash["deleted"]
  @failed = hash["failed"]
end