Class: ShellCardManagementApIs::ProductRestrictionCard
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ShellCardManagementApIs::ProductRestrictionCard
- Defined in:
- lib/shell_card_management_ap_is/models/product_restriction_card.rb
Overview
ProductRestrictionCard Model.
Instance Attribute Summary collapse
-
#product_groups ⇒ Array[String]
An array of product group IDs.
-
#products ⇒ Array[String]
An array of 3-digit global product codes.
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(products = SKIP, product_groups = SKIP) ⇒ ProductRestrictionCard
constructor
A new instance of ProductRestrictionCard.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(products = SKIP, product_groups = SKIP) ⇒ ProductRestrictionCard
Returns a new instance of ProductRestrictionCard.
45 46 47 48 |
# File 'lib/shell_card_management_ap_is/models/product_restriction_card.rb', line 45 def initialize(products = SKIP, product_groups = SKIP) @products = products unless products == SKIP @product_groups = product_groups unless product_groups == SKIP end |
Instance Attribute Details
#product_groups ⇒ Array[String]
An array of product group IDs. Optional. Example: [ “670246404”, “40557126” ]
22 23 24 |
# File 'lib/shell_card_management_ap_is/models/product_restriction_card.rb', line 22 def product_groups @product_groups end |
#products ⇒ Array[String]
An array of 3-digit global product codes. Optional. Example: [ “033”, “021”, “023”]
16 17 18 |
# File 'lib/shell_card_management_ap_is/models/product_restriction_card.rb', line 16 def products @products end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/shell_card_management_ap_is/models/product_restriction_card.rb', line 51 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. products = hash.key?('Products') ? hash['Products'] : SKIP product_groups = hash.key?('ProductGroups') ? hash['ProductGroups'] : SKIP # Create object from extracted values. ProductRestrictionCard.new(products, product_groups) end |
.names ⇒ Object
A mapping from model property names to API property names.
25 26 27 28 29 30 |
# File 'lib/shell_card_management_ap_is/models/product_restriction_card.rb', line 25 def self.names @_hash = {} if @_hash.nil? @_hash['products'] = 'Products' @_hash['product_groups'] = 'ProductGroups' @_hash end |
.nullables ⇒ Object
An array for nullable fields
41 42 43 |
# File 'lib/shell_card_management_ap_is/models/product_restriction_card.rb', line 41 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
33 34 35 36 37 38 |
# File 'lib/shell_card_management_ap_is/models/product_restriction_card.rb', line 33 def self.optionals %w[ products product_groups ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
70 71 72 73 74 |
# File 'lib/shell_card_management_ap_is/models/product_restriction_card.rb', line 70 def inspect class_name = self.class.name.split('::').last "<#{class_name} products: #{@products.inspect}, product_groups:"\ " #{@product_groups.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
64 65 66 67 |
# File 'lib/shell_card_management_ap_is/models/product_restriction_card.rb', line 64 def to_s class_name = self.class.name.split('::').last "<#{class_name} products: #{@products}, product_groups: #{@product_groups}>" end |