Sha256: 9328425d758627c963c4f30fd7588f822e478b42107b3449d54b5ac144c053e0
Contents?: true
Size: 1.16 KB
Versions: 2
Compression:
Stored size: 1.16 KB
Contents
module Hungry class Menu < Resource autoload :Category, 'hungry/menu/category' autoload :Dish, 'hungry/menu/dish' autoload :Option, 'hungry/menu/option' self.endpoint = '/menus' ### RESOURCES: belongs_to :venue, 'Hungry::Venue' ### ATTRIBUTES: ### Menu: attr_accessor :id, :name, :type, :attachment, ### Associations: :categories, :venue, ### Utility: :created_at, :updated_at lazy_load :venue def managed? type == 'managed' || categories.present? end def download? type == 'download' end def venue=(venue_attributes) @venue = Hungry::Venue.new(venue_attributes) end def categories @categories ||= [] end lazy_load :categories def categories=(new_categories) @categories = new_categories.map do |attributes| category = Menu::Category.new(attributes) category.menu = self category.data_source = data_source category end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hungry-0.1.1 | lib/hungry/menu.rb |
hungry-0.1.0 | lib/hungry/menu.rb |