Class: Zomato2::Category
- Inherits:
-
EntityBase
- Object
- EntityBase
- Zomato2::Category
- Defined in:
- lib/zomato2/category.rb
Instance Attribute Summary collapse
-
#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, attributes) ⇒ Category
constructor
A new instance of Category.
- #restaurants(start: nil, count: nil) ⇒ Object
- #to_s ⇒ Object
Methods inherited from EntityBase
Constructor Details
#initialize(zom_conn, attributes) ⇒ Category
Returns a new instance of Category.
6 7 8 9 10 |
# File 'lib/zomato2/category.rb', line 6 def initialize(zom_conn, attributes) super(zom_conn) @id = attributes['id'] @name = attributes['name'] end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/zomato2/category.rb', line 4 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/zomato2/category.rb', line 4 def name @name end |
Instance Method Details
#restaurants(start: nil, count: nil) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/zomato2/category.rb', line 14 def restaurants(start: nil, count: nil) q = {category_id: @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 |
#to_s ⇒ Object
12 |
# File 'lib/zomato2/category.rb', line 12 def to_s; super; end |