Class: Zomato2::Establishment
- Inherits:
-
EntityBase
- Object
- EntityBase
- Zomato2::Establishment
- Defined in:
- lib/zomato2/establishment.rb
Overview
Restaurant types
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) ⇒ Establishment
constructor
A new instance of Establishment.
- #restaurants(start: nil, count: nil) ⇒ Object
Methods inherited from EntityBase
Constructor Details
#initialize(zom_conn, cityid, attributes) ⇒ Establishment
Returns a new instance of Establishment.
7 8 9 10 11 12 |
# 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 |
Instance Attribute Details
#city_id ⇒ Object (readonly)
Returns the value of attribute city_id.
5 6 7 |
# File 'lib/zomato2/establishment.rb', line 5 def city_id @city_id end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/zomato2/establishment.rb', line 5 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/zomato2/establishment.rb', line 5 def name @name end |
Instance Method Details
#restaurants(start: nil, count: nil) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# 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 |