Class: ShellSmartPayApi::MppAccesTokenErrorResponseException

Inherits:
APIException
  • Object
show all
Defined in:
lib/shell_smart_pay_api/exceptions/mpp_acces_token_error_response_exception.rb

Overview

MppAccesTokenErrorResponse class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reason, response) ⇒ MppAccesTokenErrorResponseException

The constructor.

Parameters:

  • The (String)

    reason for raising an exception.

  • The (HttpResponse)

    HttpReponse of the API call.



28
29
30
31
32
# File 'lib/shell_smart_pay_api/exceptions/mpp_acces_token_error_response_exception.rb', line 28

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

Instance Attribute Details

#errorString

error code or short description

Returns:

  • (String)


14
15
16
# File 'lib/shell_smart_pay_api/exceptions/mpp_acces_token_error_response_exception.rb', line 14

def error
  @error
end

#error_codeString

error code or short description due to invalid request or invalid client ID

Returns:

  • (String)


19
20
21
# File 'lib/shell_smart_pay_api/exceptions/mpp_acces_token_error_response_exception.rb', line 19

def error_code
  @error_code
end

#error_descriptionString

Description of the error

Returns:

  • (String)


23
24
25
# File 'lib/shell_smart_pay_api/exceptions/mpp_acces_token_error_response_exception.rb', line 23

def error_description
  @error_description
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



52
53
54
55
56
# File 'lib/shell_smart_pay_api/exceptions/mpp_acces_token_error_response_exception.rb', line 52

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

#to_sObject

Provides a human-readable string representation of the object.



45
46
47
48
49
# File 'lib/shell_smart_pay_api/exceptions/mpp_acces_token_error_response_exception.rb', line 45

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

#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



37
38
39
40
41
42
# File 'lib/shell_smart_pay_api/exceptions/mpp_acces_token_error_response_exception.rb', line 37

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