Class: ShellCardManagementApIs::ProductGroup
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ShellCardManagementApIs::ProductGroup
- Defined in:
- lib/shell_card_management_ap_is/models/product_group.rb
Overview
ProductGroup Model.
Instance Attribute Summary collapse
-
#is_default ⇒ TrueClass | FalseClass
Indicates whether this is a default Product Group at ColCo level or not.
-
#is_fuel_type ⇒ TrueClass | FalseClass
Identifies the type of Product group.
-
#name ⇒ String
Product group name.
-
#product_group_id ⇒ String
Product group ID.
-
#products ⇒ Array[ProductAllOf0]
Identifies the type of Product group.
-
#reference_id ⇒ Integer
Referenced Purchase Category Id Example: 123, 124.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(reference_id = SKIP, product_group_id = SKIP, name = SKIP, is_default = SKIP, is_fuel_type = SKIP, products = SKIP) ⇒ ProductGroup
constructor
A new instance of ProductGroup.
Methods inherited from BaseModel
Constructor Details
#initialize(reference_id = SKIP, product_group_id = SKIP, name = SKIP, is_default = SKIP, is_fuel_type = SKIP, products = SKIP) ⇒ ProductGroup
Returns a new instance of ProductGroup.
71 72 73 74 75 76 77 78 79 |
# File 'lib/shell_card_management_ap_is/models/product_group.rb', line 71 def initialize(reference_id = SKIP, product_group_id = SKIP, name = SKIP, is_default = SKIP, is_fuel_type = SKIP, products = SKIP) @reference_id = reference_id unless reference_id == SKIP @product_group_id = product_group_id unless product_group_id == SKIP @name = name unless name == SKIP @is_default = is_default unless is_default == SKIP @is_fuel_type = is_fuel_type unless is_fuel_type == SKIP @products = products unless products == SKIP end |
Instance Attribute Details
#is_default ⇒ TrueClass | FalseClass
Indicates whether this is a default Product Group at ColCo level or not. Note: The Customer level default settings are not considered here.
28 29 30 |
# File 'lib/shell_card_management_ap_is/models/product_group.rb', line 28 def is_default @is_default end |
#is_fuel_type ⇒ TrueClass | FalseClass
Identifies the type of Product group. true - if it is a Fuel type Product group false - if it is Non-Fuel type
34 35 36 |
# File 'lib/shell_card_management_ap_is/models/product_group.rb', line 34 def is_fuel_type @is_fuel_type end |
#name ⇒ String
Product group name
23 24 25 |
# File 'lib/shell_card_management_ap_is/models/product_group.rb', line 23 def name @name end |
#product_group_id ⇒ String
Product group ID
19 20 21 |
# File 'lib/shell_card_management_ap_is/models/product_group.rb', line 19 def product_group_id @product_group_id end |
#products ⇒ Array[ProductAllOf0]
Identifies the type of Product group. true - if it is a Fuel type Product group false - if it is Non-Fuel type
40 41 42 |
# File 'lib/shell_card_management_ap_is/models/product_group.rb', line 40 def products @products end |
#reference_id ⇒ Integer
Referenced Purchase Category Id Example: 123, 124
15 16 17 |
# File 'lib/shell_card_management_ap_is/models/product_group.rb', line 15 def reference_id @reference_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/shell_card_management_ap_is/models/product_group.rb', line 82 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. reference_id = hash.key?('ReferenceId') ? hash['ReferenceId'] : SKIP product_group_id = hash.key?('ProductGroupId') ? hash['ProductGroupId'] : SKIP name = hash.key?('Name') ? hash['Name'] : SKIP is_default = hash.key?('IsDefault') ? hash['IsDefault'] : SKIP is_fuel_type = hash.key?('IsFuelType') ? hash['IsFuelType'] : SKIP # Parameter is an array, so we need to iterate through it products = nil unless hash['Products'].nil? products = [] hash['Products'].each do |structure| products << (ProductAllOf0.from_hash(structure) if structure) end end products = SKIP unless hash.key?('Products') # Create object from extracted values. ProductGroup.new(reference_id, product_group_id, name, is_default, is_fuel_type, products) end |
.names ⇒ Object
A mapping from model property names to API property names.
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/shell_card_management_ap_is/models/product_group.rb', line 43 def self.names @_hash = {} if @_hash.nil? @_hash['reference_id'] = 'ReferenceId' @_hash['product_group_id'] = 'ProductGroupId' @_hash['name'] = 'Name' @_hash['is_default'] = 'IsDefault' @_hash['is_fuel_type'] = 'IsFuelType' @_hash['products'] = 'Products' @_hash end |
.nullables ⇒ Object
An array for nullable fields
67 68 69 |
# File 'lib/shell_card_management_ap_is/models/product_group.rb', line 67 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
55 56 57 58 59 60 61 62 63 64 |
# File 'lib/shell_card_management_ap_is/models/product_group.rb', line 55 def self.optionals %w[ reference_id product_group_id name is_default is_fuel_type products ] end |