Class: ShellSmartPayApi::FinaliseFuelingRequest

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

Overview

FinaliseFuelingRequest Model.

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(site_name = SKIP, timestamp = SKIP, volume_quantity = SKIP, volume_unit = SKIP, final_price = SKIP, currency = SKIP, status = SKIP, site_address = SKIP, original_price = SKIP, discount = SKIP, payment = SKIP, products = SKIP, mpp_transaction_id = SKIP) ⇒ FinaliseFuelingRequest

Returns a new instance of FinaliseFuelingRequest.



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/shell_smart_pay_api/models/finalise_fueling_request.rb', line 107

def initialize(site_name = SKIP, timestamp = SKIP, volume_quantity = SKIP,
               volume_unit = SKIP, final_price = SKIP, currency = SKIP,
               status = SKIP, site_address = SKIP, original_price = SKIP,
               discount = SKIP, payment = SKIP, products = SKIP,
               mpp_transaction_id = SKIP)
  @site_name = site_name unless site_name == SKIP
  @timestamp = timestamp unless timestamp == SKIP
  @volume_quantity = volume_quantity unless volume_quantity == SKIP
  @volume_unit = volume_unit unless volume_unit == SKIP
  @final_price = final_price unless final_price == SKIP
  @currency = currency unless currency == SKIP
  @status = status unless status == SKIP
  @site_address = site_address unless site_address == SKIP
  @original_price = original_price unless original_price == SKIP
  @discount = discount unless discount == SKIP
  @payment = payment unless payment == SKIP
  @products = products unless products == SKIP
  @mpp_transaction_id = mpp_transaction_id unless mpp_transaction_id == SKIP
end

Instance Attribute Details

#currencyString

TODO: Write general description for this method

Returns:

  • (String)


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

def currency
  @currency
end

#discountFloat

TODO: Write general description for this method

Returns:

  • (Float)


50
51
52
# File 'lib/shell_smart_pay_api/models/finalise_fueling_request.rb', line 50

def discount
  @discount
end

#final_priceFloat

TODO: Write general description for this method

Returns:

  • (Float)


30
31
32
# File 'lib/shell_smart_pay_api/models/finalise_fueling_request.rb', line 30

def final_price
  @final_price
end

#mpp_transaction_idString

TODO: Write general description for this method

Returns:

  • (String)


62
63
64
# File 'lib/shell_smart_pay_api/models/finalise_fueling_request.rb', line 62

def mpp_transaction_id
  @mpp_transaction_id
end

#original_priceFloat

TODO: Write general description for this method

Returns:

  • (Float)


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

def original_price
  @original_price
end

#paymentPayment

TODO: Write general description for this method

Returns:



54
55
56
# File 'lib/shell_smart_pay_api/models/finalise_fueling_request.rb', line 54

def payment
  @payment
end

#productsArray[Product]

TODO: Write general description for this method

Returns:



58
59
60
# File 'lib/shell_smart_pay_api/models/finalise_fueling_request.rb', line 58

def products
  @products
end

#site_addressString

TODO: Write general description for this method

Returns:

  • (String)


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

def site_address
  @site_address
end

#site_nameString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/shell_smart_pay_api/models/finalise_fueling_request.rb', line 14

def site_name
  @site_name
end

#statusString

TODO: Write general description for this method

Returns:

  • (String)


38
39
40
# File 'lib/shell_smart_pay_api/models/finalise_fueling_request.rb', line 38

def status
  @status
end

#timestampInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def timestamp
  @timestamp
end

#volume_quantityFloat

TODO: Write general description for this method

Returns:

  • (Float)


22
23
24
# File 'lib/shell_smart_pay_api/models/finalise_fueling_request.rb', line 22

def volume_quantity
  @volume_quantity
end

#volume_unitString

TODO: Write general description for this method

Returns:

  • (String)


26
27
28
# File 'lib/shell_smart_pay_api/models/finalise_fueling_request.rb', line 26

def volume_unit
  @volume_unit
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/shell_smart_pay_api/models/finalise_fueling_request.rb', line 128

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  site_name = hash.key?('siteName') ? hash['siteName'] : SKIP
  timestamp = hash.key?('timestamp') ? hash['timestamp'] : SKIP
  volume_quantity =
    hash.key?('volumeQuantity') ? hash['volumeQuantity'] : SKIP
  volume_unit = hash.key?('volumeUnit') ? hash['volumeUnit'] : SKIP
  final_price = hash.key?('finalPrice') ? hash['finalPrice'] : SKIP
  currency = hash.key?('currency') ? hash['currency'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  site_address = hash.key?('siteAddress') ? hash['siteAddress'] : SKIP
  original_price = hash.key?('originalPrice') ? hash['originalPrice'] : SKIP
  discount = hash.key?('discount') ? hash['discount'] : SKIP
  payment = Payment.from_hash(hash['payment']) if hash['payment']
  # Parameter is an array, so we need to iterate through it

  products = nil
  unless hash['products'].nil?
    products = []
    hash['products'].each do |structure|
      products << (Product.from_hash(structure) if structure)
    end
  end

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

  # Create object from extracted values.

  FinaliseFuelingRequest.new(site_name,
                             timestamp,
                             volume_quantity,
                             volume_unit,
                             final_price,
                             currency,
                             status,
                             site_address,
                             original_price,
                             discount,
                             payment,
                             products,
                             mpp_transaction_id)
end

.namesObject

A mapping from model property names to API property names.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/shell_smart_pay_api/models/finalise_fueling_request.rb', line 65

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['site_name'] = 'siteName'
  @_hash['timestamp'] = 'timestamp'
  @_hash['volume_quantity'] = 'volumeQuantity'
  @_hash['volume_unit'] = 'volumeUnit'
  @_hash['final_price'] = 'finalPrice'
  @_hash['currency'] = 'currency'
  @_hash['status'] = 'status'
  @_hash['site_address'] = 'siteAddress'
  @_hash['original_price'] = 'originalPrice'
  @_hash['discount'] = 'discount'
  @_hash['payment'] = 'payment'
  @_hash['products'] = 'products'
  @_hash['mpp_transaction_id'] = 'mppTransactionId'
  @_hash
end

.nullablesObject

An array for nullable fields



103
104
105
# File 'lib/shell_smart_pay_api/models/finalise_fueling_request.rb', line 103

def self.nullables
  []
end

.optionalsObject

An array for optional fields



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/shell_smart_pay_api/models/finalise_fueling_request.rb', line 84

def self.optionals
  %w[
    site_name
    timestamp
    volume_quantity
    volume_unit
    final_price
    currency
    status
    site_address
    original_price
    discount
    payment
    products
    mpp_transaction_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



184
185
186
187
188
189
190
191
192
# File 'lib/shell_smart_pay_api/models/finalise_fueling_request.rb', line 184

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} site_name: #{@site_name.inspect}, timestamp: #{@timestamp.inspect},"\
  " volume_quantity: #{@volume_quantity.inspect}, volume_unit: #{@volume_unit.inspect},"\
  " final_price: #{@final_price.inspect}, currency: #{@currency.inspect}, status:"\
  " #{@status.inspect}, site_address: #{@site_address.inspect}, original_price:"\
  " #{@original_price.inspect}, discount: #{@discount.inspect}, payment: #{@payment.inspect},"\
  " products: #{@products.inspect}, mpp_transaction_id: #{@mpp_transaction_id.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



174
175
176
177
178
179
180
181
# File 'lib/shell_smart_pay_api/models/finalise_fueling_request.rb', line 174

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} site_name: #{@site_name}, timestamp: #{@timestamp}, volume_quantity:"\
  " #{@volume_quantity}, volume_unit: #{@volume_unit}, final_price: #{@final_price}, currency:"\
  " #{@currency}, status: #{@status}, site_address: #{@site_address}, original_price:"\
  " #{@original_price}, discount: #{@discount}, payment: #{@payment}, products: #{@products},"\
  " mpp_transaction_id: #{@mpp_transaction_id}>"
end