Class: ShellSmartPayApi::CancelFuelingErrorResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/shell_smart_pay_api/models/cancel_fueling_error_response.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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(error_code = SKIP, error_description = SKIP, errors = SKIP) ⇒ CancelFuelingErrorResponse

Returns a new instance of CancelFuelingErrorResponse.



59
60
61
62
63
# File 'lib/shell_smart_pay_api/models/cancel_fueling_error_response.rb', line 59

def initialize(error_code = SKIP, error_description = SKIP, errors = SKIP)
  @error_code = error_code unless error_code == SKIP
  @error_description = error_description unless error_description == SKIP
  @errors = errors unless errors == SKIP
end

Instance Attribute Details

#error_codeString

The high level error code (e.g. missing data)

Returns:

  • (String)


24
25
26
# File 'lib/shell_smart_pay_api/models/cancel_fueling_error_response.rb', line 24

def error_code
  @error_code
end

#error_descriptionString

The high level error message (e.g. mandatory fields have not been specified.

Returns:

  • (String)


29
30
31
# File 'lib/shell_smart_pay_api/models/cancel_fueling_error_response.rb', line 29

def error_description
  @error_description
end

#errorsArray[MppError]

Array of error objects. Majority of the time the errorCode and errorDescription will suffice

Returns:



34
35
36
# File 'lib/shell_smart_pay_api/models/cancel_fueling_error_response.rb', line 34

def errors
  @errors
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/shell_smart_pay_api/models/cancel_fueling_error_response.rb', line 66

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the 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')

  # Create object from extracted values.
  CancelFuelingErrorResponse.new(error_code,
                                 error_description,
                                 errors)
end

.namesObject

A mapping from model property names to API property names.



37
38
39
40
41
42
43
# File 'lib/shell_smart_pay_api/models/cancel_fueling_error_response.rb', line 37

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['error_code'] = 'errorCode'
  @_hash['error_description'] = 'errorDescription'
  @_hash['errors'] = 'errors'
  @_hash
end

.nullablesObject

An array for nullable fields



55
56
57
# File 'lib/shell_smart_pay_api/models/cancel_fueling_error_response.rb', line 55

def self.nullables
  []
end

.optionalsObject

An array for optional fields



46
47
48
49
50
51
52
# File 'lib/shell_smart_pay_api/models/cancel_fueling_error_response.rb', line 46

def self.optionals
  %w[
    error_code
    error_description
    errors
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



98
99
100
101
102
# File 'lib/shell_smart_pay_api/models/cancel_fueling_error_response.rb', line 98

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_sObject

Provides a human-readable string representation of the object.



91
92
93
94
95
# File 'lib/shell_smart_pay_api/models/cancel_fueling_error_response.rb', line 91

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