Sha256: 40316ec0f1ca5d6c26cf5f885350b7e7f6d5ec70ec96bb8e92c9fce90849e6b1

Contents?: true

Size: 829 Bytes

Versions: 9

Compression:

Stored size: 829 Bytes

Contents

module Access
  class Product
    include Access::MuchMeta

    attr_reader :store, :location

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

    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

    def location
      @offer_store.physical_location
    end

    def store
      @offer_store
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
access-2.3.0.pre.rc2 lib/access/product.rb
access-2.3.0.pre.rc1 lib/access/product.rb
access-2.2.0 lib/access/product.rb
access-2.1.5 lib/access/product.rb
access-2.1.4 lib/access/product.rb
access-2.1.3 lib/access/product.rb
access-2.1.2 lib/access/product.rb
access-2.1.1 lib/access/product.rb
access-2.1.0 lib/access/product.rb