Class: GooglePlaces::Client
- Inherits:
-
Object
- Object
- GooglePlaces::Client
- Defined in:
- lib/google_places/client.rb
Overview
This class acts as a proxy to the working classes when requesting data from the API.
Instance Attribute Summary collapse
-
#api_key ⇒ String
readonly
The provided api key.
-
#options ⇒ Hash
readonly
The provided options hash.
-
#sensor ⇒ Object
readonly
Returns the value of attribute sensor.
Instance Method Summary collapse
-
#initialize(api_key, sensor = false, options = {}) ⇒ Client
constructor
Creates a new Client instance which proxies the requests to the certain classes.
-
#spot(reference, options = {}) ⇒ Spot
Search for a Spot with a reference key.
-
#spots(lat, lng, options = {}) ⇒ Array<Spot>
Search for Spots at the provided location.
-
#spots_by_pagetoken(pagetoken, options = {}) ⇒ Array<Spot>
Search for Spots with a pagetoken.
-
#spots_by_query(query, options = {}) ⇒ Array<Spot>
Search for Spots with a query.
Constructor Details
#initialize(api_key, sensor = false, options = {}) ⇒ Client
Creates a new Client instance which proxies the requests to the certain classes
46 47 48 49 50 |
# File 'lib/google_places/client.rb', line 46 def initialize(api_key, sensor = false, = {}) @api_key = api_key @sensor = sensor @options = end |
Instance Attribute Details
#api_key ⇒ String (readonly)
Returns the provided api key.
5 6 7 |
# File 'lib/google_places/client.rb', line 5 def api_key @api_key end |
#options ⇒ Hash (readonly)
Returns the provided options hash.
7 8 9 |
# File 'lib/google_places/client.rb', line 7 def @options end |
#sensor ⇒ Object (readonly)
Returns the value of attribute sensor.
8 9 10 |
# File 'lib/google_places/client.rb', line 8 def sensor @sensor end |
Instance Method Details
#spot(reference, options = {}) ⇒ Spot
Search for a Spot with a reference key
118 119 120 |
# File 'lib/google_places/client.rb', line 118 def spot(reference, = {}) Spot.find(reference, @api_key, @sensor, @options.merge()) end |
#spots(lat, lng, options = {}) ⇒ Array<Spot>
Search for Spots at the provided location
98 99 100 |
# File 'lib/google_places/client.rb', line 98 def spots(lat, lng, = {}) Spot.list(lat, lng, @api_key, @sensor, @options.merge()) end |
#spots_by_pagetoken(pagetoken, options = {}) ⇒ Array<Spot>
Search for Spots with a pagetoken
179 180 181 |
# File 'lib/google_places/client.rb', line 179 def spots_by_pagetoken(pagetoken, = {}) Spot.list_by_pagetoken(pagetoken, @api_key, @sensor, @options.merge()) end |
#spots_by_query(query, options = {}) ⇒ Array<Spot>
Search for Spots with a query
161 162 163 |
# File 'lib/google_places/client.rb', line 161 def spots_by_query(query, = {}) Spot.list_by_query(query, @api_key, @sensor, @options.merge()) end |