Class: Spree::FeedProduct

Inherits:
Object
  • Object
show all
Defined in:
app/models/spree/feed_product.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(product) ⇒ FeedProduct

Returns a new instance of FeedProduct.



5
6
7
# File 'app/models/spree/feed_product.rb', line 5

def initialize(product)
  @product = product
end

Instance Attribute Details

#productObject (readonly)

Returns the value of attribute product.



3
4
5
# File 'app/models/spree/feed_product.rb', line 3

def product
  @product
end

Instance Method Details

#categoryObject



22
23
# File 'app/models/spree/feed_product.rb', line 22

def category
end

#conditionObject

Must be “new”, “refurbished”, or “used”.



26
27
28
# File 'app/models/spree/feed_product.rb', line 26

def condition
  "new"
end

#descriptionObject



17
18
19
# File 'app/models/spree/feed_product.rb', line 17

def description
  product.description
end

#idObject



9
10
11
# File 'app/models/spree/feed_product.rb', line 9

def id
  product.id
end


34
35
36
37
# File 'app/models/spree/feed_product.rb', line 34

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

#priceObject



30
31
32
# File 'app/models/spree/feed_product.rb', line 30

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

#titleObject



13
14
15
# File 'app/models/spree/feed_product.rb', line 13

def title
  product.name
end