Sha256: 8e3f0f6a5b6c2f6f1d675b57468e529a281bfd85dabe9aeb71b1699918db2909

Contents?: true

Size: 534 Bytes

Versions: 1

Compression:

Stored size: 534 Bytes

Contents

module Onebox
  module Engine
    class AmazonOnebox
      include Engine
      include HTML

      matches do
        http
        maybe("www.")
        domain("amazon")
        has(".").either("com", "ca").maybe("/")
      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

1 entries across 1 versions & 1 rubygems

Version Path
onebox-1.1.0 lib/onebox/engine/amazon_onebox.rb