lib/mws/orders/order_item.rb in mws-orders-0.4.0 vs lib/mws/orders/order_item.rb in mws-orders-0.5.0
- old
+ new
@@ -1,110 +1,147 @@
# frozen_string_literal: true
require 'mws/orders/entity'
+require 'mws/orders/buyer_customized_info'
require 'mws/orders/invoice_data'
+require 'mws/orders/points_granted'
+require 'mws/orders/product_info'
+require 'mws/orders/tax_collection'
module MWS
module Orders
+ # https://docs.developer.amazonservices.com/en_US/orders-2013-09-01/Orders_Datatypes.html#OrderItem
class OrderItem < Entity
attribute(:asin) do
- text_at_xpath('ASIN')
+ string('ASIN')
end
+ attribute(:order_item_id) do
+ string('OrderItemId')
+ end
+
attribute(:seller_sku) do
- text_at_xpath('SellerSKU')
+ string('SellerSKU')
end
- attribute(:order_item_id) do
- text_at_xpath('OrderItemId')
+ attribute(:buyer_customized_info) do
+ entity('BuyerCustomizedInfo', BuyerCustomizedInfo)
end
attribute(:title) do
- text_at_xpath('Title')
+ string('Title')
end
attribute(:quantity_ordered) do
- integer_at_xpath('QuantityOrdered')
+ integer('QuantityOrdered')
end
attribute(:quantity_shipped) do
- integer_at_xpath('QuantityShipped')
+ integer('QuantityShipped')
end
- attribute(:gift_message_text) do
- text_at_xpath('GiftMessageText')
+ attribute(:points_granted) do
+ entity('PointsGranted', PointsGranted)
end
- attribute(:gift_wrap_level) do
- text_at_xpath('GiftWrapLevel')
+ attribute(:product_info) do
+ entity('ProductInfo', ProductInfo)
end
attribute(:item_price) do
- money_at_xpath('ItemPrice')
+ money('ItemPrice')
end
attribute(:shipping_price) do
- money_at_xpath('ShippingPrice')
+ money('ShippingPrice')
end
attribute(:gift_wrap_price) do
- money_at_xpath('GiftWrapPrice')
+ money('GiftWrapPrice')
end
+ attribute(:tax_collection) do
+ entity('TaxCollection', TaxCollection)
+ end
+
attribute(:item_tax) do
- money_at_xpath('ItemTax')
+ money('ItemTax')
end
attribute(:shipping_tax) do
- money_at_xpath('ShippingTax')
+ money('ShippingTax')
end
attribute(:gift_wrap_tax) do
- money_at_xpath('GiftWrapPrice')
+ money('GiftWrapPrice')
end
attribute(:shipping_discount) do
- money_at_xpath('ShippingDiscount')
+ money('ShippingDiscount')
end
attribute(:promotion_discount) do
- money_at_xpath('PromotionDiscount')
+ money('PromotionDiscount')
end
attribute(:promotion_ids) do
- xpath('PromotionId').map(&:text)
+ xpath('PromotionIds').map(&:text)
end
attribute(:cod_fee) do
- money_at_xpath('CODFee')
+ money('CODFee')
end
attribute(:cod_fee_discount) do
- money_at_xpath('CODFeeDiscount')
+ money('CODFeeDiscount')
end
+ attribute(:gift?) do
+ boolean('IsGift')
+ end
+
+ attribute(:gift_message_text) do
+ string('GiftMessageText')
+ end
+
+ attribute(:gift_wrap_level) do
+ string('GiftWrapLevel')
+ end
+
attribute(:invoice_data) do
- xpath('InvoiceData').map { |node| InvoiceData.new(node) }
+ entity('InvoiceData', InvoiceData)
end
+ attribute(:condition_note) do
+ string('ConditionNote')
+ end
+
attribute(:condition_id) do
- text_at_xpath('ConditionId')
+ string('ConditionId')
end
attribute(:condition_subtype_id) do
- text_at_xpath('ConditionSubtypeId')
+ string('ConditionSubtypeId')
end
- attribute(:condition_note) do
- text_at_xpath('ConditionNote')
+ attribute(:scheduled_delivery_starts_at) do
+ time('ScheduledDeliveryStartDate')
end
attribute(:scheduled_delivery_ends_at) do
- time_at_xpath('ScheduledDeliveryEndDate')
+ time('ScheduledDeliveryEndDate')
end
- attribute(:scheduled_delivery_starts_at) do
- time_at_xpath('ScheduledDeliveryStartDate')
+ attribute(:price_designation) do
+ string('PriceDesignation')
+ end
+
+ attribute(:transparency?) do
+ boolean('IsTransparency')
+ end
+
+ attribute(:serial_number_required?) do
+ boolean('SerialNumberRequired')
end
def to_s
order_item_id
end