Class: StickyIoRestfulApiV2025731::AddProductRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- StickyIoRestfulApiV2025731::AddProductRequest
- Defined in:
- lib/sticky_io_restful_api_v2025731/models/add_product_request.rb
Overview
AddProductRequest Model.
Instance Attribute Summary collapse
-
#attributes ⇒ Array[Attribute]
TODO: Write general description for this method.
-
#auto_create_variants ⇒ Integer
TODO: Write general description for this method.
-
#category_id ⇒ Integer
TODO: Write general description for this method.
-
#description ⇒ String
TODO: Write general description for this method.
-
#max_quantity ⇒ Integer
TODO: Write general description for this method.
-
#name ⇒ String
TODO: Write general description for this method.
-
#price ⇒ Float
TODO: Write general description for this method.
-
#sku ⇒ String
TODO: Write general description for this method.
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:, sku:, category_id:, description:, price:, max_quantity:, auto_create_variants:, attributes:, additional_properties: nil) ⇒ AddProductRequest
constructor
A new instance of AddProductRequest.
-
#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:, sku:, category_id:, description:, price:, max_quantity:, auto_create_variants:, attributes:, additional_properties: nil) ⇒ AddProductRequest
Returns a new instance of AddProductRequest.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/sticky_io_restful_api_v2025731/models/add_product_request.rb', line 68 def initialize(name:, sku:, category_id:, description:, price:, max_quantity:, auto_create_variants:, attributes:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @name = name @sku = sku @category_id = category_id @description = description @price = price @max_quantity = max_quantity @auto_create_variants = auto_create_variants @attributes = attributes @additional_properties = additional_properties end |
Instance Attribute Details
#attributes ⇒ Array[Attribute]
TODO: Write general description for this method
42 43 44 |
# File 'lib/sticky_io_restful_api_v2025731/models/add_product_request.rb', line 42 def attributes @attributes end |
#auto_create_variants ⇒ Integer
TODO: Write general description for this method
38 39 40 |
# File 'lib/sticky_io_restful_api_v2025731/models/add_product_request.rb', line 38 def auto_create_variants @auto_create_variants end |
#category_id ⇒ Integer
TODO: Write general description for this method
22 23 24 |
# File 'lib/sticky_io_restful_api_v2025731/models/add_product_request.rb', line 22 def category_id @category_id end |
#description ⇒ String
TODO: Write general description for this method
26 27 28 |
# File 'lib/sticky_io_restful_api_v2025731/models/add_product_request.rb', line 26 def description @description end |
#max_quantity ⇒ Integer
TODO: Write general description for this method
34 35 36 |
# File 'lib/sticky_io_restful_api_v2025731/models/add_product_request.rb', line 34 def max_quantity @max_quantity end |
#name ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/sticky_io_restful_api_v2025731/models/add_product_request.rb', line 14 def name @name end |
#price ⇒ Float
TODO: Write general description for this method
30 31 32 |
# File 'lib/sticky_io_restful_api_v2025731/models/add_product_request.rb', line 30 def price @price end |
#sku ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/sticky_io_restful_api_v2025731/models/add_product_request.rb', line 18 def sku @sku end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/sticky_io_restful_api_v2025731/models/add_product_request.rb', line 86 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. name = hash.key?('name') ? hash['name'] : nil sku = hash.key?('sku') ? hash['sku'] : nil category_id = hash.key?('category_id') ? hash['category_id'] : nil description = hash.key?('description') ? hash['description'] : nil price = hash.key?('price') ? hash['price'] : nil max_quantity = hash.key?('max_quantity') ? hash['max_quantity'] : nil auto_create_variants = hash.key?('auto_create_variants') ? hash['auto_create_variants'] : nil # Parameter is an array, so we need to iterate through it attributes = nil unless hash['attributes'].nil? attributes = [] hash['attributes'].each do |structure| attributes << (Attribute.from_hash(structure) if structure) end end attributes = nil unless hash.key?('attributes') # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. AddProductRequest.new(name: name, sku: sku, category_id: category_id, description: description, price: price, max_quantity: max_quantity, auto_create_variants: auto_create_variants, attributes: attributes, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/sticky_io_restful_api_v2025731/models/add_product_request.rb', line 45 def self.names @_hash = {} if @_hash.nil? @_hash['name'] = 'name' @_hash['sku'] = 'sku' @_hash['category_id'] = 'category_id' @_hash['description'] = 'description' @_hash['price'] = 'price' @_hash['max_quantity'] = 'max_quantity' @_hash['auto_create_variants'] = 'auto_create_variants' @_hash['attributes'] = 'attributes' @_hash end |
.nullables ⇒ Object
An array for nullable fields
64 65 66 |
# File 'lib/sticky_io_restful_api_v2025731/models/add_product_request.rb', line 64 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
59 60 61 |
# File 'lib/sticky_io_restful_api_v2025731/models/add_product_request.rb', line 59 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
138 139 140 141 142 143 144 145 |
# File 'lib/sticky_io_restful_api_v2025731/models/add_product_request.rb', line 138 def inspect class_name = self.class.name.split('::').last "<#{class_name} name: #{@name.inspect}, sku: #{@sku.inspect}, category_id:"\ " #{@category_id.inspect}, description: #{@description.inspect}, price: #{@price.inspect},"\ " max_quantity: #{@max_quantity.inspect}, auto_create_variants:"\ " #{@auto_create_variants.inspect}, attributes: #{@attributes.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
129 130 131 132 133 134 135 |
# File 'lib/sticky_io_restful_api_v2025731/models/add_product_request.rb', line 129 def to_s class_name = self.class.name.split('::').last "<#{class_name} name: #{@name}, sku: #{@sku}, category_id: #{@category_id}, description:"\ " #{@description}, price: #{@price}, max_quantity: #{@max_quantity}, auto_create_variants:"\ " #{@auto_create_variants}, attributes: #{@attributes}, additional_properties:"\ " #{@additional_properties}>" end |