Class: CtdDocumentation::AuthAuthenticate401ErrorException

Inherits:
APIException
  • Object
show all
Defined in:
lib/ctd_documentation/exceptions/auth_authenticate401_error_exception.rb

Overview

Auth Authenticate 401 Error class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reason, response) ⇒ AuthAuthenticate401ErrorException

The constructor.

Parameters:

  • The (String)

    reason for raising an exception.

  • The (HttpResponse)

    HttpReponse of the API call.



31
32
33
34
35
# File 'lib/ctd_documentation/exceptions/auth_authenticate401_error_exception.rb', line 31

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

Instance Attribute Details

#errorString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/ctd_documentation/exceptions/auth_authenticate401_error_exception.rb', line 14

def error
  @error
end

#exceptionString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/ctd_documentation/exceptions/auth_authenticate401_error_exception.rb', line 18

def exception
  @exception
end

#exception_classString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/ctd_documentation/exceptions/auth_authenticate401_error_exception.rb', line 22

def exception_class
  @exception_class
end

#successTrueClass|FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass|FalseClass)


26
27
28
# File 'lib/ctd_documentation/exceptions/auth_authenticate401_error_exception.rb', line 26

def success
  @success
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



40
41
42
43
44
45
46
# File 'lib/ctd_documentation/exceptions/auth_authenticate401_error_exception.rb', line 40

def unbox(hash)
  @error = hash.key?('error') ? hash['error'] : SKIP
  @exception = hash.key?('exception') ? hash['exception'] : SKIP
  @exception_class =
    hash.key?('exception_class') ? hash['exception_class'] : SKIP
  @success = hash.key?('success') ? hash['success'] : SKIP
end