class Zomato2::Establishment

Restaurant types

Attributes

city_id[R]
id[R]
name[R]

Public Class Methods

new(zom_conn, cityid, attributes) click to toggle source
Calls superclass method Zomato2::EntityBase::new
# File lib/zomato2/establishment.rb, line 7
def initialize(zom_conn, cityid, attributes)
  super(zom_conn)
  @city_id = cityid
  @id  = attributes['id']
  @name = attributes['name']
end

Public Instance Methods

restaurants(start: nil, count: nil) click to toggle source
# File lib/zomato2/establishment.rb, line 14
def restaurants(start: nil, count: nil)
  q = {establishment_id: @id, entity_type: 'city', entity_id: @city_id }
  q[:start] = start if start
  q[:count] = count if count
  results = get('search', q)
  results['restaurants'].map do |e|
    r = Restaurant.new(@zom_conn, e['restaurant'])
    r.establishments = Array.new 
    r.establishments << self
    r
  end
end