Sha256: a2d3a728f74855275ee59bf4989af0db516998c68c803f75272ece1f5411437f

Contents?: true

Size: 635 Bytes

Versions: 1

Compression:

Stored size: 635 Bytes

Contents

module Spree
  class FeedProduct
    attr_reader :product

    def initialize(product)
      @product = product
    end

    def id
      product.id
    end

    def title
      product.name
    end

    def description
      product.description
    end

    # Must be selected from https://support.google.com/merchants/answer/1705911
    def category
    end

    # Must be "new", "refurbished", or "used".
    def condition
      "new"
    end

    def price
      Spree::Money.new(product.price)
    end

    def image_link
      return unless product.images.any?
      product.images.first.attachment.url(:large)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_product_feed-1.0.0 app/models/spree/feed_product.rb