Class: Peddler::Feeds::OrderCancellation::Item
- Inherits:
-
Object
- Object
- Peddler::Feeds::OrderCancellation::Item
- Defined in:
- lib/peddler/feeds.rb
Overview
This is a cancelled order item.
Instance Attribute Summary collapse
-
#amazon_order_item_code ⇒ Object
Returns the value of attribute amazon_order_item_code.
-
#cancellation_reason_code ⇒ Object
Returns the value of attribute cancellation_reason_code.
-
#order_id ⇒ Object
Returns the value of attribute order_id.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Item
constructor
A new instance of Item.
-
#to_s ⇒ Object
Outputs a formatted line for the tab-delimited upload file.
Constructor Details
#initialize(params = {}) ⇒ Item
Returns a new instance of Item.
168 169 170 |
# File 'lib/peddler/feeds.rb', line 168 def initialize(params={}) params.each_pair{ |key, value| send("#{key}=", value) } end |
Instance Attribute Details
#amazon_order_item_code ⇒ Object
Returns the value of attribute amazon_order_item_code.
165 166 167 |
# File 'lib/peddler/feeds.rb', line 165 def amazon_order_item_code @amazon_order_item_code end |
#cancellation_reason_code ⇒ Object
Returns the value of attribute cancellation_reason_code.
166 167 168 |
# File 'lib/peddler/feeds.rb', line 166 def cancellation_reason_code @cancellation_reason_code end |
#order_id ⇒ Object
Returns the value of attribute order_id.
165 166 167 |
# File 'lib/peddler/feeds.rb', line 165 def order_id @order_id end |
Instance Method Details
#to_s ⇒ Object
Outputs a formatted line for the tab-delimited upload file.
178 179 180 181 182 183 |
# File 'lib/peddler/feeds.rb', line 178 def to_s if @cancellation_reason_code.nil? != @amazon_order_item_code.nil? raise PeddlerError.new('Provide codes for both cancellation reason and Amazon order item (or omit both).') end "#{@order_id}\t#{@cancellation_reason_code}\t#{@amazon_order_item_code}\r\n" end |