Class: ThePlaidApi::OauthErrorResponseException

Inherits:
APIException
  • Object
show all
Defined in:
lib/the_plaid_api/exceptions/oauth_error_response_exception.rb

Overview

OAuth error response

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reason, response) ⇒ OauthErrorResponseException

The constructor.

Parameters:

  • reason (String)

    The reason for raising an exception.

  • response (HttpResponse)

    The HttpReponse of the API call.



33
34
35
36
37
# File 'lib/the_plaid_api/exceptions/oauth_error_response_exception.rb', line 33

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

Instance Attribute Details

#errorOauthErrorCode

OAuth error code

Returns:



14
15
16
# File 'lib/the_plaid_api/exceptions/oauth_error_response_exception.rb', line 14

def error
  @error
end

#error_descriptionString

A human-readable description of the error

Returns:

  • (String)


18
19
20
# File 'lib/the_plaid_api/exceptions/oauth_error_response_exception.rb', line 18

def error_description
  @error_description
end

#error_uriString

A URI identifying the specific error

Returns:

  • (String)


22
23
24
# File 'lib/the_plaid_api/exceptions/oauth_error_response_exception.rb', line 22

def error_uri
  @error_uri
end

#request_idString

A unique identifier for the request, which can be used for troubleshooting. This identifier, like all Plaid identifiers, is case sensitive.

Returns:

  • (String)


28
29
30
# File 'lib/the_plaid_api/exceptions/oauth_error_response_exception.rb', line 28

def request_id
  @request_id
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



60
61
62
63
64
# File 'lib/the_plaid_api/exceptions/oauth_error_response_exception.rb', line 60

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} error: #{@error.inspect}, error_description: #{@error_description.inspect},"\
  " error_uri: #{@error_uri.inspect}, request_id: #{@request_id.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



53
54
55
56
57
# File 'lib/the_plaid_api/exceptions/oauth_error_response_exception.rb', line 53

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} error: #{@error}, error_description: #{@error_description}, error_uri:"\
  " #{@error_uri}, request_id: #{@request_id}>"
end

#unbox(hash) ⇒ Object

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

Parameters:

  • hash (Hash)

    The deserialized response sent by the server in the



42
43
44
45
46
47
48
49
50
# File 'lib/the_plaid_api/exceptions/oauth_error_response_exception.rb', line 42

def unbox(hash)
  return nil unless hash

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