Class: Zomato::City
- Inherits:
-
Object
- Object
- Zomato::City
- Defined in:
- lib/zomato/city.rb
Instance Attribute Summary collapse
-
#has_nightlife ⇒ Object
readonly
Returns the value of attribute has_nightlife.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#latitude ⇒ Object
readonly
Returns the value of attribute latitude.
-
#longitude ⇒ Object
readonly
Returns the value of attribute longitude.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#show_zones ⇒ Object
readonly
Returns the value of attribute show_zones.
Class Method Summary collapse
Instance Method Summary collapse
- #cuisines ⇒ Object
-
#initialize(attributes) ⇒ City
constructor
A new instance of City.
- #localities ⇒ Object
- #zones ⇒ Object
Constructor Details
#initialize(attributes) ⇒ City
Returns a new instance of City.
17 18 19 20 21 22 23 24 |
# File 'lib/zomato/city.rb', line 17 def initialize(attributes) @id = attributes['id'] @name = attributes['name'] @longitude = attributes['longitude'] @latitude = attributes['latitude'] @has_nightlife = attributes['has_nightlife'] == 1 @show_zones = attributes['show_zones'] == 1 end |
Instance Attribute Details
#has_nightlife ⇒ Object (readonly)
Returns the value of attribute has_nightlife.
4 5 6 |
# File 'lib/zomato/city.rb', line 4 def has_nightlife @has_nightlife end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/zomato/city.rb', line 4 def id @id end |
#latitude ⇒ Object (readonly)
Returns the value of attribute latitude.
4 5 6 |
# File 'lib/zomato/city.rb', line 4 def latitude @latitude end |
#longitude ⇒ Object (readonly)
Returns the value of attribute longitude.
4 5 6 |
# File 'lib/zomato/city.rb', line 4 def longitude @longitude end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/zomato/city.rb', line 4 def name @name end |
#show_zones ⇒ Object (readonly)
Returns the value of attribute show_zones.
4 5 6 |
# File 'lib/zomato/city.rb', line 4 def show_zones @show_zones end |
Class Method Details
.build(response) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/zomato/city.rb', line 8 def build(response) @cities ||= response['cities'].collect do |city| City.new(city['city']) end end |
Instance Method Details
#cuisines ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/zomato/city.rb', line 42 def cuisines response = Api.get( '/cuisines', :query => {:city_id => id} ).parsed_response Cuisine.build(response, id) end |
#localities ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/zomato/city.rb', line 34 def localities response = Api.get( '/subzones', :query => {:city_id => id} ).parsed_response Subzone.build(response, id) end |
#zones ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/zomato/city.rb', line 26 def zones response = Api.get( '/zones', :query => {:city_id => id} ).parsed_response Zone.build(response) end |