Class: Mws::Apis::Feeds::Feed
- Inherits:
-
Object
- Object
- Mws::Apis::Feeds::Feed
- Defined in:
- lib/mws/apis/feeds/feed.rb
Defined Under Namespace
Constant Summary collapse
- Type =
Mws::Enum.for( product: '_POST_PRODUCT_DATA_', product_relationship: '_POST_PRODUCT_RELATIONSHIP_DATA_', item: '_POST_ITEM_DATA_', override: '_POST_PRODUCT_OVERRIDES_DATA_', image: '_POST_PRODUCT_IMAGE_DATA_', price: '_POST_PRODUCT_PRICING_DATA_', inventory: '_POST_INVENTORY_AVAILABILITY_DATA_', order_acknowledgement: '_POST_ORDER_ACKNOWLEDGEMENT_DATA_', order_fufillment: '_POST_ORDER_FULFILLMENT_DATA_', fulfillment_order_request: '_POST_FULFILLMENT_ORDER_REQUEST_DATA_', fulfillment_order_cancellation: '_POST_FULFILLMENT_ORDER_CANCELLATION_REQUEST_DATA' )
Instance Attribute Summary collapse
-
#merchant ⇒ Object
readonly
Returns the value of attribute merchant.
-
#purge_and_replace ⇒ Object
readonly
Returns the value of attribute purge_and_replace.
Instance Method Summary collapse
-
#initialize(merchant, message_type, purge_and_replace = false, &block) ⇒ Feed
constructor
A new instance of Feed.
- #messages ⇒ Object
- #to_xml ⇒ Object
Constructor Details
#initialize(merchant, message_type, purge_and_replace = false, &block) ⇒ Feed
Returns a new instance of Feed.
25 26 27 28 29 30 31 32 33 |
# File 'lib/mws/apis/feeds/feed.rb', line 25 def initialize(merchant, , purge_and_replace=false, &block) @merchant = merchant raise Mws::Errors::ValidationError, 'Merchant identifier is required.' if @merchant.nil? @message_type = Message::Type.for() raise Mws::Errors::ValidationError, 'A valid message type is required.' if @message_type.nil? @purge_and_replace = purge_and_replace @messages = [] Builder.new(self, @messages).instance_eval &block if block_given? end |
Instance Attribute Details
#merchant ⇒ Object (readonly)
Returns the value of attribute merchant.
21 22 23 |
# File 'lib/mws/apis/feeds/feed.rb', line 21 def merchant @merchant end |
#purge_and_replace ⇒ Object (readonly)
Returns the value of attribute purge_and_replace.
21 22 23 |
# File 'lib/mws/apis/feeds/feed.rb', line 21 def purge_and_replace @purge_and_replace end |
Instance Method Details
#messages ⇒ Object
35 36 37 |
# File 'lib/mws/apis/feeds/feed.rb', line 35 def @messages.dup end |
#to_xml ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/mws/apis/feeds/feed.rb', line 39 def to_xml Nokogiri::XML::Builder.new do | xml | xml.AmazonEnvelope('xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:noNamespaceSchemaLocation' => 'amznenvelope.xsd') { xml.Header { xml.DocumentVersion '1.01' xml.MerchantIdentifier @merchant } xml.MessageType @message_type.val xml.PurgeAndReplace @purge_and_replace @messages.each do | | .to_xml xml end } end.to_xml end |