Class: AmazonOrder::Parsers::Shipment
- Defined in:
- lib/amazon_order/parsers/shipment.rb
Constant Summary collapse
- ATTRIBUTES =
%w[ shipment_status shipment_note ]
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#order ⇒ Object
TODO shipment_date.
- #products ⇒ Object
- #shipment_note ⇒ Object
- #shipment_status ⇒ Object
Methods inherited from Base
#get_original_image_url, #initialize, #inspect, #parse_date, #to_hash, #values
Constructor Details
This class inherits a constructor from AmazonOrder::Parsers::Base
Instance Method Details
#order ⇒ Object
TODO shipment_date
11 12 13 |
# File 'lib/amazon_order/parsers/shipment.rb', line 11 def order @containing_object end |
#products ⇒ Object
32 33 34 |
# File 'lib/amazon_order/parsers/shipment.rb', line 32 def products @_products ||= @node.css('.a-fixed-left-grid').map { |e| AmazonOrder::Parsers::Product.new(e, fetched_at: fetched_at) } end |
#shipment_note ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/amazon_order/parsers/shipment.rb', line 20 def shipment_note @_shipment_note ||= case order.order_type when :shipment_order @node.css('.shipment-top-row').present? ? @node.css('.shipment .shipment-top-row .a-row')[1].text.strip : nil when :service_order nil when :digital_order nil end end |
#shipment_status ⇒ Object
15 16 17 18 |
# File 'lib/amazon_order/parsers/shipment.rb', line 15 def shipment_status # class names like "shipment-is-delivered" in '.shipment' node may be useful @_shipment_status ||= @node.css('.shipment-top-row').present? ? @node.css('.shipment .shipment-top-row .a-row')[0].text.strip : nil end |