Sha256: 2ff766b696f67624d7df757f5374120bcb9d5df35abbe0d529a3a043b17d8f26

Contents?: true

Size: 700 Bytes

Versions: 2

Compression:

Stored size: 700 Bytes

Contents

module AmazonOrder
  module Parsers
    class Product < Base
      ATTRIBUTES = %w[
                     title
                     path
                     content
                     image_url
                   ]

      def title
        @_title ||= @node.css('.a-col-right .a-row')[0].text.strip
      end

      def path
        @_path ||= @node.css('.a-col-right .a-row a')[0].attr('href') rescue nil
      end

      def content
        @_content ||= @node.css('.a-col-right .a-row')[1..-1].map(&:text).join.gsub(/\s+/, ' ').strip
      end

      def image_url
        @_image_url ||= get_original_image_url(@node.css('.a-col-left img')[0].attr('data-a-hires'))
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
amazon_order-0.1.3 lib/amazon_order/parsers/product.rb
amazon_order-0.1.2 lib/amazon_order/parsers/product.rb