Sha256: 665776f436f5758158f6062196511fc8a78d2a4c6e5d08f7ced7a0a8ec0e58a3

Contents?: true

Size: 871 Bytes

Versions: 46

Compression:

Stored size: 871 Bytes

Contents

module Access
  class Store

    def self.search(options = {})
      Access::Api.new.search_stores options
    end

    def self.find(store_key, options = {})
      Access::Api.new.find_store store_key, options
    end

    def self.national(options = {})
      Access::Api.new.national_stores options
    end

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

    def initialize(values)
      self.class.class_eval {attr_reader *values.keys }
      values.each do |attribute_name, attribute_value|
        self.instance_variable_set("@#{attribute_name}", attribute_value)
      end
      @links = Access::Link.new(@links) if @links
      @store_categories = Access::Category.process_batch(@store_categories) if @store_categories
      @physical_location = Access::Location.new(@physical_location) if @physical_location
    end

  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
access-2.0.50 lib/access/store.rb
access-2.0.49 lib/access/store.rb
access-2.0.48 lib/access/store.rb
access-2.0.47 lib/access/store.rb
access-2.0.46 lib/access/store.rb
access-2.0.44 lib/access/store.rb
access-2.0.43 lib/access/store.rb
access-2.0.42 lib/access/store.rb
access-2.0.41 lib/access/store.rb
access-2.0.40 lib/access/store.rb
access-2.0.39 lib/access/store.rb
access-2.0.38 lib/access/store.rb
access-2.0.37 lib/access/store.rb
access-2.0.36 lib/access/store.rb
access-2.0.34 lib/access/store.rb
access-2.0.33 lib/access/store.rb
access-2.0.32 lib/access/store.rb
access-2.0.31 lib/access/store.rb
access-2.0.30 lib/access/store.rb
access-2.0.29 lib/access/store.rb