Class: Access::Product

Inherits:
Object
  • Object
show all
Includes:
MuchMeta
Defined in:
lib/access/product.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from MuchMeta

#set_up_methods, #set_values

Constructor Details

#initialize(values) ⇒ Product

Returns a new instance of Product.



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/access/product.rb', line 11

def initialize(values)
  @used_fields = []
  set_up_methods(values)
  set_values(values)
  @offer = Access::Offer.new(@offer) if @offer
  @offer_store = Access::Store.new(@offer_store) if @offer_store
  @categories = Access::Category.process_batch(@categories) if @categories
  @links = Access::Link.new(@links) if @links
  @offer_store = Access::Store.new(@offer_store) if @offer_store
  @offer_uses_remaining = Access::Redemption.new(@offer_uses_remaining) if @offer_uses_remaining
end

Instance Attribute Details

#locationObject (readonly)

Returns the value of attribute location.



5
6
7
# File 'lib/access/product.rb', line 5

def location
  @location
end

#storeObject (readonly)

Returns the value of attribute store.



5
6
7
# File 'lib/access/product.rb', line 5

def store
  @store
end

Class Method Details

.process_batch(chunk) ⇒ Object



7
8
9
# File 'lib/access/product.rb', line 7

def self.process_batch(chunk)
  chunk.map { |product| new(product) }
end