google-maps-api-sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +169 -0
  4. data/bin/console +15 -0
  5. data/lib/google_maps_platform/api_helper.rb +10 -0
  6. data/lib/google_maps_platform/client.rb +123 -0
  7. data/lib/google_maps_platform/configuration.rb +181 -0
  8. data/lib/google_maps_platform/controllers/base_controller.rb +67 -0
  9. data/lib/google_maps_platform/controllers/directions_api_controller.rb +341 -0
  10. data/lib/google_maps_platform/controllers/distance_matrix_api_controller.rb +224 -0
  11. data/lib/google_maps_platform/controllers/elevation_api_controller.rb +71 -0
  12. data/lib/google_maps_platform/controllers/geocoding_api_controller.rb +214 -0
  13. data/lib/google_maps_platform/controllers/geolocation_api_controller.rb +46 -0
  14. data/lib/google_maps_platform/controllers/places_api_controller.rb +866 -0
  15. data/lib/google_maps_platform/controllers/roads_api_controller.rb +81 -0
  16. data/lib/google_maps_platform/controllers/street_view_api_controller.rb +198 -0
  17. data/lib/google_maps_platform/controllers/time_zone_api_controller.rb +65 -0
  18. data/lib/google_maps_platform/exceptions/api_exception.rb +21 -0
  19. data/lib/google_maps_platform/exceptions/error_response_exception.rb +48 -0
  20. data/lib/google_maps_platform/exceptions/nearest_roads_error_response_exception.rb +46 -0
  21. data/lib/google_maps_platform/http/api_response.rb +19 -0
  22. data/lib/google_maps_platform/http/auth/custom_query_authentication.rb +52 -0
  23. data/lib/google_maps_platform/http/http_call_back.rb +10 -0
  24. data/lib/google_maps_platform/http/http_method_enum.rb +10 -0
  25. data/lib/google_maps_platform/http/http_request.rb +10 -0
  26. data/lib/google_maps_platform/http/http_response.rb +10 -0
  27. data/lib/google_maps_platform/http/proxy_settings.rb +22 -0
  28. data/lib/google_maps_platform/logging/configuration/api_logging_configuration.rb +186 -0
  29. data/lib/google_maps_platform/logging/sdk_logger.rb +17 -0
  30. data/lib/google_maps_platform/models/address_component.rb +97 -0
  31. data/lib/google_maps_platform/models/base_model.rb +110 -0
  32. data/lib/google_maps_platform/models/bounds.rb +85 -0
  33. data/lib/google_maps_platform/models/business_status.rb +41 -0
  34. data/lib/google_maps_platform/models/cell_tower.rb +146 -0
  35. data/lib/google_maps_platform/models/directions_geocoded_waypoint.rb +181 -0
  36. data/lib/google_maps_platform/models/directions_leg.rb +224 -0
  37. data/lib/google_maps_platform/models/directions_polyline.rb +93 -0
  38. data/lib/google_maps_platform/models/directions_response.rb +185 -0
  39. data/lib/google_maps_platform/models/directions_route.rb +188 -0
  40. data/lib/google_maps_platform/models/directions_status.rb +94 -0
  41. data/lib/google_maps_platform/models/directions_step.rb +216 -0
  42. data/lib/google_maps_platform/models/directions_traffic_speed_entry.rb +84 -0
  43. data/lib/google_maps_platform/models/directions_transit_agency.rb +95 -0
  44. data/lib/google_maps_platform/models/directions_transit_details.rb +176 -0
  45. data/lib/google_maps_platform/models/directions_transit_line.rb +152 -0
  46. data/lib/google_maps_platform/models/directions_transit_stop.rb +83 -0
  47. data/lib/google_maps_platform/models/directions_transit_vehicle.rb +126 -0
  48. data/lib/google_maps_platform/models/directions_via_waypoint.rb +99 -0
  49. data/lib/google_maps_platform/models/distance_matrix_element.rb +132 -0
  50. data/lib/google_maps_platform/models/distance_matrix_element_status.rb +48 -0
  51. data/lib/google_maps_platform/models/distance_matrix_response.rb +149 -0
  52. data/lib/google_maps_platform/models/distance_matrix_row.rb +89 -0
  53. data/lib/google_maps_platform/models/distance_matrix_status.rb +74 -0
  54. data/lib/google_maps_platform/models/elevation_response.rb +132 -0
  55. data/lib/google_maps_platform/models/elevation_result.rb +99 -0
  56. data/lib/google_maps_platform/models/elevation_status.rb +65 -0
  57. data/lib/google_maps_platform/models/error_detail.rb +135 -0
  58. data/lib/google_maps_platform/models/error_object.rb +130 -0
  59. data/lib/google_maps_platform/models/fare.rb +92 -0
  60. data/lib/google_maps_platform/models/field_violation.rb +82 -0
  61. data/lib/google_maps_platform/models/geocoder_status.rb +37 -0
  62. data/lib/google_maps_platform/models/geocoding_geometry.rb +117 -0
  63. data/lib/google_maps_platform/models/geocoding_response.rb +140 -0
  64. data/lib/google_maps_platform/models/geocoding_result.rb +174 -0
  65. data/lib/google_maps_platform/models/geocoding_status.rb +71 -0
  66. data/lib/google_maps_platform/models/geolocation_request.rb +166 -0
  67. data/lib/google_maps_platform/models/geolocation_response.rb +91 -0
  68. data/lib/google_maps_platform/models/geometry.rb +84 -0
  69. data/lib/google_maps_platform/models/inputtype.rb +36 -0
  70. data/lib/google_maps_platform/models/language.rb +240 -0
  71. data/lib/google_maps_platform/models/lat_lng_literal.rb +83 -0
  72. data/lib/google_maps_platform/models/latitude_longitude_literal.rb +83 -0
  73. data/lib/google_maps_platform/models/location_type.rb +54 -0
  74. data/lib/google_maps_platform/models/location_type1.rb +44 -0
  75. data/lib/google_maps_platform/models/maneuver.rb +110 -0
  76. data/lib/google_maps_platform/models/maps_api_elevation_json_response.rb +132 -0
  77. data/lib/google_maps_platform/models/maxprice.rb +48 -0
  78. data/lib/google_maps_platform/models/minprice.rb +48 -0
  79. data/lib/google_maps_platform/models/mode.rb +44 -0
  80. data/lib/google_maps_platform/models/nearest_roads_error.rb +90 -0
  81. data/lib/google_maps_platform/models/nearest_roads_response.rb +86 -0
  82. data/lib/google_maps_platform/models/place.rb +647 -0
  83. data/lib/google_maps_platform/models/place_autocomplete_matched_substring.rb +82 -0
  84. data/lib/google_maps_platform/models/place_autocomplete_prediction.rb +181 -0
  85. data/lib/google_maps_platform/models/place_autocomplete_structured_format.rb +136 -0
  86. data/lib/google_maps_platform/models/place_autocomplete_term.rb +83 -0
  87. data/lib/google_maps_platform/models/place_editorial_summary.rb +87 -0
  88. data/lib/google_maps_platform/models/place_opening_hours.rb +138 -0
  89. data/lib/google_maps_platform/models/place_opening_hours_period.rb +84 -0
  90. data/lib/google_maps_platform/models/place_opening_hours_period_detail.rb +108 -0
  91. data/lib/google_maps_platform/models/place_photo.rb +109 -0
  92. data/lib/google_maps_platform/models/place_review.rb +186 -0
  93. data/lib/google_maps_platform/models/place_special_day.rb +93 -0
  94. data/lib/google_maps_platform/models/places_autocomplete_response.rb +141 -0
  95. data/lib/google_maps_platform/models/places_autocomplete_status.rb +66 -0
  96. data/lib/google_maps_platform/models/places_details_response.rb +131 -0
  97. data/lib/google_maps_platform/models/places_details_status.rb +71 -0
  98. data/lib/google_maps_platform/models/places_find_place_from_text_response.rb +145 -0
  99. data/lib/google_maps_platform/models/places_nearby_search_response.rb +171 -0
  100. data/lib/google_maps_platform/models/places_query_autocomplete_response.rb +141 -0
  101. data/lib/google_maps_platform/models/places_search_status.rb +66 -0
  102. data/lib/google_maps_platform/models/places_text_search_response.rb +171 -0
  103. data/lib/google_maps_platform/models/plus_code.rb +92 -0
  104. data/lib/google_maps_platform/models/rankby.rb +36 -0
  105. data/lib/google_maps_platform/models/region.rb +1052 -0
  106. data/lib/google_maps_platform/models/result.rb +96 -0
  107. data/lib/google_maps_platform/models/result_type.rb +112 -0
  108. data/lib/google_maps_platform/models/snap_to_roads_response.rb +96 -0
  109. data/lib/google_maps_platform/models/snapped_point.rb +103 -0
  110. data/lib/google_maps_platform/models/source.rb +36 -0
  111. data/lib/google_maps_platform/models/street_view_response.rb +135 -0
  112. data/lib/google_maps_platform/models/street_view_status.rb +71 -0
  113. data/lib/google_maps_platform/models/text_value_object.rb +82 -0
  114. data/lib/google_maps_platform/models/time_zone_response.rb +154 -0
  115. data/lib/google_maps_platform/models/time_zone_status.rb +68 -0
  116. data/lib/google_maps_platform/models/time_zone_text_value_object.rb +94 -0
  117. data/lib/google_maps_platform/models/traffic_model.rb +40 -0
  118. data/lib/google_maps_platform/models/transit_routing_preference.rb +36 -0
  119. data/lib/google_maps_platform/models/travel_mode.rb +48 -0
  120. data/lib/google_maps_platform/models/type.rb +140 -0
  121. data/lib/google_maps_platform/models/type1.rb +112 -0
  122. data/lib/google_maps_platform/models/units.rb +36 -0
  123. data/lib/google_maps_platform/models/wi_fi_access_point.rb +119 -0
  124. data/lib/google_maps_platform/utilities/date_time_helper.rb +11 -0
  125. data/lib/google_maps_platform/utilities/file_wrapper.rb +28 -0
  126. data/lib/google_maps_platform.rb +154 -0
  127. metadata +210 -0
@@ -0,0 +1,866 @@
1
+ # google_maps_platform
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module GoogleMapsPlatform
7
+ # PlacesApiController
8
+ class PlacesApiController < BaseController
9
+ # The Places API is a service that returns information about places using
10
+ # HTTP requests. Places are defined within this API as establishments,
11
+ # geographic locations, or prominent points of interest.
12
+ # @param [String] place_id Required parameter: A textual identifier that
13
+ # uniquely identifies a place, returned from a [Place
14
+ # Search](https://developers.google.com/maps/documentation/places/web-servic
15
+ # e/search). For more information about place IDs, see the [place ID
16
+ # overview](https://developers.google.com/maps/documentation/places/web-serv
17
+ # ice/place-id).
18
+ # @param [Array[String]] fields Optional parameter: <div class="caution">
19
+ # Caution: Place Search requests and Place Details requests do not return
20
+ # the same fields. Place Search requests return a subset of the fields that
21
+ # are returned by Place Details requests. If the field you want is not
22
+ # returned by Place Search, you can use Place Search to get a
23
+ # <code>place_id</code>, then use that Place ID to make a Place Details
24
+ # request. For more information on the fields that are unavailable in a
25
+ # Place Search request, see <a
26
+ # href="https://developers.google.com/maps/documentation/places/web-service/
27
+ # place-data-fields#places-api-fields-support">Places API fields
28
+ # support</a>.</div> Use the fields parameter to specify a comma-separated
29
+ # list of place data types to return. For example:
30
+ # `fields=formatted_address,name,geometry`. Use a forward slash when
31
+ # specifying compound values. For example: `opening_hours/open_now`. Fields
32
+ # are divided into three billing categories: Basic, Contact, and Atmosphere.
33
+ # Basic fields are billed at base rate, and incur no additional charges.
34
+ # Contact and Atmosphere fields are billed at a higher rate. See the
35
+ # [pricing
36
+ # sheet](https://developers.google.com/maps/documentation/places/web-service
37
+ # /usage-and-billing/) for more information. Attributions,
38
+ # `html_attributions`, are always returned with every call, regardless of
39
+ # whether the field has been requested. **Basic** The Basic category
40
+ # includes the following fields: `address_components`, `adr_address`,
41
+ # `business_status`, `formatted_address`, `geometry`, `icon`,
42
+ # `icon_mask_base_uri`, `icon_background_color`, `name`,
43
+ # `permanently_closed`
44
+ # ([deprecated](https://developers.google.com/maps/deprecations)), `photo`,
45
+ # `place_id`, `plus_code`, `type`, `url`, `utc_offset`, `vicinity`,
46
+ # `wheelchair_accessible_entrance`. **Contact** The Contact category
47
+ # includes the following fields: `current_opening_hours`,
48
+ # `formatted_phone_number`, `international_phone_number`, `opening_hours`,
49
+ # `secondary_opening_hours`, `website` **Atmosphere** The Atmosphere
50
+ # category includes the following fields: `curbside_pickup`, `delivery`,
51
+ # `dine_in`, `editorial_summary`, `price_level`, `rating`, `reservable`,
52
+ # `reviews`, `serves_beer`, `serves_breakfast`, `serves_brunch`,
53
+ # `serves_dinner`, `serves_lunch`, `serves_vegetarian_food`, `serves_wine`,
54
+ # `takeout`, `user_ratings_total`.
55
+ # @param [String] sessiontoken Optional parameter: A random string which
56
+ # identifies an autocomplete
57
+ # [session](https://developers.google.com/maps/documentation/places/web-serv
58
+ # ice/details#session_tokens) for billing purposes. The session begins when
59
+ # the user starts typing a query, and concludes when they select a place and
60
+ # a call to Place Details is made. Each session can have multiple queries,
61
+ # followed by one place selection. The API key(s) used for each request
62
+ # within a session must belong to the same Google Cloud Console project.
63
+ # Once a session has concluded, the token is no longer valid; your app must
64
+ # generate a fresh token for each session. If the `sessiontoken` parameter
65
+ # is omitted, or if you reuse a session token, the session is charged as if
66
+ # no session token was provided (each request is billed separately). We
67
+ # recommend the following guidelines: - Use session tokens for all
68
+ # autocomplete sessions. - Generate a fresh token for each session. Using a
69
+ # version 4 UUID is recommended. - Ensure that the API key(s) used for all
70
+ # Place Autocomplete and Place Details requests within a session belong to
71
+ # the same Cloud Console project. - Be sure to pass a unique session token
72
+ # for each new session. Using the same token for more than one session will
73
+ # result in each request being billed individually.
74
+ # @param [Language] language Optional parameter: The language in which to
75
+ # return results. * See the [list of supported
76
+ # languages](https://developers.google.com/maps/faq#languagesupport). Google
77
+ # often updates the supported languages, so this list may not be exhaustive.
78
+ # * If `language` is not supplied, the API attempts to use the preferred
79
+ # language as specified in the `Accept-Language` header. * The API does its
80
+ # best to provide a street address that is readable for both the user and
81
+ # locals. To achieve that goal, it returns street addresses in the local
82
+ # language, transliterated to a script readable by the user if necessary,
83
+ # observing the preferred language. All other addresses are returned in the
84
+ # preferred language. Address components are all returned in the same
85
+ # language, which is chosen from the first component. * If a name is not
86
+ # available in the preferred language, the API uses the closest match. * The
87
+ # preferred language has a small influence on the set of results that the
88
+ # API chooses to return, and the order in which they are returned. The
89
+ # geocoder interprets abbreviations differently depending on language, such
90
+ # as the abbreviations for street types, or synonyms that may be valid in
91
+ # one language but not in another. For example, _utca_ and _tér_ are
92
+ # synonyms for street in Hungarian.
93
+ # @param [Region] region Optional parameter: The region code, specified as a
94
+ # [ccTLD ("top-level
95
+ # domain")](https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains
96
+ # #Country_code_top-level_domains) two-character value. Most ccTLD codes are
97
+ # identical to ISO 3166-1 codes, with some notable exceptions. For example,
98
+ # the United Kingdom's ccTLD is "uk" (.co.uk) while its ISO 3166-1 code is
99
+ # "gb" (technically for the entity of "The United Kingdom of Great Britain
100
+ # and Northern Ireland").
101
+ # @param [String] reviews_sort Optional parameter: The sorting method to use
102
+ # when returning reviews. Can be set to `most_relevant` (default) or
103
+ # `newest`. - For `most_relevant` (default), reviews are sorted by
104
+ # relevance; the service will bias the results to return reviews originally
105
+ # written in the preferred language. - For `newest`, reviews are sorted in
106
+ # chronological order; the preferred language does not affect the sort
107
+ # order. Google recommends that you display how the reviews are being
108
+ # sorted to the end user.
109
+ # @param [TrueClass | FalseClass] reviews_no_translations Optional
110
+ # parameter: Specify `reviews_no_translations=true` to disable translation
111
+ # of reviews; specify `reviews_no_translations=false` to enable translation
112
+ # of reviews. Reviews are returned in their original language. If omitted,
113
+ # or passed with no value, translation of reviews is enabled. If the
114
+ # `language` parameter was specified in the request, use the specified
115
+ # language as the preferred language for translation. If `language` is
116
+ # omitted, the API attempts to use the `Accept-Language` header as the
117
+ # preferred language.
118
+ # @return [ApiResponse] Complete http response with raw body and status code.
119
+ def place_details(place_id,
120
+ fields: nil,
121
+ sessiontoken: nil,
122
+ language: Language::EN,
123
+ region: Region::EN,
124
+ reviews_sort: nil,
125
+ reviews_no_translations: nil)
126
+ @api_call
127
+ .request(new_request_builder(HttpMethodEnum::GET,
128
+ '/maps/api/place/details/json',
129
+ Server::DEFAULT)
130
+ .query_param(new_parameter(place_id, key: 'place_id')
131
+ .is_required(true))
132
+ .query_param(new_parameter(fields, key: 'fields'))
133
+ .query_param(new_parameter(sessiontoken, key: 'sessiontoken'))
134
+ .query_param(new_parameter(language, key: 'language'))
135
+ .query_param(new_parameter(region, key: 'region'))
136
+ .query_param(new_parameter(reviews_sort, key: 'reviews_sort'))
137
+ .query_param(new_parameter(reviews_no_translations, key: 'reviews_no_translations'))
138
+ .header_param(new_parameter('application/json', key: 'accept'))
139
+ .auth(Single.new('ApiKeyAuth')))
140
+ .response(new_response_handler
141
+ .deserializer(APIHelper.method(:custom_type_deserializer))
142
+ .deserialize_into(PlacesDetailsResponse.method(:from_hash))
143
+ .is_api_response(true))
144
+ .execute
145
+ end
146
+
147
+ # A Find Place request takes a text input and returns a place. The input can
148
+ # be any kind of Places text data, such as a name, address, or phone number.
149
+ # The request must be a string. A Find Place request using non-string data
150
+ # such as a lat/lng coordinate or plus code generates an error.
151
+ # <div class="note">Note: If you omit the fields parameter from a Find Place
152
+ # request, only the place_id for the result will be returned.</div>
153
+ # @param [String] input Required parameter: The text string on which to
154
+ # search, for example: "restaurant" or "123 Main Street". This must be a
155
+ # place name, address, or category of establishments. Any other types of
156
+ # input can generate errors and are not guaranteed to return valid results.
157
+ # The Places API will return candidate matches based on this string and
158
+ # order the results based on their perceived relevance.
159
+ # @param [Inputtype] inputtype Required parameter: The type of input. This
160
+ # can be one of either `textquery` or `phonenumber`. Phone numbers must be
161
+ # in international format (prefixed by a plus sign ("+"), followed by the
162
+ # country code, then the phone number itself). See [E.164 ITU
163
+ # recommendation](https://en.wikipedia.org/wiki/E.164) for more
164
+ # information.
165
+ # @param [Array[String]] fields Optional parameter: <div class="caution">
166
+ # Caution: Place Search requests and Place Details requests do not return
167
+ # the same fields. Place Search requests return a subset of the fields that
168
+ # are returned by Place Details requests. If the field you want is not
169
+ # returned by Place Search, you can use Place Search to get a
170
+ # <code>place_id</code>, then use that Place ID to make a Place Details
171
+ # request. For more information on the fields that are unavailable in a
172
+ # Place Search request, see <a
173
+ # href="https://developers.google.com/maps/documentation/places/web-service/
174
+ # place-data-fields#places-api-fields-support">Places API fields
175
+ # support</a>.</div> Use the fields parameter to specify a comma-separated
176
+ # list of place data types to return. For example:
177
+ # `fields=formatted_address,name,geometry`. Use a forward slash when
178
+ # specifying compound values. For example: `opening_hours/open_now`. Fields
179
+ # are divided into three billing categories: Basic, Contact, and Atmosphere.
180
+ # Basic fields are billed at base rate, and incur no additional charges.
181
+ # Contact and Atmosphere fields are billed at a higher rate. See the
182
+ # [pricing
183
+ # sheet](https://developers.google.com/maps/documentation/places/web-service
184
+ # /usage-and-billing/) for more information. Attributions,
185
+ # `html_attributions`, are always returned with every call, regardless of
186
+ # whether the field has been requested. **Basic** The Basic category
187
+ # includes the following fields: `address_components`, `adr_address`,
188
+ # `business_status`, `formatted_address`, `geometry`, `icon`,
189
+ # `icon_mask_base_uri`, `icon_background_color`, `name`,
190
+ # `permanently_closed`
191
+ # ([deprecated](https://developers.google.com/maps/deprecations)), `photo`,
192
+ # `place_id`, `plus_code`, `type`, `url`, `utc_offset`, `vicinity`,
193
+ # `wheelchair_accessible_entrance`. **Contact** The Contact category
194
+ # includes the following fields: `current_opening_hours`,
195
+ # `formatted_phone_number`, `international_phone_number`, `opening_hours`,
196
+ # `secondary_opening_hours`, `website` **Atmosphere** The Atmosphere
197
+ # category includes the following fields: `curbside_pickup`, `delivery`,
198
+ # `dine_in`, `editorial_summary`, `price_level`, `rating`, `reservable`,
199
+ # `reviews`, `serves_beer`, `serves_breakfast`, `serves_brunch`,
200
+ # `serves_dinner`, `serves_lunch`, `serves_vegetarian_food`, `serves_wine`,
201
+ # `takeout`, `user_ratings_total`.
202
+ # @param [String] locationbias Optional parameter: Prefer results in a
203
+ # specified area, by specifying either a radius plus lat/lng, or two lat/lng
204
+ # pairs representing the points of a rectangle. If this parameter is not
205
+ # specified, the API uses IP address biasing by default. - IP bias:
206
+ # Instructs the API to use IP address biasing. Pass the string `ipbias`
207
+ # (this option has no additional parameters). - Circular: A string
208
+ # specifying radius in meters, plus lat/lng in decimal degrees. Use the
209
+ # following format: `circle:radius@lat,lng`. - Rectangular: A string
210
+ # specifying two lat/lng pairs in decimal degrees, representing the
211
+ # south/west and north/east points of a rectangle. Use the following
212
+ # format:`rectangle:south,west|north,east`. Note that east/west values are
213
+ # wrapped to the range -180, 180, and north/south values are clamped to the
214
+ # range -90, 90.
215
+ # @param [Language] language Optional parameter: The language in which to
216
+ # return results. * See the [list of supported
217
+ # languages](https://developers.google.com/maps/faq#languagesupport). Google
218
+ # often updates the supported languages, so this list may not be exhaustive.
219
+ # * If `language` is not supplied, the API attempts to use the preferred
220
+ # language as specified in the `Accept-Language` header. * The API does its
221
+ # best to provide a street address that is readable for both the user and
222
+ # locals. To achieve that goal, it returns street addresses in the local
223
+ # language, transliterated to a script readable by the user if necessary,
224
+ # observing the preferred language. All other addresses are returned in the
225
+ # preferred language. Address components are all returned in the same
226
+ # language, which is chosen from the first component. * If a name is not
227
+ # available in the preferred language, the API uses the closest match. * The
228
+ # preferred language has a small influence on the set of results that the
229
+ # API chooses to return, and the order in which they are returned. The
230
+ # geocoder interprets abbreviations differently depending on language, such
231
+ # as the abbreviations for street types, or synonyms that may be valid in
232
+ # one language but not in another. For example, _utca_ and _tér_ are
233
+ # synonyms for street in Hungarian.
234
+ # @return [ApiResponse] Complete http response with raw body and status code.
235
+ def find_place_from_text(input,
236
+ inputtype,
237
+ fields: nil,
238
+ locationbias: nil,
239
+ language: Language::EN)
240
+ @api_call
241
+ .request(new_request_builder(HttpMethodEnum::GET,
242
+ '/maps/api/place/findplacefromtext/json',
243
+ Server::DEFAULT)
244
+ .query_param(new_parameter(input, key: 'input')
245
+ .is_required(true))
246
+ .query_param(new_parameter(inputtype, key: 'inputtype')
247
+ .is_required(true))
248
+ .query_param(new_parameter(fields, key: 'fields'))
249
+ .query_param(new_parameter(locationbias, key: 'locationbias'))
250
+ .query_param(new_parameter(language, key: 'language'))
251
+ .header_param(new_parameter('application/json', key: 'accept'))
252
+ .auth(Single.new('ApiKeyAuth')))
253
+ .response(new_response_handler
254
+ .deserializer(APIHelper.method(:custom_type_deserializer))
255
+ .deserialize_into(PlacesFindPlaceFromTextResponse.method(:from_hash))
256
+ .is_api_response(true))
257
+ .execute
258
+ end
259
+
260
+ # A Nearby Search lets you search for places within a specified area. You
261
+ # can refine your search request by supplying keywords or specifying the
262
+ # type of place you are searching for.
263
+ # @param [String] location Required parameter: The point around which to
264
+ # retrieve place information. This must be specified as
265
+ # `latitude,longitude`.
266
+ # @param [Float] radius Required parameter: Defines the distance (in meters)
267
+ # within which to return place results. You may bias results to a specified
268
+ # circle by passing a `location` and a `radius` parameter. Doing so
269
+ # instructs the Places service to _prefer_ showing results within that
270
+ # circle; results outside of the defined area may still be displayed. The
271
+ # radius will automatically be clamped to a maximum value depending on the
272
+ # type of search and other parameters. * Autocomplete: 50,000 meters *
273
+ # Nearby Search: * with `keyword` or `name`: 50,000 meters * without
274
+ # `keyword` or `name` * Up to 50,000 meters, adjusted dynamically based
275
+ # on area density, independent of `rankby` parameter. * When using
276
+ # `rankby=distance`, the radius parameter will not be accepted, and will
277
+ # result in an `INVALID_REQUEST`. * Query Autocomplete: 50,000 meters * Text
278
+ # Search: 50,000 meters
279
+ # @param [String] keyword Optional parameter: The text string on which to
280
+ # search, for example: "restaurant" or "123 Main Street". This must be a
281
+ # place name, address, or category of establishments. Any other types of
282
+ # input can generate errors and are not guaranteed to return valid results.
283
+ # The Google Places service will return candidate matches based on this
284
+ # string and order the results based on their perceived relevance.
285
+ # Explicitly including location information using this parameter may
286
+ # conflict with the location, radius, and rankby parameters, causing
287
+ # unexpected results. If this parameter is omitted, places with a
288
+ # business_status of CLOSED_TEMPORARILY or CLOSED_PERMANENTLY will not be
289
+ # returned.
290
+ # @param [Maxprice] maxprice Optional parameter: Restricts results to only
291
+ # those places within the specified range. Valid values range between 0
292
+ # (most affordable) to 4 (most expensive), inclusive. The exact amount
293
+ # indicated by a specific value will vary from region to region.
294
+ # @param [Minprice] minprice Optional parameter: Restricts results to only
295
+ # those places within the specified range. Valid values range between 0
296
+ # (most affordable) to 4 (most expensive), inclusive. The exact amount
297
+ # indicated by a specific value will vary from region to region.
298
+ # @param [String] name Optional parameter: Equivalent to `keyword`. Values
299
+ # in this field are combined with values in the `keyword` field and passed
300
+ # as part of the same search string.
301
+ # @param [TrueClass | FalseClass] opennow Optional parameter: Returns only
302
+ # those places that are open for business at the time the query is sent.
303
+ # Places that do not specify opening hours in the Google Places database
304
+ # will not be returned if you include this parameter in your query.
305
+ # @param [String] pagetoken Optional parameter: Returns up to 20 results
306
+ # from a previously run search. Setting a `pagetoken` parameter will execute
307
+ # a search with the same parameters used previously — all parameters other
308
+ # than pagetoken will be ignored.
309
+ # @param [Rankby] rankby Optional parameter: Specifies the order in which
310
+ # results are listed. Possible values are: - `prominence` (default). This
311
+ # option sorts results based on their importance. Ranking will favor
312
+ # prominent places within the set radius over nearby places that match but
313
+ # that are less prominent. Prominence can be affected by a place's ranking
314
+ # in Google's index, global popularity, and other factors. When prominence
315
+ # is specified, the `radius` parameter is required. - `distance`. This
316
+ # option biases search results in ascending order by their distance from the
317
+ # specified location. When `distance` is specified, one or more of
318
+ # `keyword`, `name`, or `type` is required and `radius` is disallowed.
319
+ # @param [String] type Optional parameter: Restricts the results to places
320
+ # matching the specified type. Only one type may be specified. If more than
321
+ # one type is provided, all types following the first entry are ignored. *
322
+ # `type=hospital|pharmacy|doctor` becomes `type=hospital` *
323
+ # `type=hospital,pharmacy,doctor` is ignored entirely See the list of
324
+ # [supported
325
+ # types](https://developers.google.com/maps/documentation/places/web-service
326
+ # /supported_types). <div class="note">Note: Adding both `keyword` and
327
+ # `type` with the same value (`keyword=cafe&type=cafe` or
328
+ # `keyword=parking&type=parking`) can yield `ZERO_RESULTS`.</div>
329
+ # @param [Language] language Optional parameter: The language in which to
330
+ # return results. * See the [list of supported
331
+ # languages](https://developers.google.com/maps/faq#languagesupport). Google
332
+ # often updates the supported languages, so this list may not be exhaustive.
333
+ # * If `language` is not supplied, the API attempts to use the preferred
334
+ # language as specified in the `Accept-Language` header. * The API does its
335
+ # best to provide a street address that is readable for both the user and
336
+ # locals. To achieve that goal, it returns street addresses in the local
337
+ # language, transliterated to a script readable by the user if necessary,
338
+ # observing the preferred language. All other addresses are returned in the
339
+ # preferred language. Address components are all returned in the same
340
+ # language, which is chosen from the first component. * If a name is not
341
+ # available in the preferred language, the API uses the closest match. * The
342
+ # preferred language has a small influence on the set of results that the
343
+ # API chooses to return, and the order in which they are returned. The
344
+ # geocoder interprets abbreviations differently depending on language, such
345
+ # as the abbreviations for street types, or synonyms that may be valid in
346
+ # one language but not in another. For example, _utca_ and _tér_ are
347
+ # synonyms for street in Hungarian.
348
+ # @return [ApiResponse] Complete http response with raw body and status code.
349
+ def nearby_search(location,
350
+ radius,
351
+ keyword: nil,
352
+ maxprice: nil,
353
+ minprice: nil,
354
+ name: nil,
355
+ opennow: nil,
356
+ pagetoken: nil,
357
+ rankby: nil,
358
+ type: nil,
359
+ language: Language::EN)
360
+ @api_call
361
+ .request(new_request_builder(HttpMethodEnum::GET,
362
+ '/maps/api/place/nearbysearch/json',
363
+ Server::DEFAULT)
364
+ .query_param(new_parameter(location, key: 'location')
365
+ .is_required(true))
366
+ .query_param(new_parameter(radius, key: 'radius')
367
+ .is_required(true))
368
+ .query_param(new_parameter(keyword, key: 'keyword'))
369
+ .query_param(new_parameter(maxprice, key: 'maxprice'))
370
+ .query_param(new_parameter(minprice, key: 'minprice'))
371
+ .query_param(new_parameter(name, key: 'name'))
372
+ .query_param(new_parameter(opennow, key: 'opennow'))
373
+ .query_param(new_parameter(pagetoken, key: 'pagetoken'))
374
+ .query_param(new_parameter(rankby, key: 'rankby'))
375
+ .query_param(new_parameter(type, key: 'type'))
376
+ .query_param(new_parameter(language, key: 'language'))
377
+ .header_param(new_parameter('application/json', key: 'accept'))
378
+ .auth(Single.new('ApiKeyAuth')))
379
+ .response(new_response_handler
380
+ .deserializer(APIHelper.method(:custom_type_deserializer))
381
+ .deserialize_into(PlacesNearbySearchResponse.method(:from_hash))
382
+ .is_api_response(true))
383
+ .execute
384
+ end
385
+
386
+ # The Google Places API Text Search Service is a web service that returns
387
+ # information about a set of places based on a string — for example "pizza
388
+ # in New York" or "shoe stores near Ottawa" or "123 Main Street". The
389
+ # service responds with a list of places matching the text string and any
390
+ # location bias that has been set.
391
+ # The service is especially useful for making [ambiguous
392
+ # address](https://developers.google.com/maps/documentation/geocoding/best-p
393
+ # ractices) queries in an automated system, and non-address components of
394
+ # the string may match businesses as well as addresses. Examples of
395
+ # ambiguous address queries are incomplete addresses, poorly formatted
396
+ # addresses, or a request that includes non-address components such as
397
+ # business names.
398
+ # The search response will include a list of places. You can send a Place
399
+ # Details request for more information about any of the places in the
400
+ # response.
401
+ # @param [String] query Required parameter: The text string on which to
402
+ # search, for example: "restaurant" or "123 Main Street". This must a place
403
+ # name, address, or category of establishments. Any other types of input can
404
+ # generate errors and are not guaranteed to return valid results. The Google
405
+ # Places service will return candidate matches based on this string and
406
+ # order the results based on their perceived relevance.
407
+ # @param [Float] radius Required parameter: Defines the distance (in meters)
408
+ # within which to return place results. You may bias results to a specified
409
+ # circle by passing a `location` and a `radius` parameter. Doing so
410
+ # instructs the Places service to _prefer_ showing results within that
411
+ # circle; results outside of the defined area may still be displayed. The
412
+ # radius will automatically be clamped to a maximum value depending on the
413
+ # type of search and other parameters. * Autocomplete: 50,000 meters *
414
+ # Nearby Search: * with `keyword` or `name`: 50,000 meters * without
415
+ # `keyword` or `name` * Up to 50,000 meters, adjusted dynamically based
416
+ # on area density, independent of `rankby` parameter. * When using
417
+ # `rankby=distance`, the radius parameter will not be accepted, and will
418
+ # result in an `INVALID_REQUEST`. * Query Autocomplete: 50,000 meters * Text
419
+ # Search: 50,000 meters
420
+ # @param [String] location Optional parameter: The point around which to
421
+ # retrieve place information. This must be specified as
422
+ # `latitude,longitude`. <div class="note">The <code>location</code>
423
+ # parameter may be overriden if the <code>query</code> contains an explicit
424
+ # location such as <code>Market in Barcelona</code>. Using quotes around the
425
+ # query may also influence the weight given to the <code>location</code> and
426
+ # <code>radius</code>.</div>
427
+ # @param [Maxprice] maxprice Optional parameter: Restricts results to only
428
+ # those places within the specified range. Valid values range between 0
429
+ # (most affordable) to 4 (most expensive), inclusive. The exact amount
430
+ # indicated by a specific value will vary from region to region.
431
+ # @param [Minprice] minprice Optional parameter: Restricts results to only
432
+ # those places within the specified range. Valid values range between 0
433
+ # (most affordable) to 4 (most expensive), inclusive. The exact amount
434
+ # indicated by a specific value will vary from region to region.
435
+ # @param [TrueClass | FalseClass] opennow Optional parameter: Returns only
436
+ # those places that are open for business at the time the query is sent.
437
+ # Places that do not specify opening hours in the Google Places database
438
+ # will not be returned if you include this parameter in your query.
439
+ # @param [String] pagetoken Optional parameter: Returns up to 20 results
440
+ # from a previously run search. Setting a `pagetoken` parameter will execute
441
+ # a search with the same parameters used previously — all parameters other
442
+ # than pagetoken will be ignored.
443
+ # @param [String] type Optional parameter: Restricts the results to places
444
+ # matching the specified type. Only one type may be specified. If more than
445
+ # one type is provided, all types following the first entry are ignored. *
446
+ # `type=hospital|pharmacy|doctor` becomes `type=hospital` *
447
+ # `type=hospital,pharmacy,doctor` is ignored entirely See the list of
448
+ # [supported
449
+ # types](https://developers.google.com/maps/documentation/places/web-service
450
+ # /supported_types). <div class="note">Note: Adding both `keyword` and
451
+ # `type` with the same value (`keyword=cafe&type=cafe` or
452
+ # `keyword=parking&type=parking`) can yield `ZERO_RESULTS`.</div>
453
+ # @param [Language] language Optional parameter: The language in which to
454
+ # return results. * See the [list of supported
455
+ # languages](https://developers.google.com/maps/faq#languagesupport). Google
456
+ # often updates the supported languages, so this list may not be exhaustive.
457
+ # * If `language` is not supplied, the API attempts to use the preferred
458
+ # language as specified in the `Accept-Language` header. * The API does its
459
+ # best to provide a street address that is readable for both the user and
460
+ # locals. To achieve that goal, it returns street addresses in the local
461
+ # language, transliterated to a script readable by the user if necessary,
462
+ # observing the preferred language. All other addresses are returned in the
463
+ # preferred language. Address components are all returned in the same
464
+ # language, which is chosen from the first component. * If a name is not
465
+ # available in the preferred language, the API uses the closest match. * The
466
+ # preferred language has a small influence on the set of results that the
467
+ # API chooses to return, and the order in which they are returned. The
468
+ # geocoder interprets abbreviations differently depending on language, such
469
+ # as the abbreviations for street types, or synonyms that may be valid in
470
+ # one language but not in another. For example, _utca_ and _tér_ are
471
+ # synonyms for street in Hungarian.
472
+ # @param [Region] region Optional parameter: The region code, specified as a
473
+ # [ccTLD ("top-level
474
+ # domain")](https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains
475
+ # #Country_code_top-level_domains) two-character value. Most ccTLD codes are
476
+ # identical to ISO 3166-1 codes, with some notable exceptions. For example,
477
+ # the United Kingdom's ccTLD is "uk" (.co.uk) while its ISO 3166-1 code is
478
+ # "gb" (technically for the entity of "The United Kingdom of Great Britain
479
+ # and Northern Ireland").
480
+ # @return [ApiResponse] Complete http response with raw body and status code.
481
+ def text_search(query,
482
+ radius,
483
+ location: nil,
484
+ maxprice: nil,
485
+ minprice: nil,
486
+ opennow: nil,
487
+ pagetoken: nil,
488
+ type: nil,
489
+ language: Language::EN,
490
+ region: Region::EN)
491
+ @api_call
492
+ .request(new_request_builder(HttpMethodEnum::GET,
493
+ '/maps/api/place/textsearch/json',
494
+ Server::DEFAULT)
495
+ .query_param(new_parameter(query, key: 'query')
496
+ .is_required(true))
497
+ .query_param(new_parameter(radius, key: 'radius')
498
+ .is_required(true))
499
+ .query_param(new_parameter(location, key: 'location'))
500
+ .query_param(new_parameter(maxprice, key: 'maxprice'))
501
+ .query_param(new_parameter(minprice, key: 'minprice'))
502
+ .query_param(new_parameter(opennow, key: 'opennow'))
503
+ .query_param(new_parameter(pagetoken, key: 'pagetoken'))
504
+ .query_param(new_parameter(type, key: 'type'))
505
+ .query_param(new_parameter(language, key: 'language'))
506
+ .query_param(new_parameter(region, key: 'region'))
507
+ .header_param(new_parameter('application/json', key: 'accept'))
508
+ .auth(Single.new('ApiKeyAuth')))
509
+ .response(new_response_handler
510
+ .deserializer(APIHelper.method(:custom_type_deserializer))
511
+ .deserialize_into(PlacesTextSearchResponse.method(:from_hash))
512
+ .is_api_response(true))
513
+ .execute
514
+ end
515
+
516
+ # The Place Photo service, part of the Places API, is a read- only API that
517
+ # allows you to add high quality photographic content to your application.
518
+ # The Place Photo service gives you access to the millions of photos stored
519
+ # in the Places database. When you get place information using a Place
520
+ # Details request, photo references will be returned for relevant
521
+ # photographic content. Find Place, Nearby Search, and Text Search requests
522
+ # also return a single photo reference per place, when relevant. Using the
523
+ # Photo service you can then access the referenced photos and resize the
524
+ # image to the optimal size for your application.
525
+ # Photos returned by the Photo service are sourced from a variety of
526
+ # locations, including business owners and user contributed photos. In most
527
+ # cases, these photos can be used without attribution, or will have the
528
+ # required attribution included as a part of the image. However, if the
529
+ # returned photo element includes a value in the html_attributions field,
530
+ # you will have to include the additional attribution in your application
531
+ # wherever you display the image.
532
+ # @param [String] photo_reference Required parameter: A string identifier
533
+ # that uniquely identifies a photo. Photo references are returned from
534
+ # either a Place Search or Place Details request.
535
+ # @param [Float] maxheight Optional parameter: Specifies the maximum desired
536
+ # height, in pixels, of the image. If the image is smaller than the values
537
+ # specified, the original image will be returned. If the image is larger in
538
+ # either dimension, it will be scaled to match the smaller of the two
539
+ # dimensions, restricted to its original aspect ratio. Both the `maxheight`
540
+ # and `maxwidth` properties accept an integer between `1` and `1600`.
541
+ # @param [Float] maxwidth Optional parameter: Specifies the maximum desired
542
+ # width, in pixels, of the image. If the image is smaller than the values
543
+ # specified, the original image will be returned. If the image is larger in
544
+ # either dimension, it will be scaled to match the smaller of the two
545
+ # dimensions, restricted to its original aspect ratio. Both the `maxheight`
546
+ # and `maxwidth` properties accept an integer between `1` and `1600`.
547
+ # @return [ApiResponse] Complete http response with raw body and status code.
548
+ def place_photo(photo_reference,
549
+ maxheight: nil,
550
+ maxwidth: nil)
551
+ @api_call
552
+ .request(new_request_builder(HttpMethodEnum::GET,
553
+ '/maps/api/place/photo',
554
+ Server::DEFAULT)
555
+ .query_param(new_parameter(photo_reference, key: 'photo_reference')
556
+ .is_required(true))
557
+ .query_param(new_parameter(maxheight, key: 'maxheight'))
558
+ .query_param(new_parameter(maxwidth, key: 'maxwidth'))
559
+ .header_param(new_parameter('application/json', key: 'accept'))
560
+ .auth(Single.new('ApiKeyAuth')))
561
+ .response(new_response_handler
562
+ .deserializer(APIHelper.method(:dynamic_deserializer))
563
+ .is_api_response(true))
564
+ .execute
565
+ end
566
+
567
+ # The Query Autocomplete service can be used to provide a query prediction
568
+ # for text-based geographic searches, by returning suggested queries as you
569
+ # type.
570
+ # The Query Autocomplete service allows you to add on-the-fly geographic
571
+ # query predictions to your application. Instead of searching for a specific
572
+ # location, a user can type in a categorical search, such as "pizza near New
573
+ # York" and the service responds with a list of suggested queries matching
574
+ # the string. As the Query Autocomplete service can match on both full words
575
+ # and substrings, applications can send queries as the user types to provide
576
+ # on-the-fly predictions.
577
+ # @param [String] input Required parameter: The text string on which to
578
+ # search. The Place Autocomplete service will return candidate matches based
579
+ # on this string and order results based on their perceived relevance.
580
+ # @param [Float] radius Required parameter: Defines the distance (in meters)
581
+ # within which to return place results. You may bias results to a specified
582
+ # circle by passing a `location` and a `radius` parameter. Doing so
583
+ # instructs the Places service to _prefer_ showing results within that
584
+ # circle; results outside of the defined area may still be displayed. The
585
+ # radius will automatically be clamped to a maximum value depending on the
586
+ # type of search and other parameters. * Autocomplete: 50,000 meters *
587
+ # Nearby Search: * with `keyword` or `name`: 50,000 meters * without
588
+ # `keyword` or `name` * Up to 50,000 meters, adjusted dynamically based
589
+ # on area density, independent of `rankby` parameter. * When using
590
+ # `rankby=distance`, the radius parameter will not be accepted, and will
591
+ # result in an `INVALID_REQUEST`. * Query Autocomplete: 50,000 meters * Text
592
+ # Search: 50,000 meters
593
+ # @param [Float] offset Optional parameter: The position, in the input term,
594
+ # of the last character that the service uses to match predictions. For
595
+ # example, if the input is `Google` and the offset is 3, the service will
596
+ # match on `Goo`. The string determined by the offset is matched against the
597
+ # first word in the input term only. For example, if the input term is
598
+ # `Google abc` and the offset is 3, the service will attempt to match
599
+ # against `Goo abc`. If no offset is supplied, the service will use the
600
+ # whole term. The offset should generally be set to the position of the text
601
+ # caret.
602
+ # @param [String] location Optional parameter: The point around which to
603
+ # retrieve place information. This must be specified as
604
+ # `latitude,longitude`. <div class="note">The <code>location</code>
605
+ # parameter may be overriden if the <code>query</code> contains an explicit
606
+ # location such as <code>Market in Barcelona</code>. Using quotes around the
607
+ # query may also influence the weight given to the <code>location</code> and
608
+ # <code>radius</code>.</div>
609
+ # @param [Language] language Optional parameter: The language in which to
610
+ # return results. * See the [list of supported
611
+ # languages](https://developers.google.com/maps/faq#languagesupport). Google
612
+ # often updates the supported languages, so this list may not be exhaustive.
613
+ # * If `language` is not supplied, the API attempts to use the preferred
614
+ # language as specified in the `Accept-Language` header. * The API does its
615
+ # best to provide a street address that is readable for both the user and
616
+ # locals. To achieve that goal, it returns street addresses in the local
617
+ # language, transliterated to a script readable by the user if necessary,
618
+ # observing the preferred language. All other addresses are returned in the
619
+ # preferred language. Address components are all returned in the same
620
+ # language, which is chosen from the first component. * If a name is not
621
+ # available in the preferred language, the API uses the closest match. * The
622
+ # preferred language has a small influence on the set of results that the
623
+ # API chooses to return, and the order in which they are returned. The
624
+ # geocoder interprets abbreviations differently depending on language, such
625
+ # as the abbreviations for street types, or synonyms that may be valid in
626
+ # one language but not in another. For example, _utca_ and _tér_ are
627
+ # synonyms for street in Hungarian.
628
+ # @return [ApiResponse] Complete http response with raw body and status code.
629
+ def query_autocomplete(input,
630
+ radius,
631
+ offset: nil,
632
+ location: nil,
633
+ language: Language::EN)
634
+ @api_call
635
+ .request(new_request_builder(HttpMethodEnum::GET,
636
+ '/maps/api/place/queryautocomplete/json',
637
+ Server::DEFAULT)
638
+ .query_param(new_parameter(input, key: 'input')
639
+ .is_required(true))
640
+ .query_param(new_parameter(radius, key: 'radius')
641
+ .is_required(true))
642
+ .query_param(new_parameter(offset, key: 'offset'))
643
+ .query_param(new_parameter(location, key: 'location'))
644
+ .query_param(new_parameter(language, key: 'language'))
645
+ .header_param(new_parameter('application/json', key: 'accept'))
646
+ .auth(Single.new('ApiKeyAuth')))
647
+ .response(new_response_handler
648
+ .deserializer(APIHelper.method(:custom_type_deserializer))
649
+ .deserialize_into(PlacesQueryAutocompleteResponse.method(:from_hash))
650
+ .is_api_response(true))
651
+ .execute
652
+ end
653
+
654
+ # The Place Autocomplete service is a web service that returns place
655
+ # predictions in response to an HTTP request. The request specifies a
656
+ # textual search string and optional geographic bounds. The service can be
657
+ # used to provide autocomplete functionality for text-based geographic
658
+ # searches, by returning places such as businesses, addresses and points of
659
+ # interest as a user types.
660
+ # <div class="note">Note: You can use Place Autocomplete even without a map.
661
+ # If you do show a map, it must be a Google map. When you display
662
+ # predictions from the Place Autocomplete service without a map, you must
663
+ # include the ['Powered by
664
+ # Google'](https://developers.google.com/maps/documentation/places/web-servi
665
+ # ce/policies#logo_requirementshttps://developers.google.com/maps/documentat
666
+ # ion/places/web-service/policies#logo_requirements) logo.</div>
667
+ # The Place Autocomplete service can match on full words and substrings,
668
+ # resolving place names, addresses, and plus codes. Applications can
669
+ # therefore send queries as the user types, to provide on-the-fly place
670
+ # predictions.
671
+ # The returned predictions are designed to be presented to the user to aid
672
+ # them in selecting the desired place. You can send a [Place
673
+ # Details](https://developers.google.com/maps/documentation/places/web-servi
674
+ # ce/details#PlaceDetailsRequests) request for more information about any of
675
+ # the places which are returned.
676
+ # @param [String] input Required parameter: The text string on which to
677
+ # search. The Place Autocomplete service will return candidate matches based
678
+ # on this string and order results based on their perceived relevance.
679
+ # @param [Float] radius Required parameter: Defines the distance (in meters)
680
+ # within which to return place results. You may bias results to a specified
681
+ # circle by passing a `location` and a `radius` parameter. Doing so
682
+ # instructs the Places service to _prefer_ showing results within that
683
+ # circle; results outside of the defined area may still be displayed. The
684
+ # radius will automatically be clamped to a maximum value depending on the
685
+ # type of search and other parameters. * Autocomplete: 50,000 meters *
686
+ # Nearby Search: * with `keyword` or `name`: 50,000 meters * without
687
+ # `keyword` or `name` * Up to 50,000 meters, adjusted dynamically based
688
+ # on area density, independent of `rankby` parameter. * When using
689
+ # `rankby=distance`, the radius parameter will not be accepted, and will
690
+ # result in an `INVALID_REQUEST`. * Query Autocomplete: 50,000 meters * Text
691
+ # Search: 50,000 meters
692
+ # @param [String] sessiontoken Optional parameter: A random string which
693
+ # identifies an autocomplete
694
+ # [session](https://developers.google.com/maps/documentation/places/web-serv
695
+ # ice/details#session_tokens) for billing purposes. The session begins when
696
+ # the user starts typing a query, and concludes when they select a place and
697
+ # a call to Place Details is made. Each session can have multiple queries,
698
+ # followed by one place selection. The API key(s) used for each request
699
+ # within a session must belong to the same Google Cloud Console project.
700
+ # Once a session has concluded, the token is no longer valid; your app must
701
+ # generate a fresh token for each session. If the `sessiontoken` parameter
702
+ # is omitted, or if you reuse a session token, the session is charged as if
703
+ # no session token was provided (each request is billed separately). We
704
+ # recommend the following guidelines: - Use session tokens for all
705
+ # autocomplete sessions. - Generate a fresh token for each session. Using a
706
+ # version 4 UUID is recommended. - Ensure that the API key(s) used for all
707
+ # Place Autocomplete and Place Details requests within a session belong to
708
+ # the same Cloud Console project. - Be sure to pass a unique session token
709
+ # for each new session. Using the same token for more than one session will
710
+ # result in each request being billed individually.
711
+ # @param [String] components Optional parameter: A grouping of places to
712
+ # which you would like to restrict your results. Currently, you can use
713
+ # components to filter by up to 5 countries. Countries must be passed as a
714
+ # two character, ISO 3166-1 Alpha-2 compatible country code. For example:
715
+ # `components=country:fr` would restrict your results to places within
716
+ # France. Multiple countries must be passed as multiple `country:XX`
717
+ # filters, with the pipe character `|` as a separator. For example:
718
+ # `components=country:us|country:pr|country:vi|country:gu|country:mp` would
719
+ # restrict your results to places within the United States and its
720
+ # unincorporated organized territories. <div
721
+ # class="note"><strong>Note:</strong> If you receive unexpected results with
722
+ # a country code, verify that you are using a code which includes the
723
+ # countries, dependent territories, and special areas of geographical
724
+ # interest you intend. You can find code information at <a
725
+ # href="https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes"
726
+ # target="blank" class="external">Wikipedia: List of ISO 3166 country
727
+ # codes</a> or the <a href="https://www.iso.org/obp/ui/#search"
728
+ # target="blank" class="external">ISO Online Browsing Platform</a>.</div>
729
+ # @param [TrueClass | FalseClass] strictbounds Optional parameter: Returns
730
+ # only those places that are strictly within the region defined by
731
+ # `location` and `radius`. This is a restriction, rather than a bias,
732
+ # meaning that results outside this region will not be returned even if they
733
+ # match the user input.
734
+ # @param [Float] offset Optional parameter: The position, in the input term,
735
+ # of the last character that the service uses to match predictions. For
736
+ # example, if the input is `Google` and the offset is 3, the service will
737
+ # match on `Goo`. The string determined by the offset is matched against the
738
+ # first word in the input term only. For example, if the input term is
739
+ # `Google abc` and the offset is 3, the service will attempt to match
740
+ # against `Goo abc`. If no offset is supplied, the service will use the
741
+ # whole term. The offset should generally be set to the position of the text
742
+ # caret.
743
+ # @param [String] origin Optional parameter: The origin point from which to
744
+ # calculate straight-line distance to the destination (returned as
745
+ # `distance_meters`). If this value is omitted, straight-line distance will
746
+ # not be returned. Must be specified as `latitude,longitude`.
747
+ # @param [String] location Optional parameter: The point around which to
748
+ # retrieve place information. This must be specified as
749
+ # `latitude,longitude`. The `radius` parameter must also be provided when
750
+ # specifying a location. If `radius` is not provided, the `location`
751
+ # parameter is ignored. <div class="note">When using the Text Search API,
752
+ # the `location` parameter may be overriden if the `query` contains an
753
+ # explicit location such as `Market in Barcelona`.</div>
754
+ # @param [String] locationbias Optional parameter: Prefer results in a
755
+ # specified area, by specifying either a radius plus lat/lng, or two lat/lng
756
+ # pairs representing the points of a rectangle. If this parameter is not
757
+ # specified, the API uses IP address biasing by default. - IP bias:
758
+ # Instructs the API to use IP address biasing. Pass the string `ipbias`
759
+ # (this option has no additional parameters). - Circular: A string
760
+ # specifying radius in meters, plus lat/lng in decimal degrees. Use the
761
+ # following format: `circle:radius@lat,lng`. - Rectangular: A string
762
+ # specifying two lat/lng pairs in decimal degrees, representing the
763
+ # south/west and north/east points of a rectangle. Use the following
764
+ # format:`rectangle:south,west|north,east`. Note that east/west values are
765
+ # wrapped to the range -180, 180, and north/south values are clamped to the
766
+ # range -90, 90.
767
+ # @param [String] locationrestriction Optional parameter: Restrict results
768
+ # to a specified area, by specifying either a radius plus lat/lng, or two
769
+ # lat/lng pairs representing the points of a rectangle. - Circular: A string
770
+ # specifying radius in meters, plus lat/lng in decimal degrees. Use the
771
+ # following format: `circle:radius@lat,lng`. - Rectangular: A string
772
+ # specifying two lat/lng pairs in decimal degrees, representing the
773
+ # south/west and north/east points of a rectangle. Use the following
774
+ # format:`rectangle:south,west|north,east`. Note that east/west values are
775
+ # wrapped to the range -180, 180, and north/south values are clamped to the
776
+ # range -90, 90.
777
+ # @param [String] types Optional parameter: You can restrict results from a
778
+ # Place Autocomplete request to be of a certain type by passing the `types`
779
+ # parameter. This parameter specifies a type or a type collection, as listed
780
+ # in [Place Types](/maps/documentation/places/web-service/supported_types).
781
+ # If nothing is specified, all types are returned. For the value of the
782
+ # `types` parameter you can specify either: * Up to five values from [Table
783
+ # 1](/maps/documentation/places/web-service/supported_types#table1) or
784
+ # [Table 2](/maps/documentation/places/web-service/supported_types#table2).
785
+ # For multiple values, separate each value with a `|` (vertical bar). For
786
+ # example: `types=book_store|cafe` * Any supported filter in [Table
787
+ # 3](/maps/documentation/places/web-service/supported_types#table3). You can
788
+ # safely mix the `geocode` and `establishment` types. You cannot mix type
789
+ # collections (`address`, `(cities)` or `(regions)`) with any other type, or
790
+ # an error occurs. The request will be rejected with an `INVALID_REQUEST`
791
+ # error if: * More than five types are specified. * Any unrecognized types
792
+ # are present. * Any types from in [Table
793
+ # 1](/maps/documentation/places/web-service/supported_types#table1) or
794
+ # [Table 2](/maps/documentation/places/web-service/supported_types#table2)
795
+ # are mixed with any of the filters in [Table
796
+ # 3](/maps/documentation/places/web-service/supported_types#table3).
797
+ # @param [Language] language Optional parameter: The language in which to
798
+ # return results. * See the [list of supported
799
+ # languages](https://developers.google.com/maps/faq#languagesupport). Google
800
+ # often updates the supported languages, so this list may not be exhaustive.
801
+ # * If `language` is not supplied, the API attempts to use the preferred
802
+ # language as specified in the `Accept-Language` header. * The API does its
803
+ # best to provide a street address that is readable for both the user and
804
+ # locals. To achieve that goal, it returns street addresses in the local
805
+ # language, transliterated to a script readable by the user if necessary,
806
+ # observing the preferred language. All other addresses are returned in the
807
+ # preferred language. Address components are all returned in the same
808
+ # language, which is chosen from the first component. * If a name is not
809
+ # available in the preferred language, the API uses the closest match. * The
810
+ # preferred language has a small influence on the set of results that the
811
+ # API chooses to return, and the order in which they are returned. The
812
+ # geocoder interprets abbreviations differently depending on language, such
813
+ # as the abbreviations for street types, or synonyms that may be valid in
814
+ # one language but not in another. For example, _utca_ and _tér_ are
815
+ # synonyms for street in Hungarian.
816
+ # @param [Region] region Optional parameter: The region code, specified as a
817
+ # [ccTLD ("top-level
818
+ # domain")](https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains
819
+ # #Country_code_top-level_domains) two-character value. Most ccTLD codes are
820
+ # identical to ISO 3166-1 codes, with some notable exceptions. For example,
821
+ # the United Kingdom's ccTLD is "uk" (.co.uk) while its ISO 3166-1 code is
822
+ # "gb" (technically for the entity of "The United Kingdom of Great Britain
823
+ # and Northern Ireland").
824
+ # @return [ApiResponse] Complete http response with raw body and status code.
825
+ def autocomplete(input,
826
+ radius,
827
+ sessiontoken: nil,
828
+ components: nil,
829
+ strictbounds: nil,
830
+ offset: nil,
831
+ origin: nil,
832
+ location: nil,
833
+ locationbias: nil,
834
+ locationrestriction: nil,
835
+ types: nil,
836
+ language: Language::EN,
837
+ region: Region::EN)
838
+ @api_call
839
+ .request(new_request_builder(HttpMethodEnum::GET,
840
+ '/maps/api/place/autocomplete/json',
841
+ Server::DEFAULT)
842
+ .query_param(new_parameter(input, key: 'input')
843
+ .is_required(true))
844
+ .query_param(new_parameter(radius, key: 'radius')
845
+ .is_required(true))
846
+ .query_param(new_parameter(sessiontoken, key: 'sessiontoken'))
847
+ .query_param(new_parameter(components, key: 'components'))
848
+ .query_param(new_parameter(strictbounds, key: 'strictbounds'))
849
+ .query_param(new_parameter(offset, key: 'offset'))
850
+ .query_param(new_parameter(origin, key: 'origin'))
851
+ .query_param(new_parameter(location, key: 'location'))
852
+ .query_param(new_parameter(locationbias, key: 'locationbias'))
853
+ .query_param(new_parameter(locationrestriction, key: 'locationrestriction'))
854
+ .query_param(new_parameter(types, key: 'types'))
855
+ .query_param(new_parameter(language, key: 'language'))
856
+ .query_param(new_parameter(region, key: 'region'))
857
+ .header_param(new_parameter('application/json', key: 'accept'))
858
+ .auth(Single.new('ApiKeyAuth')))
859
+ .response(new_response_handler
860
+ .deserializer(APIHelper.method(:custom_type_deserializer))
861
+ .deserialize_into(PlacesAutocompleteResponse.method(:from_hash))
862
+ .is_api_response(true))
863
+ .execute
864
+ end
865
+ end
866
+ end