Class: Zomato2::Cuisine

Inherits:
EntityBase show all
Defined in:
lib/zomato2/cuisine.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from EntityBase

#get, #to_s

Constructor Details

#initialize(zom_conn, cityid, attributes) ⇒ Cuisine

Returns a new instance of Cuisine.



6
7
8
9
10
11
# File 'lib/zomato2/cuisine.rb', line 6

def initialize(zom_conn, cityid, attributes)
  super(zom_conn)
  @city_id = cityid
  @id = attributes['cuisine_id']
  @name = attributes['cuisine_name']
end

Instance Attribute Details

#city_idObject (readonly)

Returns the value of attribute city_id.



4
5
6
# File 'lib/zomato2/cuisine.rb', line 4

def city_id
  @city_id
end

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/zomato2/cuisine.rb', line 4

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/zomato2/cuisine.rb', line 4

def name
  @name
end

Instance Method Details

#restaurants(start: nil, count: nil) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/zomato2/cuisine.rb', line 13

def restaurants(start: nil, count: nil)
  q = {cuisines: @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 { |e| Restaurant.new(@zom_conn, e['restaurant']) }
end