Class: ShellSmartPayApi::CancelFuelingErrorResponseErrorException
- Inherits:
-
APIException
- Object
- CoreLibrary::ApiException
- APIException
- ShellSmartPayApi::CancelFuelingErrorResponseErrorException
- Defined in:
- lib/shell_smart_pay_api/exceptions/cancel_fueling_error_response_error_exception.rb
Overview
# Digital Payments – Errors This section details the structure of the response Body vs. the different types of errors that could be returned when Digital Payments system responds with a 400 Response Code. | Error Code | Error Description | Suggested message to end user | |- |- |- | | 9342 | Transaction not cancelled, Txn number unknown | Oops sorry! We are unable to cancel the transaction. Please wait for the site to cancel the transaction before you retry | | 50004 | Transaction not cancelled, dispensing is already in progress | Transaction cannot be cancelled, fueling already in progress | | 50059 | Transaction not cancelable (not in a ‘Processing state’) | Transaction cannot be cancelled, fuel has already been dispensed |
Instance Attribute Summary collapse
-
#error_code ⇒ String
The high level error code (e.g. missing data).
-
#error_description ⇒ String
The high level error message (e.g. mandatory fields have not been specified..
-
#errors ⇒ Array[MppError]
Array of error objects.
Instance Method Summary collapse
-
#initialize(reason, response) ⇒ CancelFuelingErrorResponseErrorException
constructor
The constructor.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
-
#unbox(hash) ⇒ Object
Populates this object by extracting properties from a hash.
Constructor Details
#initialize(reason, response) ⇒ CancelFuelingErrorResponseErrorException
The constructor.
39 40 41 42 43 |
# File 'lib/shell_smart_pay_api/exceptions/cancel_fueling_error_response_error_exception.rb', line 39 def initialize(reason, response) super(reason, response) hash = APIHelper.json_deserialize(@response.raw_body) unbox(hash) end |
Instance Attribute Details
#error_code ⇒ String
The high level error code (e.g. missing data)
24 25 26 |
# File 'lib/shell_smart_pay_api/exceptions/cancel_fueling_error_response_error_exception.rb', line 24 def error_code @error_code end |
#error_description ⇒ String
The high level error message (e.g. mandatory fields have not been specified.
29 30 31 |
# File 'lib/shell_smart_pay_api/exceptions/cancel_fueling_error_response_error_exception.rb', line 29 def error_description @error_description end |
#errors ⇒ Array[MppError]
Array of error objects. Majority of the time the errorCode and errorDescription will suffice
34 35 36 |
# File 'lib/shell_smart_pay_api/exceptions/cancel_fueling_error_response_error_exception.rb', line 34 def errors @errors end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
72 73 74 75 76 |
# File 'lib/shell_smart_pay_api/exceptions/cancel_fueling_error_response_error_exception.rb', line 72 def inspect class_name = self.class.name.split('::').last "<#{class_name} error_code: #{@error_code.inspect}, error_description:"\ " #{@error_description.inspect}, errors: #{@errors.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
65 66 67 68 69 |
# File 'lib/shell_smart_pay_api/exceptions/cancel_fueling_error_response_error_exception.rb', line 65 def to_s class_name = self.class.name.split('::').last "<#{class_name} error_code: #{@error_code}, error_description: #{@error_description},"\ " errors: #{@errors}>" end |
#unbox(hash) ⇒ Object
Populates this object by extracting properties from a hash. response body.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/shell_smart_pay_api/exceptions/cancel_fueling_error_response_error_exception.rb', line 48 def unbox(hash) @error_code = hash.key?('errorCode') ? hash['errorCode'] : SKIP @error_description = hash.key?('errorDescription') ? hash['errorDescription'] : SKIP # Parameter is an array, so we need to iterate through it @errors = nil unless hash['errors'].nil? @errors = [] hash['errors'].each do |structure| @errors << (MppError.from_hash(structure) if structure) end end @errors = SKIP unless hash.key?('errors') end |