Class: Access::Autocomplete

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

Class Method Summary collapse

Instance Method Summary collapse

Methods included from MuchMeta

#set_up_methods, #set_values

Constructor Details

#initialize(values) ⇒ Autocomplete

Returns a new instance of Autocomplete.



25
26
27
28
29
30
31
32
33
# File 'lib/access/autocomplete.rb', line 25

def initialize(values)
  @used_fields = []
  set_up_methods(values)
  set_values(values)
  @offers = Access::Offer.process_batch(@offers) if @offers
  @stores = Access::Store.process_batch(@stores) if @stores
  @locations = Access::Location.process_batch(@locations) if @locations
  @categories = Access::Category.process_batch(@categories) if @categories
end

Class Method Details

.search(options = {}) ⇒ Object



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

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

.search_categories(options = {}) ⇒ Object



13
14
15
# File 'lib/access/autocomplete.rb', line 13

def self.search_categories(options = {})
  Access::Api.new.autocomplete options.merge(resources: 'categories')
end

.search_locations(options = {}) ⇒ Object



21
22
23
# File 'lib/access/autocomplete.rb', line 21

def self.search_locations(options = {})
  Access::Api.new.autocomplete options.merge(resources: 'locations')
end

.search_offers(options = {}) ⇒ Object



17
18
19
# File 'lib/access/autocomplete.rb', line 17

def self.search_offers(options = {})
  Access::Api.new.autocomplete options.merge(resources: 'offers')
end

.search_stores(options = {}) ⇒ Object



9
10
11
# File 'lib/access/autocomplete.rb', line 9

def self.search_stores(options = {})
  Access::Api.new.autocomplete options.merge(resources: 'stores')
end