Class: Hungry::Venue::Collection
- Inherits:
-
Collection
show all
- Includes:
- Pagination
- Defined in:
- lib/hungry/venue/collection.rb
Instance Attribute Summary
Attributes inherited from Collection
#criteria, #endpoint, #klass
Instance Method Summary
collapse
Methods inherited from Collection
#[], #all, #count, #each, #first, #from_url, get, #initialize, #results, #results=
Instance Method Details
#maintainable_by(user_or_id) ⇒ Object
23
24
25
26
27
28
|
# File 'lib/hungry/venue/collection.rb', line 23
def maintainable_by(user_or_id)
user_id = user_or_id.to_s =~ /^[0-9]+$/ ?
user_or_id.to_i : user_or_id.id
all maintainer_id: user_id
end
|
#nearby(location, options = {}) ⇒ Object
12
13
14
15
16
17
|
# File 'lib/hungry/venue/collection.rb', line 12
def nearby(location, options = {})
options[:geolocation] = Geolocation.parse(location)
options[:sort_by] ||= 'distance'
all options
end
|
#search(query) ⇒ Object
8
9
10
|
# File 'lib/hungry/venue/collection.rb', line 8
def search(query)
all query: query
end
|
#sort_by(subject) ⇒ Object
30
31
32
|
# File 'lib/hungry/venue/collection.rb', line 30
def sort_by(subject)
all sort_by: subject
end
|
#tagged_with(*tags) ⇒ Object
19
20
21
|
# File 'lib/hungry/venue/collection.rb', line 19
def tagged_with(*tags)
all tags: (current_tags + tags.flatten).compact.join(',')
end
|