Class: ShellSmartPayApi::PrepareFuelingResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/shell_smart_pay_api/models/prepare_fueling_response.rb

Overview

The response of prepare fueling returns

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(mpp_transaction_id = nil, products = SKIP) ⇒ PrepareFuelingResponse

Returns a new instance of PrepareFuelingResponse.



46
47
48
49
# File 'lib/shell_smart_pay_api/models/prepare_fueling_response.rb', line 46

def initialize(mpp_transaction_id = nil, products = SKIP)
  @mpp_transaction_id = mpp_transaction_id
  @products = products unless products == SKIP
end

Instance Attribute Details

#mpp_transaction_idString

The unique identifier of the Order. NB at this stage the Customer hasn’t actually bought anything so there’s no formal transaction associated with the Order. A transaction is not processed until refuelling has been completed successfully and will be triggered by returning the nozzle to the pump.

Returns:

  • (String)


18
19
20
# File 'lib/shell_smart_pay_api/models/prepare_fueling_response.rb', line 18

def mpp_transaction_id
  @mpp_transaction_id
end

#productsArray[String]

An array of Strings that contain the list of products that the user can purchase at the specified Station/Pump. The text is localized based on the country.

Returns:

  • (Array[String])


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

def products
  @products
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/shell_smart_pay_api/models/prepare_fueling_response.rb', line 52

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  mpp_transaction_id =
    hash.key?('mppTransactionId') ? hash['mppTransactionId'] : nil
  products = hash.key?('products') ? hash['products'] : SKIP

  # Create object from extracted values.

  PrepareFuelingResponse.new(mpp_transaction_id,
                             products)
end

.namesObject

A mapping from model property names to API property names.



27
28
29
30
31
32
# File 'lib/shell_smart_pay_api/models/prepare_fueling_response.rb', line 27

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['mpp_transaction_id'] = 'mppTransactionId'
  @_hash['products'] = 'products'
  @_hash
end

.nullablesObject

An array for nullable fields



42
43
44
# File 'lib/shell_smart_pay_api/models/prepare_fueling_response.rb', line 42

def self.nullables
  []
end

.optionalsObject

An array for optional fields



35
36
37
38
39
# File 'lib/shell_smart_pay_api/models/prepare_fueling_response.rb', line 35

def self.optionals
  %w[
    products
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



72
73
74
75
76
# File 'lib/shell_smart_pay_api/models/prepare_fueling_response.rb', line 72

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

#to_sObject

Provides a human-readable string representation of the object.



66
67
68
69
# File 'lib/shell_smart_pay_api/models/prepare_fueling_response.rb', line 66

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} mpp_transaction_id: #{@mpp_transaction_id}, products: #{@products}>"
end