Class: Zomato2::Cuisine
- Inherits:
-
EntityBase
- Object
- EntityBase
- Zomato2::Cuisine
- Defined in:
- lib/zomato2/cuisine.rb
Instance Attribute Summary collapse
-
#city_id ⇒ Object
readonly
Returns the value of attribute city_id.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(zom_conn, cityid, attributes) ⇒ Cuisine
constructor
A new instance of Cuisine.
- #restaurants(start: nil, count: nil) ⇒ Object
Methods inherited from EntityBase
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_id ⇒ Object (readonly)
Returns the value of attribute city_id.
4 5 6 |
# File 'lib/zomato2/cuisine.rb', line 4 def city_id @city_id end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/zomato2/cuisine.rb', line 4 def id @id end |
#name ⇒ Object (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 |