Class: Zomato2::City
- Inherits:
-
EntityBase
- Object
- EntityBase
- Zomato2::City
- Defined in:
- lib/zomato2/city.rb
Instance Attribute Summary collapse
-
#country_id ⇒ Object
readonly
Returns the value of attribute country_id.
-
#country_name ⇒ Object
readonly
Returns the value of attribute country_name.
-
#discovery_enabled ⇒ Object
readonly
Returns the value of attribute discovery_enabled.
-
#has_new_ad_format ⇒ Object
readonly
Returns the value of attribute has_new_ad_format.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#is_state ⇒ Object
readonly
Returns the value of attribute is_state.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#state_code ⇒ Object
readonly
Returns the value of attribute state_code.
-
#state_id ⇒ Object
readonly
Returns the value of attribute state_id.
-
#state_name ⇒ Object
readonly
Returns the value of attribute state_name.
Instance Method Summary collapse
- #collections(start: nil, count: nil) ⇒ Object
-
#cuisines(start: nil, count: nil) ⇒ Object
alias :super_get :get.
- #establishments(start: nil, count: nil) ⇒ Object
-
#initialize(zom_conn, attributes) ⇒ City
constructor
A new instance of City.
- #restaurants(start: nil, count: nil) ⇒ Object
- #to_s ⇒ Object
Methods inherited from EntityBase
Constructor Details
#initialize(zom_conn, attributes) ⇒ City
Returns a new instance of City.
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/zomato2/city.rb', line 7 def initialize(zom_conn, attributes) super(zom_conn) @id = attributes['id'] @name = attributes['name'] @country_id = attributes['country_id'] @country_name = attributes['country_name'] @is_state = attributes['is_state'] != 0 @state_id = attributes['state_id'] @state_name = attributes['state_name'] @state_code = attributes['state_code'] @discovery_enabled = attributes['discovery_enabled'] @has_new_ad_format = attributes['has_new_ad_format'] end |
Instance Attribute Details
#country_id ⇒ Object (readonly)
Returns the value of attribute country_id.
4 5 6 |
# File 'lib/zomato2/city.rb', line 4 def country_id @country_id end |
#country_name ⇒ Object (readonly)
Returns the value of attribute country_name.
4 5 6 |
# File 'lib/zomato2/city.rb', line 4 def country_name @country_name end |
#discovery_enabled ⇒ Object (readonly)
Returns the value of attribute discovery_enabled.
4 5 6 |
# File 'lib/zomato2/city.rb', line 4 def discovery_enabled @discovery_enabled end |
#has_new_ad_format ⇒ Object (readonly)
Returns the value of attribute has_new_ad_format.
4 5 6 |
# File 'lib/zomato2/city.rb', line 4 def has_new_ad_format @has_new_ad_format end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/zomato2/city.rb', line 4 def id @id end |
#is_state ⇒ Object (readonly)
Returns the value of attribute is_state.
4 5 6 |
# File 'lib/zomato2/city.rb', line 4 def is_state @is_state end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/zomato2/city.rb', line 4 def name @name end |
#state_code ⇒ Object (readonly)
Returns the value of attribute state_code.
4 5 6 |
# File 'lib/zomato2/city.rb', line 4 def state_code @state_code end |
#state_id ⇒ Object (readonly)
Returns the value of attribute state_id.
4 5 6 |
# File 'lib/zomato2/city.rb', line 4 def state_id @state_id end |
#state_name ⇒ Object (readonly)
Returns the value of attribute state_name.
4 5 6 |
# File 'lib/zomato2/city.rb', line 4 def state_name @state_name end |
Instance Method Details
#collections(start: nil, count: nil) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/zomato2/city.rb', line 23 def collections(start: nil, count: nil) q = {city_id: @id } q[:start] = start if start q[:count] = count if count results = get('collections', q) results['collections'].map { |c| Collection.new(@zom_conn, @id, c['collection']) } end |
#cuisines(start: nil, count: nil) ⇒ Object
alias :super_get :get
40 41 42 43 44 45 46 |
# File 'lib/zomato2/city.rb', line 40 def cuisines(start: nil, count: nil) q = {city_id: @id } q[:start] = start if start q[:count] = count if count results = get('cuisines', q) results['cuisines'].map { |c| Cuisine.new(@zom_conn, @id, c['cuisine']) } end |
#establishments(start: nil, count: nil) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/zomato2/city.rb', line 31 def establishments(start: nil, count: nil) q = {city_id: @id } q[:start] = start if start q[:count] = count if count results = get('establishments', q) results['establishments'].map { |e| Establishment.new(@zom_conn, @id, e['establishment']) } end |
#restaurants(start: nil, count: nil) ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/zomato2/city.rb', line 48 def restaurants(start: nil, count: nil) q = {entity_type: 'city', entity_id: @id } # 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 |
#to_s ⇒ Object
21 |
# File 'lib/zomato2/city.rb', line 21 def to_s; super; end |