Class: ShellCardManagementApIs::BundledDetailsProductList

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/shell_card_management_ap_is/models/bundled_details_product_list.rb

Overview

BundledDetailsProductList Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(purchase_category_id = SKIP, purchase_category_code = SKIP, products = SKIP, product_groups = SKIP, fuel_set_id = SKIP, fuel_set_name = SKIP, non_fuel_sets = SKIP) ⇒ BundledDetailsProductList

Returns a new instance of BundledDetailsProductList.



79
80
81
82
83
84
85
86
87
88
89
# File 'lib/shell_card_management_ap_is/models/bundled_details_product_list.rb', line 79

def initialize(purchase_category_id = SKIP, purchase_category_code = SKIP,
               products = SKIP, product_groups = SKIP, fuel_set_id = SKIP,
               fuel_set_name = SKIP, non_fuel_sets = SKIP)
  @purchase_category_id = purchase_category_id unless purchase_category_id == SKIP
  @purchase_category_code = purchase_category_code unless purchase_category_code == SKIP
  @products = products unless products == SKIP
  @product_groups = product_groups unless product_groups == SKIP
  @fuel_set_id = fuel_set_id unless fuel_set_id == SKIP
  @fuel_set_name = fuel_set_name unless fuel_set_name == SKIP
  @non_fuel_sets = non_fuel_sets unless non_fuel_sets == SKIP
end

Instance Attribute Details

#fuel_set_idString

Fuel set id that is allowed to be purchased with the card

Returns:

  • (String)


38
39
40
# File 'lib/shell_card_management_ap_is/models/bundled_details_product_list.rb', line 38

def fuel_set_id
  @fuel_set_id
end

#fuel_set_nameString

Fuel set name that is allowed to be purchased with the card

Returns:

  • (String)


42
43
44
# File 'lib/shell_card_management_ap_is/models/bundled_details_product_list.rb', line 42

def fuel_set_name
  @fuel_set_name
end

#non_fuel_setsString

Non-Fuel set name that is allowed to be purchased with the card

Returns:

  • (String)


46
47
48
# File 'lib/shell_card_management_ap_is/models/bundled_details_product_list.rb', line 46

def non_fuel_sets
  @non_fuel_sets
end

#product_groupsArray[String]

An array of product group ids. Example: [ “670246404”, “40557126” ]

Returns:

  • (Array[String])


34
35
36
# File 'lib/shell_card_management_ap_is/models/bundled_details_product_list.rb', line 34

def product_groups
  @product_groups
end

#productsArray[String]

An array of 3-digit global product codes. Example: [ “033”, “021”, “023” ]

Returns:

  • (Array[String])


29
30
31
# File 'lib/shell_card_management_ap_is/models/bundled_details_product_list.rb', line 29

def products
  @products
end

#purchase_category_codeString

Purchase category name. Example: 0 - All Fuels (without VP) and Lubricants 1 - FuelSave only 2 - FuelSave and Lubricants 3 - No Restrictions

Returns:

  • (String)


24
25
26
# File 'lib/shell_card_management_ap_is/models/bundled_details_product_list.rb', line 24

def purchase_category_code
  @purchase_category_code
end

#purchase_category_idInteger

Purchase category Id Example: 123, 124, etc.,

Returns:

  • (Integer)


15
16
17
# File 'lib/shell_card_management_ap_is/models/bundled_details_product_list.rb', line 15

def purchase_category_id
  @purchase_category_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  purchase_category_id =
    hash.key?('PurchaseCategoryId') ? hash['PurchaseCategoryId'] : SKIP
  purchase_category_code =
    hash.key?('PurchaseCategoryCode') ? hash['PurchaseCategoryCode'] : SKIP
  products = hash.key?('Products') ? hash['Products'] : SKIP
  product_groups = hash.key?('ProductGroups') ? hash['ProductGroups'] : SKIP
  fuel_set_id = hash.key?('FuelSetId') ? hash['FuelSetId'] : SKIP
  fuel_set_name = hash.key?('FuelSetName') ? hash['FuelSetName'] : SKIP
  non_fuel_sets = hash.key?('NonFuelSets') ? hash['NonFuelSets'] : SKIP

  # Create object from extracted values.
  BundledDetailsProductList.new(purchase_category_id,
                                purchase_category_code,
                                products,
                                product_groups,
                                fuel_set_id,
                                fuel_set_name,
                                non_fuel_sets)
end

.namesObject

A mapping from model property names to API property names.



49
50
51
52
53
54
55
56
57
58
59
# File 'lib/shell_card_management_ap_is/models/bundled_details_product_list.rb', line 49

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['purchase_category_id'] = 'PurchaseCategoryId'
  @_hash['purchase_category_code'] = 'PurchaseCategoryCode'
  @_hash['products'] = 'Products'
  @_hash['product_groups'] = 'ProductGroups'
  @_hash['fuel_set_id'] = 'FuelSetId'
  @_hash['fuel_set_name'] = 'FuelSetName'
  @_hash['non_fuel_sets'] = 'NonFuelSets'
  @_hash
end

.nullablesObject

An array for nullable fields



75
76
77
# File 'lib/shell_card_management_ap_is/models/bundled_details_product_list.rb', line 75

def self.nullables
  []
end

.optionalsObject

An array for optional fields



62
63
64
65
66
67
68
69
70
71
72
# File 'lib/shell_card_management_ap_is/models/bundled_details_product_list.rb', line 62

def self.optionals
  %w[
    purchase_category_id
    purchase_category_code
    products
    product_groups
    fuel_set_id
    fuel_set_name
    non_fuel_sets
  ]
end