Class: ShellCardManagementApIs::PurchaseCategories
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ShellCardManagementApIs::PurchaseCategories
- Defined in:
- lib/shell_card_management_ap_is/models/purchase_categories.rb
Overview
PurchaseCategories Model.
Instance Attribute Summary collapse
-
#code ⇒ String
Purchase category code Example: 0,1, 2 etc.
-
#id ⇒ Integer
Purchase category Id.
-
#is_visible ⇒ TrueClass | FalseClass
If True then PurchaseCategory can be used while submitting new order cards requests.
-
#name ⇒ String
Purchase category name Example: Fuel Save Only Full list below: 0 - All Fuels (without VP) and Lubricants 1 - Fuel Save only 2 - Fuel Save and Lubricants 3 - No Restrictions 4 - VP and Fuel Save 5 - Diesel ONLY 6 - Diesel and Lubricants 7 - VP and Lubricants 8 - VP and Fuel Save and Lubricants.
-
#product_groups ⇒ String
List of Default product groups.
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 = SKIP, code = SKIP, name = SKIP, is_visible = SKIP, product_groups = SKIP) ⇒ PurchaseCategories
constructor
A new instance of PurchaseCategories.
Methods inherited from BaseModel
Constructor Details
#initialize(id = SKIP, code = SKIP, name = SKIP, is_visible = SKIP, product_groups = SKIP) ⇒ PurchaseCategories
Returns a new instance of PurchaseCategories.
83 84 85 86 87 88 89 90 |
# File 'lib/shell_card_management_ap_is/models/purchase_categories.rb', line 83 def initialize(id = SKIP, code = SKIP, name = SKIP, is_visible = SKIP, product_groups = SKIP) @id = id unless id == SKIP @code = code unless code == SKIP @name = name unless name == SKIP @is_visible = is_visible unless is_visible == SKIP @product_groups = product_groups unless product_groups == SKIP end |
Instance Attribute Details
#code ⇒ String
Purchase category code Example: 0,1, 2 etc. Full list below: 0 - All Fuels (without VP) and Lubricants 1 - Fuel Save only 2 - Fuel Save and Lubricants 3 - No Restrictions 4 - VP and Fuel Save 5 - Diesel ONLY 6 - Diesel and Lubricants 7 - VP and Lubricants 8 - VP and Fuel Save and Lubricants
29 30 31 |
# File 'lib/shell_card_management_ap_is/models/purchase_categories.rb', line 29 def code @code end |
#id ⇒ Integer
Purchase category Id
14 15 16 |
# File 'lib/shell_card_management_ap_is/models/purchase_categories.rb', line 14 def id @id end |
#is_visible ⇒ TrueClass | FalseClass
If True then PurchaseCategory can be used while submitting new order cards requests. If false this PurchaseCategory will not be used for Ordering Cards.
50 51 52 |
# File 'lib/shell_card_management_ap_is/models/purchase_categories.rb', line 50 def is_visible @is_visible end |
#name ⇒ String
Purchase category name Example: Fuel Save Only Full list below: 0 - All Fuels (without VP) and Lubricants 1 - Fuel Save only 2 - Fuel Save and Lubricants 3 - No Restrictions 4 - VP and Fuel Save 5 - Diesel ONLY 6 - Diesel and Lubricants 7 - VP and Lubricants 8 - VP and Fuel Save and Lubricants
44 45 46 |
# File 'lib/shell_card_management_ap_is/models/purchase_categories.rb', line 44 def name @name end |
#product_groups ⇒ String
List of Default product groups
54 55 56 |
# File 'lib/shell_card_management_ap_is/models/purchase_categories.rb', line 54 def product_groups @product_groups end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/shell_card_management_ap_is/models/purchase_categories.rb', line 93 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('Id') ? hash['Id'] : SKIP code = hash.key?('Code') ? hash['Code'] : SKIP name = hash.key?('Name') ? hash['Name'] : SKIP is_visible = hash.key?('IsVisible') ? hash['IsVisible'] : SKIP product_groups = hash.key?('ProductGroups') ? hash['ProductGroups'] : SKIP # Create object from extracted values. PurchaseCategories.new(id, code, name, is_visible, product_groups) end |
.names ⇒ Object
A mapping from model property names to API property names.
57 58 59 60 61 62 63 64 65 |
# File 'lib/shell_card_management_ap_is/models/purchase_categories.rb', line 57 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 end |
.nullables ⇒ Object
An array for nullable fields
79 80 81 |
# File 'lib/shell_card_management_ap_is/models/purchase_categories.rb', line 79 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
68 69 70 71 72 73 74 75 76 |
# File 'lib/shell_card_management_ap_is/models/purchase_categories.rb', line 68 def self.optionals %w[ id code name is_visible product_groups ] end |