Sha256: 9c7025be2a8b2dee56fcdfcf45c7df7c6279422601588ff55b3d96780d4feb56

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

module Hungry
  class Venue < Resource
    autoload :Collection, 'hungry/venue/collection'
    
    self.endpoint = '/venues'
    
    ### RESOURCES:
    
    has_many :reviews, Review
    
    belongs_to :country, Country
    
    belongs_to :region, Region
    
    belongs_to :city, City
    
    ### ATTRIBUTES:
    
                  ### Preview:
    attr_accessor :id, :name, :category, :telephone, :fax, :website_url,
                  :tagline, :rating, :url, :address, :geolocation, :relevance,
                  :distance, :plan,
                  
                  ### Full:
                  :reachability, :staff, :prices, :capacity, :description,
                  :tags, :menus, :images, :maintainers, :awards, :opening_hours,
                  
                  ### Utility:
                  :resources,  :counters, :created_at, :updated_at
    
    ### FINDERS:
    
    def self.collection
      Collection.new(self, endpoint, default_criteria)
    end
    
    def self.search(query)
      collection.search(query)
    end
    
    def self.nearby(geolocation, options = {})
      collection.nearby(geolocation, options)
    end
    
    def self.tagged_with(*tags)
      collection.tagged_with(*tags)
    end
    
    def self.sort_by(sortable)
      collection.sort_by(sortable)
    end
    
    def self.paginate(page, options = {})
      collection.paginate(page, options)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hungry-0.0.1 lib/hungry/venue.rb