Class: NewStoreApi::EnrichedTransactionItemDto
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::EnrichedTransactionItemDto
- Defined in:
- lib/new_store_api/models/enriched_transaction_item_dto.rb
Overview
EnrichedTransactionItemDto Model.
Instance Attribute Summary collapse
-
#consumer_uuid ⇒ String
UUID of the consumer.
-
#currency_consumer ⇒ String
Currency code shown and billed to the consumer.
-
#extended_attributes ⇒ Array[ExtAttrResource]
The item's list of extended attributes.
-
#handling_charges ⇒ Float
Cost of handling.
-
#id ⇒ String
Unique identifier of the item.
-
#item_price ⇒ Float
Price per quantity 1 of the item, can be incl.
-
#price_line_item ⇒ Float
Gross price for the total quantity of the line item, after all discounts.
-
#price_net ⇒ Float
Net price for total quantity of line item, after applying all discounts.
-
#price_tax ⇒ Float
Total amount of tax added to the net price, after appplying all discounts.
-
#product_id ⇒ String
Unique identifier of the product.
-
#product_name ⇒ String
Human-readable name of the product.
-
#product_sku ⇒ String
SKU of the product.
-
#quantity ⇒ Integer
Item quantity.
-
#shipping_address ⇒ EnrichedTransactionAddressDto
Consumer's shipping address.
-
#shipping_origin ⇒ EnrichedTransactionAddressDto
The origin of goods address, e.g.
-
#tax_class ⇒ String
Tax classification identifier for the line item.
-
#tax_method ⇒ SalesOrderTaxMethodEnum
Tax classification identifier for the line item.
-
#tax_rates ⇒ Array[TaxRateDto]
All applied tax percent values and tax amounts for total quantity of line item (usually more than one rate per line item).
-
#type ⇒ ItemTypeEnum
All applied tax percent values and tax amounts for total quantity of line item (usually more than one rate per line item).
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(item_price = nil, price_line_item = nil, price_net = nil, price_tax = nil, quantity = nil, shipping_address = nil, shipping_origin = nil, tax_class = nil, tax_method = nil, tax_rates = nil, type = nil, consumer_uuid = SKIP, currency_consumer = SKIP, extended_attributes = SKIP, handling_charges = SKIP, id = SKIP, product_id = SKIP, product_name = SKIP, product_sku = SKIP) ⇒ EnrichedTransactionItemDto
constructor
A new instance of EnrichedTransactionItemDto.
-
#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(item_price = nil, price_line_item = nil, price_net = nil, price_tax = nil, quantity = nil, shipping_address = nil, shipping_origin = nil, tax_class = nil, tax_method = nil, tax_rates = nil, type = nil, consumer_uuid = SKIP, currency_consumer = SKIP, extended_attributes = SKIP, handling_charges = SKIP, id = SKIP, product_id = SKIP, product_name = SKIP, product_sku = SKIP) ⇒ EnrichedTransactionItemDto
Returns a new instance of EnrichedTransactionItemDto.
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/new_store_api/models/enriched_transaction_item_dto.rb', line 136 def initialize(item_price = nil, price_line_item = nil, price_net = nil, price_tax = nil, quantity = nil, shipping_address = nil, shipping_origin = nil, tax_class = nil, tax_method = nil, tax_rates = nil, type = nil, consumer_uuid = SKIP, currency_consumer = SKIP, extended_attributes = SKIP, handling_charges = SKIP, id = SKIP, product_id = SKIP, product_name = SKIP, product_sku = SKIP) @consumer_uuid = consumer_uuid unless consumer_uuid == SKIP @currency_consumer = currency_consumer unless currency_consumer == SKIP @extended_attributes = extended_attributes unless extended_attributes == SKIP @handling_charges = handling_charges unless handling_charges == SKIP @id = id unless id == SKIP @item_price = item_price @price_line_item = price_line_item @price_net = price_net @price_tax = price_tax @product_id = product_id unless product_id == SKIP @product_name = product_name unless product_name == SKIP @product_sku = product_sku unless product_sku == SKIP @quantity = quantity @shipping_address = shipping_address @shipping_origin = shipping_origin @tax_class = tax_class @tax_method = tax_method @tax_rates = tax_rates @type = type end |
Instance Attribute Details
#consumer_uuid ⇒ String
UUID of the consumer.
14 15 16 |
# File 'lib/new_store_api/models/enriched_transaction_item_dto.rb', line 14 def consumer_uuid @consumer_uuid end |
#currency_consumer ⇒ String
Currency code shown and billed to the consumer.
18 19 20 |
# File 'lib/new_store_api/models/enriched_transaction_item_dto.rb', line 18 def currency_consumer @currency_consumer end |
#extended_attributes ⇒ Array[ExtAttrResource]
The item's list of extended attributes.
22 23 24 |
# File 'lib/new_store_api/models/enriched_transaction_item_dto.rb', line 22 def extended_attributes @extended_attributes end |
#handling_charges ⇒ Float
Cost of handling.
26 27 28 |
# File 'lib/new_store_api/models/enriched_transaction_item_dto.rb', line 26 def handling_charges @handling_charges end |
#id ⇒ String
Unique identifier of the item.
30 31 32 |
# File 'lib/new_store_api/models/enriched_transaction_item_dto.rb', line 30 def id @id end |
#item_price ⇒ Float
Price per quantity 1 of the item, can be incl. or excl. tax depending on tax_method.
35 36 37 |
# File 'lib/new_store_api/models/enriched_transaction_item_dto.rb', line 35 def item_price @item_price end |
#price_line_item ⇒ Float
Gross price for the total quantity of the line item, after all discounts.
39 40 41 |
# File 'lib/new_store_api/models/enriched_transaction_item_dto.rb', line 39 def price_line_item @price_line_item end |
#price_net ⇒ Float
Net price for total quantity of line item, after applying all discounts.
43 44 45 |
# File 'lib/new_store_api/models/enriched_transaction_item_dto.rb', line 43 def price_net @price_net end |
#price_tax ⇒ Float
Total amount of tax added to the net price, after appplying all discounts.
47 48 49 |
# File 'lib/new_store_api/models/enriched_transaction_item_dto.rb', line 47 def price_tax @price_tax end |
#product_id ⇒ String
Unique identifier of the product.
51 52 53 |
# File 'lib/new_store_api/models/enriched_transaction_item_dto.rb', line 51 def product_id @product_id end |
#product_name ⇒ String
Human-readable name of the product.
55 56 57 |
# File 'lib/new_store_api/models/enriched_transaction_item_dto.rb', line 55 def product_name @product_name end |
#product_sku ⇒ String
SKU of the product.
59 60 61 |
# File 'lib/new_store_api/models/enriched_transaction_item_dto.rb', line 59 def product_sku @product_sku end |
#quantity ⇒ Integer
Item quantity. Positive number for sold items and negative number for returned items
64 65 66 |
# File 'lib/new_store_api/models/enriched_transaction_item_dto.rb', line 64 def quantity @quantity end |
#shipping_address ⇒ EnrichedTransactionAddressDto
Consumer's shipping address.
68 69 70 |
# File 'lib/new_store_api/models/enriched_transaction_item_dto.rb', line 68 def shipping_address @shipping_address end |
#shipping_origin ⇒ EnrichedTransactionAddressDto
The origin of goods address, e.g. physical address of a store.
72 73 74 |
# File 'lib/new_store_api/models/enriched_transaction_item_dto.rb', line 72 def shipping_origin @shipping_origin end |
#tax_class ⇒ String
Tax classification identifier for the line item.
76 77 78 |
# File 'lib/new_store_api/models/enriched_transaction_item_dto.rb', line 76 def tax_class @tax_class end |
#tax_method ⇒ SalesOrderTaxMethodEnum
Tax classification identifier for the line item.
80 81 82 |
# File 'lib/new_store_api/models/enriched_transaction_item_dto.rb', line 80 def tax_method @tax_method end |
#tax_rates ⇒ Array[TaxRateDto]
All applied tax percent values and tax amounts for total quantity of line item (usually more than one rate per line item).
85 86 87 |
# File 'lib/new_store_api/models/enriched_transaction_item_dto.rb', line 85 def tax_rates @tax_rates end |
#type ⇒ ItemTypeEnum
All applied tax percent values and tax amounts for total quantity of line item (usually more than one rate per line item).
90 91 92 |
# File 'lib/new_store_api/models/enriched_transaction_item_dto.rb', line 90 def type @type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
# File 'lib/new_store_api/models/enriched_transaction_item_dto.rb', line 165 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. item_price = hash.key?('item_price') ? hash['item_price'] : nil price_line_item = hash.key?('price_line_item') ? hash['price_line_item'] : nil price_net = hash.key?('price_net') ? hash['price_net'] : nil price_tax = hash.key?('price_tax') ? hash['price_tax'] : nil quantity = hash.key?('quantity') ? hash['quantity'] : nil shipping_address = EnrichedTransactionAddressDto.from_hash(hash['shipping_address']) if hash['shipping_address'] shipping_origin = EnrichedTransactionAddressDto.from_hash(hash['shipping_origin']) if hash['shipping_origin'] tax_class = hash.key?('tax_class') ? hash['tax_class'] : nil tax_method = hash.key?('tax_method') ? hash['tax_method'] : nil # Parameter is an array, so we need to iterate through it tax_rates = nil unless hash['tax_rates'].nil? tax_rates = [] hash['tax_rates'].each do |structure| tax_rates << (TaxRateDto.from_hash(structure) if structure) end end tax_rates = nil unless hash.key?('tax_rates') type = hash.key?('type') ? hash['type'] : nil consumer_uuid = hash.key?('consumer_uuid') ? hash['consumer_uuid'] : SKIP currency_consumer = hash.key?('currency_consumer') ? hash['currency_consumer'] : SKIP # Parameter is an array, so we need to iterate through it extended_attributes = nil unless hash['extended_attributes'].nil? extended_attributes = [] hash['extended_attributes'].each do |structure| extended_attributes << (ExtAttrResource.from_hash(structure) if structure) end end extended_attributes = SKIP unless hash.key?('extended_attributes') handling_charges = hash.key?('handling_charges') ? hash['handling_charges'] : SKIP id = hash.key?('id') ? hash['id'] : SKIP product_id = hash.key?('product_id') ? hash['product_id'] : SKIP product_name = hash.key?('product_name') ? hash['product_name'] : SKIP product_sku = hash.key?('product_sku') ? hash['product_sku'] : SKIP # Create object from extracted values. EnrichedTransactionItemDto.new(item_price, price_line_item, price_net, price_tax, quantity, shipping_address, shipping_origin, tax_class, tax_method, tax_rates, type, consumer_uuid, currency_consumer, extended_attributes, handling_charges, id, product_id, product_name, product_sku) end |
.names ⇒ Object
A mapping from model property names to API property names.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/new_store_api/models/enriched_transaction_item_dto.rb', line 93 def self.names @_hash = {} if @_hash.nil? @_hash['consumer_uuid'] = 'consumer_uuid' @_hash['currency_consumer'] = 'currency_consumer' @_hash['extended_attributes'] = 'extended_attributes' @_hash['handling_charges'] = 'handling_charges' @_hash['id'] = 'id' @_hash['item_price'] = 'item_price' @_hash['price_line_item'] = 'price_line_item' @_hash['price_net'] = 'price_net' @_hash['price_tax'] = 'price_tax' @_hash['product_id'] = 'product_id' @_hash['product_name'] = 'product_name' @_hash['product_sku'] = 'product_sku' @_hash['quantity'] = 'quantity' @_hash['shipping_address'] = 'shipping_address' @_hash['shipping_origin'] = 'shipping_origin' @_hash['tax_class'] = 'tax_class' @_hash['tax_method'] = 'tax_method' @_hash['tax_rates'] = 'tax_rates' @_hash['type'] = 'type' @_hash end |
.nullables ⇒ Object
An array for nullable fields
132 133 134 |
# File 'lib/new_store_api/models/enriched_transaction_item_dto.rb', line 132 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/new_store_api/models/enriched_transaction_item_dto.rb', line 118 def self.optionals %w[ consumer_uuid currency_consumer extended_attributes handling_charges id product_id product_name product_sku ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
247 248 249 250 251 252 253 254 255 256 257 258 259 |
# File 'lib/new_store_api/models/enriched_transaction_item_dto.rb', line 247 def inspect class_name = self.class.name.split('::').last "<#{class_name} consumer_uuid: #{@consumer_uuid.inspect}, currency_consumer:"\ " #{@currency_consumer.inspect}, extended_attributes: #{@extended_attributes.inspect},"\ " handling_charges: #{@handling_charges.inspect}, id: #{@id.inspect}, item_price:"\ " #{@item_price.inspect}, price_line_item: #{@price_line_item.inspect}, price_net:"\ " #{@price_net.inspect}, price_tax: #{@price_tax.inspect}, product_id:"\ " #{@product_id.inspect}, product_name: #{@product_name.inspect}, product_sku:"\ " #{@product_sku.inspect}, quantity: #{@quantity.inspect}, shipping_address:"\ " #{@shipping_address.inspect}, shipping_origin: #{@shipping_origin.inspect}, tax_class:"\ " #{@tax_class.inspect}, tax_method: #{@tax_method.inspect}, tax_rates:"\ " #{@tax_rates.inspect}, type: #{@type.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
235 236 237 238 239 240 241 242 243 244 |
# File 'lib/new_store_api/models/enriched_transaction_item_dto.rb', line 235 def to_s class_name = self.class.name.split('::').last "<#{class_name} consumer_uuid: #{@consumer_uuid}, currency_consumer: #{@currency_consumer},"\ " extended_attributes: #{@extended_attributes}, handling_charges: #{@handling_charges}, id:"\ " #{@id}, item_price: #{@item_price}, price_line_item: #{@price_line_item}, price_net:"\ " #{@price_net}, price_tax: #{@price_tax}, product_id: #{@product_id}, product_name:"\ " #{@product_name}, product_sku: #{@product_sku}, quantity: #{@quantity}, shipping_address:"\ " #{@shipping_address}, shipping_origin: #{@shipping_origin}, tax_class: #{@tax_class},"\ " tax_method: #{@tax_method}, tax_rates: #{@tax_rates}, type: #{@type}>" end |