Class: ShellDataReportingApIs::PriceList

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

Overview

PriceList 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(date = SKIP, day = SKIP, type = SKIP, price_list_id = SKIP, price_list_description = SKIP, price_rule_id = SKIP, price_rule_name = SKIP, del_co_id = SKIP, country_code = SKIP, country = SKIP, product_group_id = SKIP, product_group_name = SKIP, product_code = SKIP, product_id = SKIP, product_name = SKIP, price_per_unit = SKIP, currency_code = SKIP, currency_symbol = SKIP, price_type = SKIP, site_group_id = SKIP, site_group_name = SKIP, site_code = SKIP, site_id = SKIP, site_name = SKIP, fuel_network_id = SKIP, network_name = SKIP, price_rule_delco_id = SKIP, price_rule_delco_name = SKIP, price_rule_country = SKIP, price_rule_country_code = SKIP, price_rule_basis_id = SKIP, discount_value = SKIP, price_per_unit_after_discount = SKIP, vat_percentage = SKIP, price_rule_category_id = SKIP, tiers = SKIP) ⇒ PriceList

Returns a new instance of PriceList.



304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 304

def initialize(date = SKIP, day = SKIP, type = SKIP, price_list_id = SKIP,
               price_list_description = SKIP, price_rule_id = SKIP,
               price_rule_name = SKIP, del_co_id = SKIP,
               country_code = SKIP, country = SKIP, product_group_id = SKIP,
               product_group_name = SKIP, product_code = SKIP,
               product_id = SKIP, product_name = SKIP,
               price_per_unit = SKIP, currency_code = SKIP,
               currency_symbol = SKIP, price_type = SKIP,
               site_group_id = SKIP, site_group_name = SKIP,
               site_code = SKIP, site_id = SKIP, site_name = SKIP,
               fuel_network_id = SKIP, network_name = SKIP,
               price_rule_delco_id = SKIP, price_rule_delco_name = SKIP,
               price_rule_country = SKIP, price_rule_country_code = SKIP,
               price_rule_basis_id = SKIP, discount_value = SKIP,
               price_per_unit_after_discount = SKIP, vat_percentage = SKIP,
               price_rule_category_id = SKIP, tiers = SKIP)
  @date = date unless date == SKIP
  @day = day unless day == SKIP
  @type = type unless type == SKIP
  @price_list_id = price_list_id unless price_list_id == SKIP
  @price_list_description = price_list_description unless price_list_description == SKIP
  @price_rule_id = price_rule_id unless price_rule_id == SKIP
  @price_rule_name = price_rule_name unless price_rule_name == SKIP
  @del_co_id = del_co_id unless del_co_id == SKIP
  @country_code = country_code unless country_code == SKIP
  @country = country unless country == SKIP
  @product_group_id = product_group_id unless product_group_id == SKIP
  @product_group_name = product_group_name unless product_group_name == SKIP
  @product_code = product_code unless product_code == SKIP
  @product_id = product_id unless product_id == SKIP
  @product_name = product_name unless product_name == SKIP
  @price_per_unit = price_per_unit unless price_per_unit == SKIP
  @currency_code = currency_code unless currency_code == SKIP
  @currency_symbol = currency_symbol unless currency_symbol == SKIP
  @price_type = price_type unless price_type == SKIP
  @site_group_id = site_group_id unless site_group_id == SKIP
  @site_group_name = site_group_name unless site_group_name == SKIP
  @site_code = site_code unless site_code == SKIP
  @site_id = site_id unless site_id == SKIP
  @site_name = site_name unless site_name == SKIP
  @fuel_network_id = fuel_network_id unless fuel_network_id == SKIP
  @network_name = network_name unless network_name == SKIP
  @price_rule_delco_id = price_rule_delco_id unless price_rule_delco_id == SKIP
  @price_rule_delco_name = price_rule_delco_name unless price_rule_delco_name == SKIP
  @price_rule_country = price_rule_country unless price_rule_country == SKIP
  @price_rule_country_code = price_rule_country_code unless price_rule_country_code == SKIP
  @price_rule_basis_id = price_rule_basis_id unless price_rule_basis_id == SKIP
  @discount_value = discount_value unless discount_value == SKIP
  unless price_per_unit_after_discount == SKIP
    @price_per_unit_after_discount =
      price_per_unit_after_discount
  end
  @vat_percentage = vat_percentage unless vat_percentage == SKIP
  @price_rule_category_id = price_rule_category_id unless price_rule_category_id == SKIP
  @tiers = tiers unless tiers == SKIP
end

Instance Attribute Details

#country ⇒ String

Country E.g., United Kingdom, Netherlands etc

Returns:

  • (String)


57
58
59
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 57

def country
  @country
end

#country_code ⇒ String

Country ISO Code E.g., UK, NL, etc.,

Returns:

  • (String)


52
53
54
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 52

def country_code
  @country_code
end

#currency_code ⇒ String

Currency Code. Format : 3 digit ISO code

Returns:

  • (String)


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

def currency_code
  @currency_code
end

#currency_symbol ⇒ String

Currency Symbol Example: £

Returns:

  • (String)


91
92
93
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 91

def currency_symbol
  @currency_symbol
end

#date ⇒ String

Date on which the price is applicable. Format: yyyyMMdd E.g.: 20180131

Returns:

  • (String)


16
17
18
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 16

def date
  @date
end

#day ⇒ String

Day on which the price is applicable. E.g.: Sunday, Monday etc.

Returns:

  • (String)


21
22
23
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 21

def day
  @day
end

#del_co_id ⇒ Integer

DelCo Id

Returns:

  • (Integer)


47
48
49
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 47

def del_co_id
  @del_co_id
end

#discount_value ⇒ Float

Discount value

Returns:

  • (Float)


161
162
163
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 161

def discount_value
  @discount_value
end

#fuel_network_id ⇒ Integer

Fuel Network ID

Returns:

  • (Integer)


127
128
129
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 127

def fuel_network_id
  @fuel_network_id
end

#network_name ⇒ String

Network Name

Returns:

  • (String)


131
132
133
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 131

def network_name
  @network_name
end

#price_list_description ⇒ String

Price list description E.g., UK Fuels CRT Reseller List Price

Returns:

  • (String)


35
36
37
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 35

def price_list_description
  @price_list_description
end

#price_list_id ⇒ Integer

Price list ID

Returns:

  • (Integer)


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

def price_list_id
  @price_list_id
end

#price_per_unit ⇒ Float

Price per unit

Returns:

  • (Float)


81
82
83
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 81

def price_per_unit
  @price_per_unit
end

#price_per_unit_after_discount ⇒ Float

Price per unit after discount

Returns:

  • (Float)


165
166
167
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 165

def price_per_unit_after_discount
  @price_per_unit_after_discount
end

#price_rule_basis_id ⇒ Integer

PriceRuleBasisId

Returns:

  • (Integer)


157
158
159
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 157

def price_rule_basis_id
  @price_rule_basis_id
end

#price_rule_category_id ⇒ Integer

PriceRuleCategoryId

Returns:

  • (Integer)


173
174
175
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 173

def price_rule_category_id
  @price_rule_category_id
end

#price_rule_country ⇒ String

PriceRuleCountry E.g.: United Kingdom

Returns:

  • (String)


148
149
150
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 148

def price_rule_country
  @price_rule_country
end

#price_rule_country_code ⇒ String

ISO Code of PriceRuleCountry E.g.: UK, NL, etc.,

Returns:

  • (String)


153
154
155
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 153

def price_rule_country_code
  @price_rule_country_code
end

#price_rule_delco_id ⇒ Integer

PriceRuleDelcoId

Returns:

  • (Integer)


135
136
137
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 135

def price_rule_delco_id
  @price_rule_delco_id
end

#price_rule_delco_name ⇒ String

Company Name of the price rule DelCo. E.g.: • Pilipinas Shell Petroleum Corp • Shell U.K. Oil Products Limited • G & V SERVICE STATIONS NV

Returns:

  • (String)


143
144
145
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 143

def price_rule_delco_name
  @price_rule_delco_name
end

#price_rule_id ⇒ Integer

Price Rule Id

Returns:

  • (Integer)


39
40
41
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 39

def price_rule_id
  @price_rule_id
end

#price_rule_name ⇒ String

Price Rule Name

Returns:

  • (String)


43
44
45
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 43

def price_rule_name
  @price_rule_name
end

#price_type ⇒ String

Price Type Possible Values are: • Country– Price rule defined at country whereas Price Rule DelcoId same as ColcoId. • TPNDelcoPrice – Price rule defined in the TPN whereas Price Rule DelcoId is different from ColcoId. • NetworkPrice – Price rule defined at Fuel Network level. • Other – Price rule defined at either Site or SiteGroup level.

Returns:

  • (String)


102
103
104
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 102

def price_type
  @price_type
end

#product_code ⇒ String

Client Product Code

Returns:

  • (String)


69
70
71
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 69

def product_code
  @product_code
end

#product_group_id ⇒ Integer

Product Group Id

Returns:

  • (Integer)


61
62
63
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 61

def product_group_id
  @product_group_id
end

#product_group_name ⇒ String

Product Group name

Returns:

  • (String)


65
66
67
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 65

def product_group_name
  @product_group_name
end

#product_id ⇒ Integer

Product Id

Returns:

  • (Integer)


73
74
75
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 73

def product_id
  @product_id
end

#product_name ⇒ String

Product name in English

Returns:

  • (String)


77
78
79
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 77

def product_name
  @product_name
end

#site_code ⇒ Integer

Site Code

Returns:

  • (Integer)


115
116
117
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 115

def site_code
  @site_code
end

#site_group_id ⇒ Integer

Site-Group ID E.g.: 100007

Returns:

  • (Integer)


107
108
109
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 107

def site_group_id
  @site_group_id
end

#site_group_name ⇒ String

Site-Group name

Returns:

  • (String)


111
112
113
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 111

def site_group_name
  @site_group_name
end

#site_id ⇒ Integer

Site ID

Returns:

  • (Integer)


119
120
121
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 119

def site_id
  @site_id
end

#site_name ⇒ String

Site Name

Returns:

  • (String)


123
124
125
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 123

def site_name
  @site_name
end

#tiers ⇒ Array[Tier]

PriceRuleCategoryId

Returns:



177
178
179
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 177

def tiers
  @tiers
end

#type ⇒ String

Price list type. E.g., List, Shell Standard International List

Returns:

  • (String)


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

def type
  @type
end

#vat_percentage ⇒ Float

VAT Percentage

Returns:

  • (Float)


169
170
171
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 169

def vat_percentage
  @vat_percentage
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 362

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  date = hash.key?('Date') ? hash['Date'] : SKIP
  day = hash.key?('Day') ? hash['Day'] : SKIP
  type = hash.key?('Type') ? hash['Type'] : SKIP
  price_list_id = hash.key?('PriceListId') ? hash['PriceListId'] : SKIP
  price_list_description =
    hash.key?('PriceListDescription') ? hash['PriceListDescription'] : SKIP
  price_rule_id = hash.key?('PriceRuleId') ? hash['PriceRuleId'] : SKIP
  price_rule_name =
    hash.key?('PriceRuleName') ? hash['PriceRuleName'] : SKIP
  del_co_id = hash.key?('DelCoId') ? hash['DelCoId'] : SKIP
  country_code = hash.key?('CountryCode') ? hash['CountryCode'] : SKIP
  country = hash.key?('Country') ? hash['Country'] : SKIP
  product_group_id =
    hash.key?('ProductGroupId') ? hash['ProductGroupId'] : SKIP
  product_group_name =
    hash.key?('ProductGroupName') ? hash['ProductGroupName'] : SKIP
  product_code = hash.key?('ProductCode') ? hash['ProductCode'] : SKIP
  product_id = hash.key?('ProductId') ? hash['ProductId'] : SKIP
  product_name = hash.key?('ProductName') ? hash['ProductName'] : SKIP
  price_per_unit = hash.key?('PricePerUnit') ? hash['PricePerUnit'] : SKIP
  currency_code = hash.key?('CurrencyCode') ? hash['CurrencyCode'] : SKIP
  currency_symbol =
    hash.key?('CurrencySymbol') ? hash['CurrencySymbol'] : SKIP
  price_type = hash.key?('PriceType') ? hash['PriceType'] : SKIP
  site_group_id = hash.key?('SiteGroupId') ? hash['SiteGroupId'] : SKIP
  site_group_name =
    hash.key?('SiteGroupName') ? hash['SiteGroupName'] : SKIP
  site_code = hash.key?('SiteCode') ? hash['SiteCode'] : SKIP
  site_id = hash.key?('SiteId') ? hash['SiteId'] : SKIP
  site_name = hash.key?('SiteName') ? hash['SiteName'] : SKIP
  fuel_network_id =
    hash.key?('FuelNetworkId') ? hash['FuelNetworkId'] : SKIP
  network_name = hash.key?('NetworkName') ? hash['NetworkName'] : SKIP
  price_rule_delco_id =
    hash.key?('PriceRuleDelcoId') ? hash['PriceRuleDelcoId'] : SKIP
  price_rule_delco_name =
    hash.key?('PriceRuleDelcoName') ? hash['PriceRuleDelcoName'] : SKIP
  price_rule_country =
    hash.key?('PriceRuleCountry') ? hash['PriceRuleCountry'] : SKIP
  price_rule_country_code =
    hash.key?('PriceRuleCountryCode') ? hash['PriceRuleCountryCode'] : SKIP
  price_rule_basis_id =
    hash.key?('PriceRuleBasisId') ? hash['PriceRuleBasisId'] : SKIP
  discount_value = hash.key?('DiscountValue') ? hash['DiscountValue'] : SKIP
  price_per_unit_after_discount =
    hash.key?('PricePerUnitAfterDiscount') ? hash['PricePerUnitAfterDiscount'] : SKIP
  vat_percentage = hash.key?('VATPercentage') ? hash['VATPercentage'] : SKIP
  price_rule_category_id =
    hash.key?('PriceRuleCategoryId') ? hash['PriceRuleCategoryId'] : SKIP
  # Parameter is an array, so we need to iterate through it
  tiers = nil
  unless hash['Tiers'].nil?
    tiers = []
    hash['Tiers'].each do |structure|
      tiers << (Tier.from_hash(structure) if structure)
    end
  end

  tiers = SKIP unless hash.key?('Tiers')

  # Create object from extracted values.
  PriceList.new(date,
                day,
                type,
                price_list_id,
                price_list_description,
                price_rule_id,
                price_rule_name,
                del_co_id,
                country_code,
                country,
                product_group_id,
                product_group_name,
                product_code,
                product_id,
                product_name,
                price_per_unit,
                currency_code,
                currency_symbol,
                price_type,
                site_group_id,
                site_group_name,
                site_code,
                site_id,
                site_name,
                fuel_network_id,
                network_name,
                price_rule_delco_id,
                price_rule_delco_name,
                price_rule_country,
                price_rule_country_code,
                price_rule_basis_id,
                discount_value,
                price_per_unit_after_discount,
                vat_percentage,
                price_rule_category_id,
                tiers)
end

.names ⇒ Object

A mapping from model property names to API property names.



180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 180

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['date'] = 'Date'
  @_hash['day'] = 'Day'
  @_hash['type'] = 'Type'
  @_hash['price_list_id'] = 'PriceListId'
  @_hash['price_list_description'] = 'PriceListDescription'
  @_hash['price_rule_id'] = 'PriceRuleId'
  @_hash['price_rule_name'] = 'PriceRuleName'
  @_hash['del_co_id'] = 'DelCoId'
  @_hash['country_code'] = 'CountryCode'
  @_hash['country'] = 'Country'
  @_hash['product_group_id'] = 'ProductGroupId'
  @_hash['product_group_name'] = 'ProductGroupName'
  @_hash['product_code'] = 'ProductCode'
  @_hash['product_id'] = 'ProductId'
  @_hash['product_name'] = 'ProductName'
  @_hash['price_per_unit'] = 'PricePerUnit'
  @_hash['currency_code'] = 'CurrencyCode'
  @_hash['currency_symbol'] = 'CurrencySymbol'
  @_hash['price_type'] = 'PriceType'
  @_hash['site_group_id'] = 'SiteGroupId'
  @_hash['site_group_name'] = 'SiteGroupName'
  @_hash['site_code'] = 'SiteCode'
  @_hash['site_id'] = 'SiteId'
  @_hash['site_name'] = 'SiteName'
  @_hash['fuel_network_id'] = 'FuelNetworkId'
  @_hash['network_name'] = 'NetworkName'
  @_hash['price_rule_delco_id'] = 'PriceRuleDelcoId'
  @_hash['price_rule_delco_name'] = 'PriceRuleDelcoName'
  @_hash['price_rule_country'] = 'PriceRuleCountry'
  @_hash['price_rule_country_code'] = 'PriceRuleCountryCode'
  @_hash['price_rule_basis_id'] = 'PriceRuleBasisId'
  @_hash['discount_value'] = 'DiscountValue'
  @_hash['price_per_unit_after_discount'] = 'PricePerUnitAfterDiscount'
  @_hash['vat_percentage'] = 'VATPercentage'
  @_hash['price_rule_category_id'] = 'PriceRuleCategoryId'
  @_hash['tiers'] = 'Tiers'
  @_hash
end

.nullables ⇒ Object

An array for nullable fields



264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 264

def self.nullables
  %w[
    date
    day
    type
    price_list_id
    price_list_description
    price_rule_id
    price_rule_name
    del_co_id
    country_code
    country
    product_group_id
    product_group_name
    product_code
    product_id
    product_name
    price_per_unit
    currency_code
    currency_symbol
    price_type
    site_group_id
    site_group_name
    site_code
    site_id
    site_name
    fuel_network_id
    network_name
    price_rule_delco_id
    price_rule_delco_name
    price_rule_country
    price_rule_country_code
    price_rule_basis_id
    discount_value
    price_per_unit_after_discount
    vat_percentage
    price_rule_category_id
  ]
end

.optionals ⇒ Object

An array for optional fields



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
255
256
257
258
259
260
261
# File 'lib/shell_data_reporting_ap_is/models/price_list.rb', line 222

def self.optionals
  %w[
    date
    day
    type
    price_list_id
    price_list_description
    price_rule_id
    price_rule_name
    del_co_id
    country_code
    country
    product_group_id
    product_group_name
    product_code
    product_id
    product_name
    price_per_unit
    currency_code
    currency_symbol
    price_type
    site_group_id
    site_group_name
    site_code
    site_id
    site_name
    fuel_network_id
    network_name
    price_rule_delco_id
    price_rule_delco_name
    price_rule_country
    price_rule_country_code
    price_rule_basis_id
    discount_value
    price_per_unit_after_discount
    vat_percentage
    price_rule_category_id
    tiers
  ]
end