Class: Zomato::Subzone
- Inherits:
-
Object
- Object
- Zomato::Subzone
- Defined in:
- lib/zomato/subzone.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.
-
#zone_id ⇒ Object
readonly
Returns the value of attribute zone_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes, city_id) ⇒ Subzone
constructor
A new instance of Subzone.
- #restaurants ⇒ Object
Constructor Details
#initialize(attributes, city_id) ⇒ Subzone
Returns a new instance of Subzone.
17 18 19 20 21 22 |
# File 'lib/zomato/subzone.rb', line 17 def initialize(attributes, city_id) @id = attributes['subzone_id'] @name = attributes['name'] @zone_id = attributes['zone_id'].to_i @city_id = city_id.to_i end |
Instance Attribute Details
#city_id ⇒ Object (readonly)
Returns the value of attribute city_id.
4 5 6 |
# File 'lib/zomato/subzone.rb', line 4 def city_id @city_id end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/zomato/subzone.rb', line 4 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/zomato/subzone.rb', line 4 def name @name end |
#zone_id ⇒ Object (readonly)
Returns the value of attribute zone_id.
4 5 6 |
# File 'lib/zomato/subzone.rb', line 4 def zone_id @zone_id end |
Class Method Details
Instance Method Details
#restaurants ⇒ Object
24 25 26 27 28 |
# File 'lib/zomato/subzone.rb', line 24 def restaurants query = {:city_id => city_id, :subzone_id => id} response = Api.get('/search', :query => query).parsed_response Restaurant.build(response, query) end |