Class: Access::Store
- Inherits:
-
Object
- Object
- Access::Store
- Defined in:
- lib/access/store.rb
Class Method Summary collapse
- .find(store_key, options = {}) ⇒ Object
- .national(options = {}) ⇒ Object
- .process_batch(chunk) ⇒ Object
- .search(options = {}) ⇒ Object
Instance Method Summary collapse
-
#initialize(values) ⇒ Store
constructor
A new instance of Store.
Constructor Details
#initialize(values) ⇒ Store
Returns a new instance of Store.
20 21 22 23 24 25 26 27 28 |
# File 'lib/access/store.rb', line 20 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 |
Class Method Details
.find(store_key, options = {}) ⇒ Object
8 9 10 |
# File 'lib/access/store.rb', line 8 def self.find(store_key, = {}) Access::Api.new.find_store store_key, end |
.national(options = {}) ⇒ Object
12 13 14 |
# File 'lib/access/store.rb', line 12 def self.national( = {}) Access::Api.new.national_stores end |
.process_batch(chunk) ⇒ Object
16 17 18 |
# File 'lib/access/store.rb', line 16 def self.process_batch(chunk) chunk.map { |store| new(store) } end |
.search(options = {}) ⇒ Object
4 5 6 |
# File 'lib/access/store.rb', line 4 def self.search( = {}) Access::Api.new.search_stores end |