Class: ShellCardManagementApIs::PurchaseCategory1AllOf0
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ShellCardManagementApIs::PurchaseCategory1AllOf0
- Defined in:
- lib/shell_card_management_ap_is/models/purchase_category1_all_of0.rb
Overview
PurchaseCategory1AllOf0 Model.
Instance Attribute Summary collapse
-
#code ⇒ String
Purchase category code.
-
#description ⇒ String
Purchase category description by given language code.
-
#id ⇒ Integer
Purchase category ID.
-
#is_visible ⇒ TrueClass | FalseClass
PurchaseCategory can be used while submitting new order cards requests if true else will not be used for ordering cards.
-
#name ⇒ String
Name of Purchase category .
-
#product_groups ⇒ Array[ProductGroup]
List of product sets.
-
#title ⇒ String
Purchase category Title by given language code.
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(id = nil, code = nil, name = nil, is_visible = nil, product_groups = nil, title = SKIP, description = SKIP) ⇒ PurchaseCategory1AllOf0
constructor
A new instance of PurchaseCategory1AllOf0.
Methods inherited from BaseModel
Constructor Details
#initialize(id = nil, code = nil, name = nil, is_visible = nil, product_groups = nil, title = SKIP, description = SKIP) ⇒ PurchaseCategory1AllOf0
Returns a new instance of PurchaseCategory1AllOf0.
92 93 94 95 96 97 98 99 100 101 |
# File 'lib/shell_card_management_ap_is/models/purchase_category1_all_of0.rb', line 92 def initialize(id = nil, code = nil, name = nil, is_visible = nil, product_groups = nil, title = SKIP, description = SKIP) @id = id @code = code @name = name @is_visible = is_visible @product_groups = product_groups @title = title unless title == SKIP @description = description unless description == SKIP end |
Instance Attribute Details
#code ⇒ String
Purchase category code
18 19 20 |
# File 'lib/shell_card_management_ap_is/models/purchase_category1_all_of0.rb', line 18 def code @code end |
#description ⇒ String
Purchase category description by given language code. Example: 0 - Diesel Products and TMF 1 - All Fuel Products and TMF 2 - All Fuels Products, Car related items and TMF 3 - No Restriction 0 - Diesel Products + LNG and TMF 1 - All Fuel Products + LNG and TMF 2 - All Fuels Products + LNG, Car related items and TMF 3 - No Restriction + LNG Note: Purchase Category name (GFN) is returned when Title does not exist for the given language Code and default language code (en-GB).
60 61 62 |
# File 'lib/shell_card_management_ap_is/models/purchase_category1_all_of0.rb', line 60 def description @description end |
#id ⇒ Integer
Purchase category ID
14 15 16 |
# File 'lib/shell_card_management_ap_is/models/purchase_category1_all_of0.rb', line 14 def id @id end |
#is_visible ⇒ TrueClass | FalseClass
PurchaseCategory can be used while submitting new order cards requests if true else will not be used for ordering cards.
27 28 29 |
# File 'lib/shell_card_management_ap_is/models/purchase_category1_all_of0.rb', line 27 def is_visible @is_visible end |
#name ⇒ String
Name of Purchase category .
22 23 24 |
# File 'lib/shell_card_management_ap_is/models/purchase_category1_all_of0.rb', line 22 def name @name end |
#product_groups ⇒ Array[ProductGroup]
List of product sets
31 32 33 |
# File 'lib/shell_card_management_ap_is/models/purchase_category1_all_of0.rb', line 31 def product_groups @product_groups end |
#title ⇒ String
Purchase category Title by given language code.
-
Basic
-
Essentials
-
Extra
-
Premium
-
Basic and LNG
-
Essentials and LNG
-
Extra and LNG
-
Premium and LNG
Note: Purchase Category name (GFN) is returned when Title does not exist for the given language Code and default language code (en-GB).
45 46 47 |
# File 'lib/shell_card_management_ap_is/models/purchase_category1_all_of0.rb', line 45 def title @title end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/shell_card_management_ap_is/models/purchase_category1_all_of0.rb', line 104 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('Id') ? hash['Id'] : nil code = hash.key?('Code') ? hash['Code'] : nil name = hash.key?('Name') ? hash['Name'] : nil is_visible = hash.key?('IsVisible') ? hash['IsVisible'] : nil # Parameter is an array, so we need to iterate through it product_groups = nil unless hash['ProductGroups'].nil? product_groups = [] hash['ProductGroups'].each do |structure| product_groups << (ProductGroup.from_hash(structure) if structure) end end product_groups = nil unless hash.key?('ProductGroups') title = hash.key?('Title') ? hash['Title'] : SKIP description = hash.key?('Description') ? hash['Description'] : SKIP # Create object from extracted values. PurchaseCategory1AllOf0.new(id, code, name, is_visible, product_groups, title, description) end |
.names ⇒ Object
A mapping from model property names to API property names.
63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/shell_card_management_ap_is/models/purchase_category1_all_of0.rb', line 63 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'Id' @_hash['code'] = 'Code' @_hash['name'] = 'Name' @_hash['is_visible'] = 'IsVisible' @_hash['product_groups'] = 'ProductGroups' @_hash['title'] = 'Title' @_hash['description'] = 'Description' @_hash end |
.nullables ⇒ Object
An array for nullable fields
84 85 86 87 88 89 90 |
# File 'lib/shell_card_management_ap_is/models/purchase_category1_all_of0.rb', line 84 def self.nullables %w[ id code name ] end |
.optionals ⇒ Object
An array for optional fields
76 77 78 79 80 81 |
# File 'lib/shell_card_management_ap_is/models/purchase_category1_all_of0.rb', line 76 def self.optionals %w[ title description ] end |