Class: Google::Places::Client
- Inherits:
-
Object
- Object
- Google::Places::Client
- Includes:
- HTTParty
- Defined in:
- lib/google/places/client.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
Instance Method Summary collapse
-
#initialize(api_key) ⇒ Client
constructor
A new instance of Client.
- #nearby_search(location, radius, options = {}) ⇒ Object
- #place_add(name, location, types, options = {}) ⇒ Object
- #place_autocomplete(input, options = {}) ⇒ Object
- #place_details(place_id, options = {}) ⇒ Object
- #place_photos(photo_reference, options = {}) ⇒ Object
- #query_autocomplete(input, options = {}) ⇒ Object
- #radar_search(location, radius, options = {}) ⇒ Object
- #text_search(query, options = {}) ⇒ Object
Constructor Details
#initialize(api_key) ⇒ Client
Returns a new instance of Client.
13 14 15 |
# File 'lib/google/places/client.rb', line 13 def initialize(api_key) @api_key = api_key end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
11 12 13 |
# File 'lib/google/places/client.rb', line 11 def api_key @api_key end |
Instance Method Details
#nearby_search(location, radius, options = {}) ⇒ Object
60 61 62 63 64 65 66 |
# File 'lib/google/places/client.rb', line 60 def nearby_search(location, radius, = {}) = .with_indifferent_access self.class.get( "/nearbysearch/json", { query: build_search_request_parameters(location, radius, ) } ) end |
#place_add(name, location, types, options = {}) ⇒ Object
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/google/places/client.rb', line 41 def place_add(name, location, types, = {}) = .with_indifferent_access self.class.post( "/add/json", { query: { key: api_key }, body: build_add_request_body(name, location, types, ) } ) end |
#place_autocomplete(input, options = {}) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/google/places/client.rb', line 17 def place_autocomplete(input, = {}) = .with_indifferent_access self.class.get( "/autocomplete/json", { query: build_request_parameters(input, ) } ) end |
#place_details(place_id, options = {}) ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/google/places/client.rb', line 52 def place_details(place_id, = {}) = .with_indifferent_access self.class.get( "/details/json", { query: build_details_request_parameters(place_id, ) } ) end |
#place_photos(photo_reference, options = {}) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/google/places/client.rb', line 33 def place_photos(photo_reference, = {}) = .with_indifferent_access self.class.get( "/photo", { query: build_photo_request_parameters(photo_reference, ) } ) end |
#query_autocomplete(input, options = {}) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/google/places/client.rb', line 25 def query_autocomplete(input, = {}) = .with_indifferent_access self.class.get( "/queryautocomplete/json", { query: build_request_parameters(input, ) } ) end |
#radar_search(location, radius, options = {}) ⇒ Object
76 77 78 79 80 81 82 |
# File 'lib/google/places/client.rb', line 76 def radar_search(location, radius, = {}) = .with_indifferent_access self.class.get( "/radarsearch/json", { query: build_search_request_parameters(location, radius, ) } ) end |
#text_search(query, options = {}) ⇒ Object
68 69 70 71 72 73 74 |
# File 'lib/google/places/client.rb', line 68 def text_search(query, = {}) = .with_indifferent_access self.class.get( "/textsearch/json", { query: build_text_search_request_parameters(query, ) } ) end |