Class: Zomato::Base
- Inherits:
-
Object
- Object
- Zomato::Base
- Defined in:
- lib/zomato/base.rb
Instance Method Summary collapse
- #cities ⇒ Object
-
#initialize(key) ⇒ Base
constructor
A new instance of Base.
- #locality(lat, lon) ⇒ Object
Constructor Details
#initialize(key) ⇒ Base
Returns a new instance of Base.
5 6 7 8 |
# File 'lib/zomato/base.rb', line 5 def initialize(key) @key = key Api.headers 'X-Zomato-API-Key' => key end |
Instance Method Details
#cities ⇒ Object
10 11 12 |
# File 'lib/zomato/base.rb', line 10 def cities @cities ||= City.build(Api.get('/cities').parsed_response) end |
#locality(lat, lon) ⇒ Object
14 15 16 17 |
# File 'lib/zomato/base.rb', line 14 def locality(lat, lon) response = Api.get('/geocodes', :query => {:lat => lat, :lon => lon}).parsed_response Locality.new(response['locality']) end |