Class: NewStoreApi::SalesOrderProductAttributes
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::SalesOrderProductAttributes
- Defined in:
- lib/new_store_api/models/sales_order_product_attributes.rb
Overview
Additional product-related information.
Instance Attribute Summary collapse
-
#additional_variant_1 ⇒ String
A free form field for additional product attributes.
-
#additional_variant_2 ⇒ String
A free form field for additional product attributes.
-
#color ⇒ String
The color of the product.
-
#image_url ⇒ String
The URL to a product image.
-
#name ⇒ String
The name of the product.
-
#size ⇒ String
The size of the product.
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(name = nil, additional_variant_1 = SKIP, additional_variant_2 = SKIP, color = SKIP, image_url = SKIP, size = SKIP) ⇒ SalesOrderProductAttributes
constructor
A new instance of SalesOrderProductAttributes.
-
#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(name = nil, additional_variant_1 = SKIP, additional_variant_2 = SKIP, color = SKIP, image_url = SKIP, size = SKIP) ⇒ SalesOrderProductAttributes
Returns a new instance of SalesOrderProductAttributes.
64 65 66 67 68 69 70 71 72 73 |
# File 'lib/new_store_api/models/sales_order_product_attributes.rb', line 64 def initialize(name = nil, additional_variant_1 = SKIP, additional_variant_2 = SKIP, color = SKIP, image_url = SKIP, size = SKIP) @additional_variant_1 = additional_variant_1 unless additional_variant_1 == SKIP @additional_variant_2 = additional_variant_2 unless additional_variant_2 == SKIP @color = color unless color == SKIP @image_url = image_url unless image_url == SKIP @name = name @size = size unless size == SKIP end |
Instance Attribute Details
#additional_variant_1 ⇒ String
A free form field for additional product attributes.
14 15 16 |
# File 'lib/new_store_api/models/sales_order_product_attributes.rb', line 14 def additional_variant_1 @additional_variant_1 end |
#additional_variant_2 ⇒ String
A free form field for additional product attributes.
18 19 20 |
# File 'lib/new_store_api/models/sales_order_product_attributes.rb', line 18 def additional_variant_2 @additional_variant_2 end |
#color ⇒ String
The color of the product.
22 23 24 |
# File 'lib/new_store_api/models/sales_order_product_attributes.rb', line 22 def color @color end |
#image_url ⇒ String
The URL to a product image.
26 27 28 |
# File 'lib/new_store_api/models/sales_order_product_attributes.rb', line 26 def image_url @image_url end |
#name ⇒ String
The name of the product.
30 31 32 |
# File 'lib/new_store_api/models/sales_order_product_attributes.rb', line 30 def name @name end |
#size ⇒ String
The size of the product.
34 35 36 |
# File 'lib/new_store_api/models/sales_order_product_attributes.rb', line 34 def size @size end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/new_store_api/models/sales_order_product_attributes.rb', line 76 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. name = hash.key?('name') ? hash['name'] : nil additional_variant_1 = hash.key?('additional_variant_1') ? hash['additional_variant_1'] : SKIP additional_variant_2 = hash.key?('additional_variant_2') ? hash['additional_variant_2'] : SKIP color = hash.key?('color') ? hash['color'] : SKIP image_url = hash.key?('image_url') ? hash['image_url'] : SKIP size = hash.key?('size') ? hash['size'] : SKIP # Create object from extracted values. SalesOrderProductAttributes.new(name, additional_variant_1, additional_variant_2, color, image_url, size) end |
.names ⇒ Object
A mapping from model property names to API property names.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/new_store_api/models/sales_order_product_attributes.rb', line 37 def self.names @_hash = {} if @_hash.nil? @_hash['additional_variant_1'] = 'additional_variant_1' @_hash['additional_variant_2'] = 'additional_variant_2' @_hash['color'] = 'color' @_hash['image_url'] = 'image_url' @_hash['name'] = 'name' @_hash['size'] = 'size' @_hash end |
.nullables ⇒ Object
An array for nullable fields
60 61 62 |
# File 'lib/new_store_api/models/sales_order_product_attributes.rb', line 60 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
49 50 51 52 53 54 55 56 57 |
# File 'lib/new_store_api/models/sales_order_product_attributes.rb', line 49 def self.optionals %w[ additional_variant_1 additional_variant_2 color image_url size ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
107 108 109 110 111 112 |
# File 'lib/new_store_api/models/sales_order_product_attributes.rb', line 107 def inspect class_name = self.class.name.split('::').last "<#{class_name} additional_variant_1: #{@additional_variant_1.inspect},"\ " additional_variant_2: #{@additional_variant_2.inspect}, color: #{@color.inspect},"\ " image_url: #{@image_url.inspect}, name: #{@name.inspect}, size: #{@size.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
99 100 101 102 103 104 |
# File 'lib/new_store_api/models/sales_order_product_attributes.rb', line 99 def to_s class_name = self.class.name.split('::').last "<#{class_name} additional_variant_1: #{@additional_variant_1}, additional_variant_2:"\ " #{@additional_variant_2}, color: #{@color}, image_url: #{@image_url}, name: #{@name},"\ " size: #{@size}>" end |