Exception: MdNotes::OAuthProviderException

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

Overview

OAuth 2 Authorization endpoint exception.

Instance Attribute Summary collapse

Attributes inherited from APIException

#response, #response_code

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.



29
30
31
32
33
# File 'lib/md_notes/exceptions/o_auth_provider_exception.rb', line 29

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.



11
12
13
# File 'lib/md_notes/exceptions/o_auth_provider_exception.rb', line 11

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)


18
19
20
# File 'lib/md_notes/exceptions/o_auth_provider_exception.rb', line 18

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)


24
25
26
# File 'lib/md_notes/exceptions/o_auth_provider_exception.rb', line 24

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



38
39
40
41
42
# File 'lib/md_notes/exceptions/o_auth_provider_exception.rb', line 38

def unbox(hash)
  @error = hash['error']
  @error_description = hash['error_description']
  @error_uri = hash['error_uri']
end