Class: NewStoreApi::SwapTo
- Defined in:
- lib/new_store_api/models/swap_to.rb
Overview
Properties of the new item.
Instance Attribute Summary collapse
-
#country_of_origin ⇒ String
The origin country code of product (required for international shipments).
-
#epc_list ⇒ Array[String]
The origin country code of product (required for international shipments).
-
#material ⇒ String
The raw material of product (for product's description in custom).
-
#product_attributes ⇒ ProductAttributes
The raw material of product (for product's description in custom).
-
#product_customs_category ⇒ String
Product's main category subject.
-
#product_hts_number ⇒ String
A six digit code specified by harmonized system for tariffs (required for international shipments).
-
#product_id ⇒ String
Identifier of the product that is this SalesOrder's line item.
-
#product_image_url ⇒ String
Url of the main image of the product.
-
#product_name ⇒ String
Human-readable name of the product that is this SalesOrder's line item.
-
#product_sku ⇒ String
SKU of the product that is this SalesOrder's line item.
-
#schedule_b ⇒ String
a classification code for exporting goods out of the United States.
-
#shipping_weight_unit ⇒ String
The chosen weight unit (e.g. 'kg').
-
#shipping_weight_value ⇒ Float
Weight of the product, numeric value.
-
#uuid ⇒ String
New unique item ID(Sales Order Item UUID) after swapping.
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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(country_of_origin = SKIP, epc_list = SKIP, material = SKIP, product_attributes = SKIP, product_customs_category = SKIP, product_hts_number = SKIP, product_id = SKIP, product_image_url = SKIP, product_name = SKIP, product_sku = SKIP, schedule_b = SKIP, shipping_weight_unit = SKIP, shipping_weight_value = SKIP, uuid = SKIP) ⇒ SwapTo
constructor
A new instance of SwapTo.
-
#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(country_of_origin = SKIP, epc_list = SKIP, material = SKIP, product_attributes = SKIP, product_customs_category = SKIP, product_hts_number = SKIP, product_id = SKIP, product_image_url = SKIP, product_name = SKIP, product_sku = SKIP, schedule_b = SKIP, shipping_weight_unit = SKIP, shipping_weight_value = SKIP, uuid = SKIP) ⇒ SwapTo
Returns a new instance of SwapTo.
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/new_store_api/models/swap_to.rb', line 121 def initialize(country_of_origin = SKIP, epc_list = SKIP, material = SKIP, product_attributes = SKIP, product_customs_category = SKIP, product_hts_number = SKIP, product_id = SKIP, product_image_url = SKIP, product_name = SKIP, product_sku = SKIP, schedule_b = SKIP, shipping_weight_unit = SKIP, shipping_weight_value = SKIP, uuid = SKIP) @country_of_origin = country_of_origin unless country_of_origin == SKIP @epc_list = epc_list unless epc_list == SKIP @material = material unless material == SKIP @product_attributes = product_attributes unless product_attributes == SKIP @product_customs_category = product_customs_category unless product_customs_category == SKIP @product_hts_number = product_hts_number unless product_hts_number == SKIP @product_id = product_id unless product_id == SKIP @product_image_url = product_image_url unless product_image_url == SKIP @product_name = product_name unless product_name == SKIP @product_sku = product_sku unless product_sku == SKIP @schedule_b = schedule_b unless schedule_b == SKIP @shipping_weight_unit = shipping_weight_unit unless shipping_weight_unit == SKIP @shipping_weight_value = shipping_weight_value unless shipping_weight_value == SKIP @uuid = uuid unless uuid == SKIP end |
Instance Attribute Details
#country_of_origin ⇒ String
The origin country code of product (required for international shipments).
14 15 16 |
# File 'lib/new_store_api/models/swap_to.rb', line 14 def country_of_origin @country_of_origin end |
#epc_list ⇒ Array[String]
The origin country code of product (required for international shipments).
18 19 20 |
# File 'lib/new_store_api/models/swap_to.rb', line 18 def epc_list @epc_list end |
#material ⇒ String
The raw material of product (for product's description in custom).
22 23 24 |
# File 'lib/new_store_api/models/swap_to.rb', line 22 def material @material end |
#product_attributes ⇒ ProductAttributes
The raw material of product (for product's description in custom).
26 27 28 |
# File 'lib/new_store_api/models/swap_to.rb', line 26 def product_attributes @product_attributes end |
#product_customs_category ⇒ String
Product's main category subject.
30 31 32 |
# File 'lib/new_store_api/models/swap_to.rb', line 30 def product_customs_category @product_customs_category end |
#product_hts_number ⇒ String
A six digit code specified by harmonized system for tariffs (required for international shipments).
35 36 37 |
# File 'lib/new_store_api/models/swap_to.rb', line 35 def product_hts_number @product_hts_number end |
#product_id ⇒ String
Identifier of the product that is this SalesOrder's line item.
39 40 41 |
# File 'lib/new_store_api/models/swap_to.rb', line 39 def product_id @product_id end |
#product_image_url ⇒ String
Url of the main image of the product.
43 44 45 |
# File 'lib/new_store_api/models/swap_to.rb', line 43 def product_image_url @product_image_url end |
#product_name ⇒ String
Human-readable name of the product that is this SalesOrder's line item.
47 48 49 |
# File 'lib/new_store_api/models/swap_to.rb', line 47 def product_name @product_name end |
#product_sku ⇒ String
SKU of the product that is this SalesOrder's line item.
51 52 53 |
# File 'lib/new_store_api/models/swap_to.rb', line 51 def product_sku @product_sku end |
#schedule_b ⇒ String
a classification code for exporting goods out of the United States. The Schedule B is used to track the amount of trade goods that are being exported from the U.S. The U.S. Census Bureau keeps records of the amount of exports by country/quantity, and dollar amount.
59 60 61 |
# File 'lib/new_store_api/models/swap_to.rb', line 59 def schedule_b @schedule_b end |
#shipping_weight_unit ⇒ String
The chosen weight unit (e.g. 'kg').
63 64 65 |
# File 'lib/new_store_api/models/swap_to.rb', line 63 def shipping_weight_unit @shipping_weight_unit end |
#shipping_weight_value ⇒ Float
Weight of the product, numeric value.
67 68 69 |
# File 'lib/new_store_api/models/swap_to.rb', line 67 def shipping_weight_value @shipping_weight_value end |
#uuid ⇒ String
New unique item ID(Sales Order Item UUID) after swapping. Should be generated in sales_order service.
72 73 74 |
# File 'lib/new_store_api/models/swap_to.rb', line 72 def uuid @uuid end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/new_store_api/models/swap_to.rb', line 145 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. country_of_origin = hash.key?('country_of_origin') ? hash['country_of_origin'] : SKIP epc_list = hash.key?('epc_list') ? hash['epc_list'] : SKIP material = hash.key?('material') ? hash['material'] : SKIP product_attributes = ProductAttributes.from_hash(hash['product_attributes']) if hash['product_attributes'] product_customs_category = hash.key?('product_customs_category') ? hash['product_customs_category'] : SKIP product_hts_number = hash.key?('product_hts_number') ? hash['product_hts_number'] : SKIP product_id = hash.key?('product_id') ? hash['product_id'] : SKIP product_image_url = hash.key?('product_image_url') ? hash['product_image_url'] : SKIP product_name = hash.key?('product_name') ? hash['product_name'] : SKIP product_sku = hash.key?('product_sku') ? hash['product_sku'] : SKIP schedule_b = hash.key?('schedule_b') ? hash['schedule_b'] : SKIP shipping_weight_unit = hash.key?('shipping_weight_unit') ? hash['shipping_weight_unit'] : SKIP shipping_weight_value = hash.key?('shipping_weight_value') ? hash['shipping_weight_value'] : SKIP uuid = hash.key?('uuid') ? hash['uuid'] : SKIP # Create object from extracted values. SwapTo.new(country_of_origin, epc_list, material, product_attributes, product_customs_category, product_hts_number, product_id, product_image_url, product_name, product_sku, schedule_b, shipping_weight_unit, shipping_weight_value, uuid) end |
.names ⇒ Object
A mapping from model property names to API property names.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/new_store_api/models/swap_to.rb', line 75 def self.names @_hash = {} if @_hash.nil? @_hash['country_of_origin'] = 'country_of_origin' @_hash['epc_list'] = 'epc_list' @_hash['material'] = 'material' @_hash['product_attributes'] = 'product_attributes' @_hash['product_customs_category'] = 'product_customs_category' @_hash['product_hts_number'] = 'product_hts_number' @_hash['product_id'] = 'product_id' @_hash['product_image_url'] = 'product_image_url' @_hash['product_name'] = 'product_name' @_hash['product_sku'] = 'product_sku' @_hash['schedule_b'] = 'schedule_b' @_hash['shipping_weight_unit'] = 'shipping_weight_unit' @_hash['shipping_weight_value'] = 'shipping_weight_value' @_hash['uuid'] = 'uuid' @_hash end |
.nullables ⇒ Object
An array for nullable fields
115 116 117 118 119 |
# File 'lib/new_store_api/models/swap_to.rb', line 115 def self.nullables %w[ product_attributes ] end |
.optionals ⇒ Object
An array for optional fields
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/new_store_api/models/swap_to.rb', line 95 def self.optionals %w[ country_of_origin epc_list material product_attributes product_customs_category product_hts_number product_id product_image_url product_name product_sku schedule_b shipping_weight_unit shipping_weight_value uuid ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
190 191 192 193 194 195 196 |
# File 'lib/new_store_api/models/swap_to.rb', line 190 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
211 212 213 214 215 216 217 218 219 220 221 |
# File 'lib/new_store_api/models/swap_to.rb', line 211 def inspect class_name = self.class.name.split('::').last "<#{class_name} country_of_origin: #{@country_of_origin.inspect}, epc_list:"\ " #{@epc_list.inspect}, material: #{@material.inspect}, product_attributes:"\ " #{@product_attributes.inspect}, product_customs_category:"\ " #{@product_customs_category.inspect}, product_hts_number: #{@product_hts_number.inspect},"\ " product_id: #{@product_id.inspect}, product_image_url: #{@product_image_url.inspect},"\ " product_name: #{@product_name.inspect}, product_sku: #{@product_sku.inspect}, schedule_b:"\ " #{@schedule_b.inspect}, shipping_weight_unit: #{@shipping_weight_unit.inspect},"\ " shipping_weight_value: #{@shipping_weight_value.inspect}, uuid: #{@uuid.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
199 200 201 202 203 204 205 206 207 208 |
# File 'lib/new_store_api/models/swap_to.rb', line 199 def to_s class_name = self.class.name.split('::').last "<#{class_name} country_of_origin: #{@country_of_origin}, epc_list: #{@epc_list}, material:"\ " #{@material}, product_attributes: #{@product_attributes}, product_customs_category:"\ " #{@product_customs_category}, product_hts_number: #{@product_hts_number}, product_id:"\ " #{@product_id}, product_image_url: #{@product_image_url}, product_name: #{@product_name},"\ " product_sku: #{@product_sku}, schedule_b: #{@schedule_b}, shipping_weight_unit:"\ " #{@shipping_weight_unit}, shipping_weight_value: #{@shipping_weight_value}, uuid:"\ " #{@uuid}>" end |