Class: ShellCardManagementApIs::OAuthProviderException

Inherits:
APIException
  • Object
show all
Defined in:
lib/shell_card_management_ap_is/exceptions/o_auth_provider_exception.rb

Overview

OAuth 2 Authorization endpoint exception.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reason, response) ⇒ OAuthProviderException

The constructor.

Parameters:

  • The (String)

    reason for raising an exception.

  • The (HttpResponse)

    HttpReponse of the API call.



32
33
34
35
36
# File 'lib/shell_card_management_ap_is/exceptions/o_auth_provider_exception.rb', line 32

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

Instance Attribute Details

#errorOAuthProviderErrorEnum

Gets or sets error code.



14
15
16
# File 'lib/shell_card_management_ap_is/exceptions/o_auth_provider_exception.rb', line 14

def error
  @error
end

#error_descriptionString

Gets or sets human-readable text providing additional information on error. Used to assist the client developer in understanding the error that occurred.

Returns:

  • (String)


21
22
23
# File 'lib/shell_card_management_ap_is/exceptions/o_auth_provider_exception.rb', line 21

def error_description
  @error_description
end

#error_uriString

Gets or sets a URI identifying a human-readable web page with information about the error, used to provide the client developer with additional information about the error.

Returns:

  • (String)


27
28
29
# File 'lib/shell_card_management_ap_is/exceptions/o_auth_provider_exception.rb', line 27

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



41
42
43
44
45
46
# File 'lib/shell_card_management_ap_is/exceptions/o_auth_provider_exception.rb', line 41

def unbox(hash)
  @error = hash.key?('error') ? hash['error'] : nil
  @error_description =
    hash.key?('error_description') ? hash['error_description'] : SKIP
  @error_uri = hash.key?('error_uri') ? hash['error_uri'] : SKIP
end