Class: ShellDataReportingApIs::FuelConsumptionData

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/shell_data_reporting_ap_is/models/fuel_consumption_data.rb

Overview

FuelConsumptionData Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(account_name = SKIP, account_number = SKIP, payer_name = SKIP, payer_number = SKIP, card_number = SKIP, card_group_id = SKIP, card_group_name = SKIP, driver_name = SKIP, license_number = SKIP, initial_odometer = SKIP, last_odometer = SKIP, distance = SKIP, fuel_consumption = SKIP, fuel_net_amount = SKIP, discount = SKIP, fuel_tax = SKIP, fuel_volume = SKIP, gross_non_fuel_expenses = SKIP, co2_produced = SKIP, transaction_count = SKIP) ⇒ FuelConsumptionData

Returns a new instance of FuelConsumptionData.



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_data.rb', line 170

def initialize( = SKIP,  = SKIP,
               payer_name = SKIP, payer_number = SKIP, card_number = SKIP,
               card_group_id = SKIP, card_group_name = SKIP,
               driver_name = SKIP, license_number = SKIP,
               initial_odometer = SKIP, last_odometer = SKIP,
               distance = SKIP, fuel_consumption = SKIP,
               fuel_net_amount = SKIP, discount = SKIP, fuel_tax = SKIP,
               fuel_volume = SKIP, gross_non_fuel_expenses = SKIP,
               co2_produced = SKIP, transaction_count = SKIP)
  @account_name =  unless  == SKIP
  @account_number =  unless  == SKIP
  @payer_name = payer_name unless payer_name == SKIP
  @payer_number = payer_number unless payer_number == SKIP
  @card_number = card_number unless card_number == SKIP
  @card_group_id = card_group_id unless card_group_id == SKIP
  @card_group_name = card_group_name unless card_group_name == SKIP
  @driver_name = driver_name unless driver_name == SKIP
  @license_number = license_number unless license_number == SKIP
  @initial_odometer = initial_odometer unless initial_odometer == SKIP
  @last_odometer = last_odometer unless last_odometer == SKIP
  @distance = distance unless distance == SKIP
  @fuel_consumption = fuel_consumption unless fuel_consumption == SKIP
  @fuel_net_amount = fuel_net_amount unless fuel_net_amount == SKIP
  @discount = discount unless discount == SKIP
  @fuel_tax = fuel_tax unless fuel_tax == SKIP
  @fuel_volume = fuel_volume unless fuel_volume == SKIP
  @gross_non_fuel_expenses = gross_non_fuel_expenses unless gross_non_fuel_expenses == SKIP
  @co2_produced = co2_produced unless co2_produced == SKIP
  @transaction_count = transaction_count unless transaction_count == SKIP
end

Instance Attribute Details

#account_nameString

Account Name

Returns:

  • (String)


14
15
16
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_data.rb', line 14

def 
  @account_name
end

#account_numberString

Account Number

Returns:

  • (String)


18
19
20
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_data.rb', line 18

def 
  @account_number
end

#card_group_idInteger

Card group ID

Returns:

  • (Integer)


34
35
36
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_data.rb', line 34

def card_group_id
  @card_group_id
end

#card_group_nameString

Card group name

Returns:

  • (String)


38
39
40
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_data.rb', line 38

def card_group_name
  @card_group_name
end

#card_numberString

Card PAN

Returns:

  • (String)


30
31
32
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_data.rb', line 30

def card_number
  @card_number
end

#co2_producedFloat

Total Co2 produced

Returns:

  • (Float)


86
87
88
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_data.rb', line 86

def co2_produced
  @co2_produced
end

#discountFloat

Total Discount

Returns:

  • (Float)


70
71
72
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_data.rb', line 70

def discount
  @discount
end

#distanceFloat

Distance in KM or Miles based on Customer and Colco Settings

Returns:

  • (Float)


58
59
60
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_data.rb', line 58

def distance
  @distance
end

#driver_nameString

Driver name

Returns:

  • (String)


42
43
44
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_data.rb', line 42

def driver_name
  @driver_name
end

#fuel_consumptionFloat

Total Fuel Consumption.

Returns:

  • (Float)


62
63
64
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_data.rb', line 62

def fuel_consumption
  @fuel_consumption
end

#fuel_net_amountFloat

Net Fuel Amount

Returns:

  • (Float)


66
67
68
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_data.rb', line 66

def fuel_net_amount
  @fuel_net_amount
end

#fuel_taxFloat

Fuel Tax Amount

Returns:

  • (Float)


74
75
76
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_data.rb', line 74

def fuel_tax
  @fuel_tax
end

#fuel_volumeFloat

Total Fuel Volume in Litres

Returns:

  • (Float)


78
79
80
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_data.rb', line 78

def fuel_volume
  @fuel_volume
end

#gross_non_fuel_expensesFloat

Gross Nonfuel Amount

Returns:

  • (Float)


82
83
84
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_data.rb', line 82

def gross_non_fuel_expenses
  @gross_non_fuel_expenses
end

#initial_odometerFloat

First transaction odometer reading

Returns:

  • (Float)


50
51
52
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_data.rb', line 50

def initial_odometer
  @initial_odometer
end

#last_odometerFloat

Last transaction odometer reading

Returns:

  • (Float)


54
55
56
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_data.rb', line 54

def last_odometer
  @last_odometer
end

#license_numberString

Vehicle registration number

Returns:

  • (String)


46
47
48
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_data.rb', line 46

def license_number
  @license_number
end

#payer_nameString

Payment customer Name

Returns:

  • (String)


22
23
24
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_data.rb', line 22

def payer_name
  @payer_name
end

#payer_numberString

Payment customer number

Returns:

  • (String)


26
27
28
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_data.rb', line 26

def payer_number
  @payer_number
end

#transaction_countFloat

Total Transaction Count

Returns:

  • (Float)


90
91
92
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_data.rb', line 90

def transaction_count
  @transaction_count
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_data.rb', line 202

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('AccountName') ? hash['AccountName'] : SKIP
   = hash.key?('AccountNumber') ? hash['AccountNumber'] : SKIP
  payer_name = hash.key?('PayerName') ? hash['PayerName'] : SKIP
  payer_number = hash.key?('PayerNumber') ? hash['PayerNumber'] : SKIP
  card_number = hash.key?('CardNumber') ? hash['CardNumber'] : SKIP
  card_group_id = hash.key?('CardGroupId') ? hash['CardGroupId'] : SKIP
  card_group_name =
    hash.key?('CardGroupName') ? hash['CardGroupName'] : SKIP
  driver_name = hash.key?('DriverName') ? hash['DriverName'] : SKIP
  license_number = hash.key?('LicenseNumber') ? hash['LicenseNumber'] : SKIP
  initial_odometer =
    hash.key?('InitialOdometer') ? hash['InitialOdometer'] : SKIP
  last_odometer = hash.key?('LastOdometer') ? hash['LastOdometer'] : SKIP
  distance = hash.key?('Distance') ? hash['Distance'] : SKIP
  fuel_consumption =
    hash.key?('FuelConsumption') ? hash['FuelConsumption'] : SKIP
  fuel_net_amount =
    hash.key?('FuelNetAmount') ? hash['FuelNetAmount'] : SKIP
  discount = hash.key?('Discount') ? hash['Discount'] : SKIP
  fuel_tax = hash.key?('FuelTax') ? hash['FuelTax'] : SKIP
  fuel_volume = hash.key?('FuelVolume') ? hash['FuelVolume'] : SKIP
  gross_non_fuel_expenses =
    hash.key?('GrossNonFuelExpenses') ? hash['GrossNonFuelExpenses'] : SKIP
  co2_produced = hash.key?('CO2Produced') ? hash['CO2Produced'] : SKIP
  transaction_count =
    hash.key?('TransactionCount') ? hash['TransactionCount'] : SKIP

  # Create object from extracted values.
  FuelConsumptionData.new(,
                          ,
                          payer_name,
                          payer_number,
                          card_number,
                          card_group_id,
                          card_group_name,
                          driver_name,
                          license_number,
                          initial_odometer,
                          last_odometer,
                          distance,
                          fuel_consumption,
                          fuel_net_amount,
                          discount,
                          fuel_tax,
                          fuel_volume,
                          gross_non_fuel_expenses,
                          co2_produced,
                          transaction_count)
end

.namesObject

A mapping from model property names to API property names.



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_data.rb', line 93

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_name'] = 'AccountName'
  @_hash['account_number'] = 'AccountNumber'
  @_hash['payer_name'] = 'PayerName'
  @_hash['payer_number'] = 'PayerNumber'
  @_hash['card_number'] = 'CardNumber'
  @_hash['card_group_id'] = 'CardGroupId'
  @_hash['card_group_name'] = 'CardGroupName'
  @_hash['driver_name'] = 'DriverName'
  @_hash['license_number'] = 'LicenseNumber'
  @_hash['initial_odometer'] = 'InitialOdometer'
  @_hash['last_odometer'] = 'LastOdometer'
  @_hash['distance'] = 'Distance'
  @_hash['fuel_consumption'] = 'FuelConsumption'
  @_hash['fuel_net_amount'] = 'FuelNetAmount'
  @_hash['discount'] = 'Discount'
  @_hash['fuel_tax'] = 'FuelTax'
  @_hash['fuel_volume'] = 'FuelVolume'
  @_hash['gross_non_fuel_expenses'] = 'GrossNonFuelExpenses'
  @_hash['co2_produced'] = 'CO2Produced'
  @_hash['transaction_count'] = 'TransactionCount'
  @_hash
end

.nullablesObject

An array for nullable fields



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_data.rb', line 145

def self.nullables
  %w[
    account_name
    account_number
    payer_name
    payer_number
    card_number
    card_group_id
    card_group_name
    driver_name
    license_number
    initial_odometer
    last_odometer
    distance
    fuel_consumption
    fuel_net_amount
    discount
    fuel_tax
    fuel_volume
    gross_non_fuel_expenses
    co2_produced
    transaction_count
  ]
end

.optionalsObject

An array for optional fields



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/shell_data_reporting_ap_is/models/fuel_consumption_data.rb', line 119

def self.optionals
  %w[
    account_name
    account_number
    payer_name
    payer_number
    card_number
    card_group_id
    card_group_name
    driver_name
    license_number
    initial_odometer
    last_odometer
    distance
    fuel_consumption
    fuel_net_amount
    discount
    fuel_tax
    fuel_volume
    gross_non_fuel_expenses
    co2_produced
    transaction_count
  ]
end