Class: Zomato2::Collection
- Inherits:
-
EntityBase
- Object
- EntityBase
- Zomato2::Collection
- Defined in:
- lib/zomato2/collection.rb
Instance Attribute Summary collapse
-
#city_id ⇒ Object
readonly
Returns the value of attribute city_id.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#image_url ⇒ Object
readonly
Returns the value of attribute image_url.
-
#res_count ⇒ Object
readonly
Returns the value of attribute res_count.
-
#share_url ⇒ Object
readonly
Returns the value of attribute share_url.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(zom_conn, cityid, attributes) ⇒ Collection
constructor
A new instance of Collection.
- #restaurants(start: nil, count: nil) ⇒ Object
Methods inherited from EntityBase
Constructor Details
#initialize(zom_conn, cityid, attributes) ⇒ Collection
Returns a new instance of Collection.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/zomato2/collection.rb', line 6 def initialize(zom_conn, cityid, attributes) super(zom_conn) @city_id = cityid @id = attributes['collection_id'] @url = attributes['url'] @title = attributes['title'] @description = attributes['description'] @image_url = attributes['image_url'] @res_count = attributes['res_count'] @share_url = attributes['share_url'] end |
Instance Attribute Details
#city_id ⇒ Object (readonly)
Returns the value of attribute city_id.
4 5 6 |
# File 'lib/zomato2/collection.rb', line 4 def city_id @city_id end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
4 5 6 |
# File 'lib/zomato2/collection.rb', line 4 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/zomato2/collection.rb', line 4 def id @id end |
#image_url ⇒ Object (readonly)
Returns the value of attribute image_url.
4 5 6 |
# File 'lib/zomato2/collection.rb', line 4 def image_url @image_url end |
#res_count ⇒ Object (readonly)
Returns the value of attribute res_count.
4 5 6 |
# File 'lib/zomato2/collection.rb', line 4 def res_count @res_count end |
#share_url ⇒ Object (readonly)
Returns the value of attribute share_url.
4 5 6 |
# File 'lib/zomato2/collection.rb', line 4 def share_url @share_url end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
4 5 6 |
# File 'lib/zomato2/collection.rb', line 4 def title @title end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
4 5 6 |
# File 'lib/zomato2/collection.rb', line 4 def url @url end |
Instance Method Details
#restaurants(start: nil, count: nil) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/zomato2/collection.rb', line 18 def restaurants(start: nil, count: nil) q = {collection_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 { |e| Restaurant.new(@zom_conn, e['restaurant']) } end |