Sha256: 679177a0933e061b48e02681547b340e81a9e2ef8ba2975a0519784803dc384d

Contents?: true

Size: 506 Bytes

Versions: 2

Compression:

Stored size: 506 Bytes

Contents

module Onebox
  module Engine
    class AmazonOnebox
      include Engine
      include HTML

      matches do
        #/^https?:\/\/(?:www\.)?amazon.(com|ca)\/.*$/
        find "amazon.com"
      end

      private

      def data
        {
          url: @url,
          name: raw.css("h1").inner_text,
          image: raw.css("#main-image").first["src"],
          description: raw.css("#postBodyPS").inner_text,
          price: raw.css(".priceLarge").inner_text
        }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
onebox-1.0.1 lib/onebox/engine/amazon_onebox.rb
onebox-1.0.0 lib/onebox/engine/amazon_onebox.rb