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.
- checksums.yaml +7 -0
- data/LICENSE +28 -0
- data/README.md +169 -0
- data/bin/console +15 -0
- data/lib/google_maps_platform/api_helper.rb +10 -0
- data/lib/google_maps_platform/client.rb +123 -0
- data/lib/google_maps_platform/configuration.rb +181 -0
- data/lib/google_maps_platform/controllers/base_controller.rb +67 -0
- data/lib/google_maps_platform/controllers/directions_api_controller.rb +341 -0
- data/lib/google_maps_platform/controllers/distance_matrix_api_controller.rb +224 -0
- data/lib/google_maps_platform/controllers/elevation_api_controller.rb +71 -0
- data/lib/google_maps_platform/controllers/geocoding_api_controller.rb +214 -0
- data/lib/google_maps_platform/controllers/geolocation_api_controller.rb +46 -0
- data/lib/google_maps_platform/controllers/places_api_controller.rb +866 -0
- data/lib/google_maps_platform/controllers/roads_api_controller.rb +81 -0
- data/lib/google_maps_platform/controllers/street_view_api_controller.rb +198 -0
- data/lib/google_maps_platform/controllers/time_zone_api_controller.rb +65 -0
- data/lib/google_maps_platform/exceptions/api_exception.rb +21 -0
- data/lib/google_maps_platform/exceptions/error_response_exception.rb +48 -0
- data/lib/google_maps_platform/exceptions/nearest_roads_error_response_exception.rb +46 -0
- data/lib/google_maps_platform/http/api_response.rb +19 -0
- data/lib/google_maps_platform/http/auth/custom_query_authentication.rb +52 -0
- data/lib/google_maps_platform/http/http_call_back.rb +10 -0
- data/lib/google_maps_platform/http/http_method_enum.rb +10 -0
- data/lib/google_maps_platform/http/http_request.rb +10 -0
- data/lib/google_maps_platform/http/http_response.rb +10 -0
- data/lib/google_maps_platform/http/proxy_settings.rb +22 -0
- data/lib/google_maps_platform/logging/configuration/api_logging_configuration.rb +186 -0
- data/lib/google_maps_platform/logging/sdk_logger.rb +17 -0
- data/lib/google_maps_platform/models/address_component.rb +97 -0
- data/lib/google_maps_platform/models/base_model.rb +110 -0
- data/lib/google_maps_platform/models/bounds.rb +85 -0
- data/lib/google_maps_platform/models/business_status.rb +41 -0
- data/lib/google_maps_platform/models/cell_tower.rb +146 -0
- data/lib/google_maps_platform/models/directions_geocoded_waypoint.rb +181 -0
- data/lib/google_maps_platform/models/directions_leg.rb +224 -0
- data/lib/google_maps_platform/models/directions_polyline.rb +93 -0
- data/lib/google_maps_platform/models/directions_response.rb +185 -0
- data/lib/google_maps_platform/models/directions_route.rb +188 -0
- data/lib/google_maps_platform/models/directions_status.rb +94 -0
- data/lib/google_maps_platform/models/directions_step.rb +216 -0
- data/lib/google_maps_platform/models/directions_traffic_speed_entry.rb +84 -0
- data/lib/google_maps_platform/models/directions_transit_agency.rb +95 -0
- data/lib/google_maps_platform/models/directions_transit_details.rb +176 -0
- data/lib/google_maps_platform/models/directions_transit_line.rb +152 -0
- data/lib/google_maps_platform/models/directions_transit_stop.rb +83 -0
- data/lib/google_maps_platform/models/directions_transit_vehicle.rb +126 -0
- data/lib/google_maps_platform/models/directions_via_waypoint.rb +99 -0
- data/lib/google_maps_platform/models/distance_matrix_element.rb +132 -0
- data/lib/google_maps_platform/models/distance_matrix_element_status.rb +48 -0
- data/lib/google_maps_platform/models/distance_matrix_response.rb +149 -0
- data/lib/google_maps_platform/models/distance_matrix_row.rb +89 -0
- data/lib/google_maps_platform/models/distance_matrix_status.rb +74 -0
- data/lib/google_maps_platform/models/elevation_response.rb +132 -0
- data/lib/google_maps_platform/models/elevation_result.rb +99 -0
- data/lib/google_maps_platform/models/elevation_status.rb +65 -0
- data/lib/google_maps_platform/models/error_detail.rb +135 -0
- data/lib/google_maps_platform/models/error_object.rb +130 -0
- data/lib/google_maps_platform/models/fare.rb +92 -0
- data/lib/google_maps_platform/models/field_violation.rb +82 -0
- data/lib/google_maps_platform/models/geocoder_status.rb +37 -0
- data/lib/google_maps_platform/models/geocoding_geometry.rb +117 -0
- data/lib/google_maps_platform/models/geocoding_response.rb +140 -0
- data/lib/google_maps_platform/models/geocoding_result.rb +174 -0
- data/lib/google_maps_platform/models/geocoding_status.rb +71 -0
- data/lib/google_maps_platform/models/geolocation_request.rb +166 -0
- data/lib/google_maps_platform/models/geolocation_response.rb +91 -0
- data/lib/google_maps_platform/models/geometry.rb +84 -0
- data/lib/google_maps_platform/models/inputtype.rb +36 -0
- data/lib/google_maps_platform/models/language.rb +240 -0
- data/lib/google_maps_platform/models/lat_lng_literal.rb +83 -0
- data/lib/google_maps_platform/models/latitude_longitude_literal.rb +83 -0
- data/lib/google_maps_platform/models/location_type.rb +54 -0
- data/lib/google_maps_platform/models/location_type1.rb +44 -0
- data/lib/google_maps_platform/models/maneuver.rb +110 -0
- data/lib/google_maps_platform/models/maps_api_elevation_json_response.rb +132 -0
- data/lib/google_maps_platform/models/maxprice.rb +48 -0
- data/lib/google_maps_platform/models/minprice.rb +48 -0
- data/lib/google_maps_platform/models/mode.rb +44 -0
- data/lib/google_maps_platform/models/nearest_roads_error.rb +90 -0
- data/lib/google_maps_platform/models/nearest_roads_response.rb +86 -0
- data/lib/google_maps_platform/models/place.rb +647 -0
- data/lib/google_maps_platform/models/place_autocomplete_matched_substring.rb +82 -0
- data/lib/google_maps_platform/models/place_autocomplete_prediction.rb +181 -0
- data/lib/google_maps_platform/models/place_autocomplete_structured_format.rb +136 -0
- data/lib/google_maps_platform/models/place_autocomplete_term.rb +83 -0
- data/lib/google_maps_platform/models/place_editorial_summary.rb +87 -0
- data/lib/google_maps_platform/models/place_opening_hours.rb +138 -0
- data/lib/google_maps_platform/models/place_opening_hours_period.rb +84 -0
- data/lib/google_maps_platform/models/place_opening_hours_period_detail.rb +108 -0
- data/lib/google_maps_platform/models/place_photo.rb +109 -0
- data/lib/google_maps_platform/models/place_review.rb +186 -0
- data/lib/google_maps_platform/models/place_special_day.rb +93 -0
- data/lib/google_maps_platform/models/places_autocomplete_response.rb +141 -0
- data/lib/google_maps_platform/models/places_autocomplete_status.rb +66 -0
- data/lib/google_maps_platform/models/places_details_response.rb +131 -0
- data/lib/google_maps_platform/models/places_details_status.rb +71 -0
- data/lib/google_maps_platform/models/places_find_place_from_text_response.rb +145 -0
- data/lib/google_maps_platform/models/places_nearby_search_response.rb +171 -0
- data/lib/google_maps_platform/models/places_query_autocomplete_response.rb +141 -0
- data/lib/google_maps_platform/models/places_search_status.rb +66 -0
- data/lib/google_maps_platform/models/places_text_search_response.rb +171 -0
- data/lib/google_maps_platform/models/plus_code.rb +92 -0
- data/lib/google_maps_platform/models/rankby.rb +36 -0
- data/lib/google_maps_platform/models/region.rb +1052 -0
- data/lib/google_maps_platform/models/result.rb +96 -0
- data/lib/google_maps_platform/models/result_type.rb +112 -0
- data/lib/google_maps_platform/models/snap_to_roads_response.rb +96 -0
- data/lib/google_maps_platform/models/snapped_point.rb +103 -0
- data/lib/google_maps_platform/models/source.rb +36 -0
- data/lib/google_maps_platform/models/street_view_response.rb +135 -0
- data/lib/google_maps_platform/models/street_view_status.rb +71 -0
- data/lib/google_maps_platform/models/text_value_object.rb +82 -0
- data/lib/google_maps_platform/models/time_zone_response.rb +154 -0
- data/lib/google_maps_platform/models/time_zone_status.rb +68 -0
- data/lib/google_maps_platform/models/time_zone_text_value_object.rb +94 -0
- data/lib/google_maps_platform/models/traffic_model.rb +40 -0
- data/lib/google_maps_platform/models/transit_routing_preference.rb +36 -0
- data/lib/google_maps_platform/models/travel_mode.rb +48 -0
- data/lib/google_maps_platform/models/type.rb +140 -0
- data/lib/google_maps_platform/models/type1.rb +112 -0
- data/lib/google_maps_platform/models/units.rb +36 -0
- data/lib/google_maps_platform/models/wi_fi_access_point.rb +119 -0
- data/lib/google_maps_platform/utilities/date_time_helper.rb +11 -0
- data/lib/google_maps_platform/utilities/file_wrapper.rb +28 -0
- data/lib/google_maps_platform.rb +154 -0
- metadata +210 -0
|
@@ -0,0 +1,214 @@
|
|
|
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
|
+
# GeocodingApiController
|
|
8
|
+
class GeocodingApiController < BaseController
|
|
9
|
+
# The Geocoding API is a service that provides geocoding and reverse
|
|
10
|
+
# geocoding of addresses.
|
|
11
|
+
# **Geocoding** is the process of converting addresses (like a street
|
|
12
|
+
# address) into geographic coordinates (like latitude and longitude), which
|
|
13
|
+
# you can use to place markers on a map, or position the map.
|
|
14
|
+
# **Reverse geocoding** is the process of converting geographic coordinates
|
|
15
|
+
# into a human-readable address.
|
|
16
|
+
# You can also use the Geocoding API to find the address for a given place
|
|
17
|
+
# ID.
|
|
18
|
+
# To see countries currently supported by the Google Maps Platform Geocoding
|
|
19
|
+
# API, please consult the [Google Maps coverage
|
|
20
|
+
# data](https://developers.google.com/maps/coverage). The accuracy of
|
|
21
|
+
# geocoded locations may vary per country, so you should consider using the
|
|
22
|
+
# returned `location_type` field to determine if a good enough match has
|
|
23
|
+
# been found for the purposes of your application. Please note that the
|
|
24
|
+
# availability of geocoding data depends on our contracts with data
|
|
25
|
+
# providers, so it is subject to change.
|
|
26
|
+
# @param [String] address Optional parameter: The street address or plus
|
|
27
|
+
# code that you want to geocode. Specify addresses in accordance with the
|
|
28
|
+
# format used by the national postal service of the country concerned.
|
|
29
|
+
# Additional address elements such as business names and unit, suite or
|
|
30
|
+
# floor numbers should be avoided. Street address elements should be
|
|
31
|
+
# delimited by spaces (shown here as url-escaped to `%20`): ```
|
|
32
|
+
# address=24%20Sussex%20Drive%20Ottawa%20ON ``` Format plus codes as shown
|
|
33
|
+
# here (plus signs are url-escaped to `%2B` and spaces are url-escaped to
|
|
34
|
+
# `%20`): - global code is a 4 character area code and 6 character or longer
|
|
35
|
+
# local code (`849VCWC8+R9` is `849VCWC8%2BR9`). - compound code is a 6
|
|
36
|
+
# character or longer local code with an explicit location (`CWC8+R9
|
|
37
|
+
# Mountain View, CA, USA` is `CWC8%2BR9%20Mountain%20View%20CA%20USA`).
|
|
38
|
+
# <div class="note">Note: At least one of `address` or `components` is
|
|
39
|
+
# required.</div>
|
|
40
|
+
# @param [Array[String]] bounds Optional parameter: The bounding box of the
|
|
41
|
+
# viewport within which to bias geocode results more prominently. This
|
|
42
|
+
# parameter will only influence, not fully restrict, results from the
|
|
43
|
+
# geocoder.
|
|
44
|
+
# @param [Array[String]] components Optional parameter: A components filter
|
|
45
|
+
# with elements separated by a pipe (|). The components filter is also
|
|
46
|
+
# accepted as an optional parameter if an address is provided. Each element
|
|
47
|
+
# in the components filter consists of a `component:value` pair, and fully
|
|
48
|
+
# restricts the results from the geocoder. The components that can be
|
|
49
|
+
# filtered include: * `postal_code` matches `postal_code` and
|
|
50
|
+
# `postal_code_prefix`. * `country` matches a country name or a two letter
|
|
51
|
+
# ISO 3166-1 country code. The API follows the ISO standard for defining
|
|
52
|
+
# countries, and the filtering works best when using the corresponding ISO
|
|
53
|
+
# code of the country. <aside class="note"><strong>Note</strong>: If you
|
|
54
|
+
# receive unexpected results with a country code, verify that you are using
|
|
55
|
+
# a code which includes the countries, dependent territories, and special
|
|
56
|
+
# areas of geographical interest you intend. You can find code information
|
|
57
|
+
# at Wikipedia: List of ISO 3166 country codes or the ISO Online Browsing
|
|
58
|
+
# Platform.</aside> The following components may be used to influence
|
|
59
|
+
# results, but will not be enforced: * `route` matches the long or short
|
|
60
|
+
# name of a route. * `locality` matches against `locality` and `sublocality`
|
|
61
|
+
# types. * `administrative_area` matches all the `administrative_area`
|
|
62
|
+
# levels. Notes about component filtering: * Do not repeat these
|
|
63
|
+
# component filters in requests, or the API will return `INVALID_REQUEST`:
|
|
64
|
+
# * `country` * `postal_code` * `route` * If the request contains
|
|
65
|
+
# repeated component filters, the API evaluates those filters as an AND, not
|
|
66
|
+
# an OR. * Results are consistent with Google Maps, which occasionally
|
|
67
|
+
# yields unexpected `ZERO_RESULTS` responses. Using Place Autocomplete may
|
|
68
|
+
# provide better results in some use cases. To learn more, see [this
|
|
69
|
+
# FAQ](https://developers..google.com/maps/documentation/geocoding/faq#trbl_
|
|
70
|
+
# component_filtering). * For each address component, either specify it in
|
|
71
|
+
# the address parameter or in a components filter, but not both. Specifying
|
|
72
|
+
# the same values in both may result in `ZERO_RESULTS`. <div
|
|
73
|
+
# class="note">Note: At least one of `address` or `components` is
|
|
74
|
+
# required.</div>
|
|
75
|
+
# @param [String] latlng Optional parameter: The street address that you
|
|
76
|
+
# want to geocode, in the format used by the national postal service of the
|
|
77
|
+
# country concerned. Additional address elements such as business names and
|
|
78
|
+
# unit, suite or floor numbers should be avoided.
|
|
79
|
+
# @param [Array[LocationType1]] location_type Optional parameter: A filter
|
|
80
|
+
# of one or more location types, separated by a pipe (`|`). If the parameter
|
|
81
|
+
# contains multiple location types, the API returns all addresses that match
|
|
82
|
+
# any of the types. A note about processing: The `location_type` parameter
|
|
83
|
+
# does not restrict the search to the specified location type(s). Rather,
|
|
84
|
+
# the `location_type` acts as a post-search filter: the API fetches all
|
|
85
|
+
# results for the specified latlng, then discards those results that do not
|
|
86
|
+
# match the specified location type(s). The following values are supported:
|
|
87
|
+
# * `APPROXIMATE` returns only the addresses that are characterized as
|
|
88
|
+
# approximate. * `GEOMETRIC_CENTER` returns only geometric centers of a
|
|
89
|
+
# location such as a polyline (for example, a street) or polygon (region). *
|
|
90
|
+
# `RANGE_INTERPOLATED` returns only the addresses that reflect an
|
|
91
|
+
# approximation (usually on a road) interpolated between two precise points
|
|
92
|
+
# (such as intersections). An interpolated range generally indicates that
|
|
93
|
+
# rooftop geocodes are unavailable for a street address. * `ROOFTOP` returns
|
|
94
|
+
# only the addresses for which Google has location information accurate down
|
|
95
|
+
# to street address precision.
|
|
96
|
+
# @param [String] place_id Optional parameter: A textual identifier that
|
|
97
|
+
# uniquely identifies a place, returned from a [Place
|
|
98
|
+
# Search](https://developers.google.com/maps/documentation/places/web-servic
|
|
99
|
+
# e/search). For more information about place IDs, see the [place ID
|
|
100
|
+
# overview](https://developers.google.com/maps/documentation/places/web-serv
|
|
101
|
+
# ice/place-id).
|
|
102
|
+
# @param [Array[ResultType]] result_type Optional parameter: A filter of one
|
|
103
|
+
# or more address types, separated by a pipe (|). If the parameter contains
|
|
104
|
+
# multiple address types, the API returns all addresses that match any of
|
|
105
|
+
# the types. A note about processing: The `result_type` parameter does not
|
|
106
|
+
# restrict the search to the specified address type(s). Rather, the
|
|
107
|
+
# `result_type` acts as a post-search filter: the API fetches all results
|
|
108
|
+
# for the specified `latlng`, then discards those results that do not match
|
|
109
|
+
# the specified address type(s).The following values are supported: *
|
|
110
|
+
# `administrative_area_level_1` indicates a first-order civil entity below
|
|
111
|
+
# the country level. Within the United States, these administrative levels
|
|
112
|
+
# are states. Not all nations exhibit these administrative levels. In most
|
|
113
|
+
# cases, administrative_area_level_1 * `short` names will closely match
|
|
114
|
+
# ISO 3166-2 subdivisions and other widely circulated lists; however this is
|
|
115
|
+
# not guaranteed as our geocoding results are based on a variety of signals
|
|
116
|
+
# and location data. * `administrative_area_level_2` indicates a
|
|
117
|
+
# second-order civil entity below the country level. Within the United
|
|
118
|
+
# States, these administrative levels are counties. Not all nations exhibit
|
|
119
|
+
# these administrative levels. * `administrative_area_level_3` indicates a
|
|
120
|
+
# third-order civil entity below the country level. This type indicates a
|
|
121
|
+
# minor civil division. Not all nations exhibit these administrative levels.
|
|
122
|
+
# * `administrative_area_level_4` indicates a fourth-order civil entity
|
|
123
|
+
# below the country level. This type indicates a minor civil division. Not
|
|
124
|
+
# all nations exhibit these administrative levels. *
|
|
125
|
+
# `administrative_area_level_5` indicates a fifth-order civil entity below
|
|
126
|
+
# the country level. This type indicates a minor civil division. Not all
|
|
127
|
+
# nations exhibit these administrative levels. * `airport` indicates an
|
|
128
|
+
# airport. * `colloquial_area` indicates a commonly-used alternative name
|
|
129
|
+
# for the entity. * `country` indicates the national political entity, and
|
|
130
|
+
# is typically the highest order type returned by the Geocoder. *
|
|
131
|
+
# `intersection` indicates a major intersection, usually of two major roads.
|
|
132
|
+
# * `locality` indicates an incorporated city or town political entity. *
|
|
133
|
+
# `natural_feature` indicates a prominent natural feature. * `neighborhood`
|
|
134
|
+
# indicates a named neighborhood * `park` indicates a named park. *
|
|
135
|
+
# `plus_code` indicates an encoded location reference, derived from latitude
|
|
136
|
+
# and longitude. Plus codes can be used as a replacement for street
|
|
137
|
+
# addresses in places where they do not exist (where buildings are not
|
|
138
|
+
# numbered or streets are not named). See
|
|
139
|
+
# [https://plus.codes/](https://plus.codes/) for details. *
|
|
140
|
+
# `point_of_interest` indicates a named point of interest. Typically, these
|
|
141
|
+
# "POI"s are prominent local entities that don't easily fit in another
|
|
142
|
+
# category, such as "Empire State Building" or "Eiffel Tower". * `political`
|
|
143
|
+
# indicates a political entity. Usually, this type indicates a polygon of
|
|
144
|
+
# some civil administration. * `postal_code` indicates a postal code as used
|
|
145
|
+
# to address postal mail within the country. * `premise` indicates a named
|
|
146
|
+
# location, usually a building or collection of buildings with a common name
|
|
147
|
+
# * `route` indicates a named route (such as "US 101"). * `street_address`
|
|
148
|
+
# indicates a precise street address. * `sublocality` indicates a
|
|
149
|
+
# first-order civil entity below a locality. For some locations may receive
|
|
150
|
+
# one of the additional types: `sublocality_level_1` to
|
|
151
|
+
# `sublocality_level_5`. Each sublocality level is a civil entity. Larger
|
|
152
|
+
# numbers indicate a smaller geographic area. * `subpremise` indicates a
|
|
153
|
+
# first-order entity below a named location, usually a singular building
|
|
154
|
+
# within a collection of buildings with a common name
|
|
155
|
+
# @param [Language] language Optional parameter: The language in which to
|
|
156
|
+
# return results. * See the [list of supported
|
|
157
|
+
# languages](https://developers.google.com/maps/faq#languagesupport). Google
|
|
158
|
+
# often updates the supported languages, so this list may not be exhaustive.
|
|
159
|
+
# * If `language` is not supplied, the API attempts to use the preferred
|
|
160
|
+
# language as specified in the `Accept-Language` header. * The API does its
|
|
161
|
+
# best to provide a street address that is readable for both the user and
|
|
162
|
+
# locals. To achieve that goal, it returns street addresses in the local
|
|
163
|
+
# language, transliterated to a script readable by the user if necessary,
|
|
164
|
+
# observing the preferred language. All other addresses are returned in the
|
|
165
|
+
# preferred language. Address components are all returned in the same
|
|
166
|
+
# language, which is chosen from the first component. * If a name is not
|
|
167
|
+
# available in the preferred language, the API uses the closest match. * The
|
|
168
|
+
# preferred language has a small influence on the set of results that the
|
|
169
|
+
# API chooses to return, and the order in which they are returned. The
|
|
170
|
+
# geocoder interprets abbreviations differently depending on language, such
|
|
171
|
+
# as the abbreviations for street types, or synonyms that may be valid in
|
|
172
|
+
# one language but not in another. For example, _utca_ and _tér_ are
|
|
173
|
+
# synonyms for street in Hungarian.
|
|
174
|
+
# @param [Region] region Optional parameter: The region code, specified as a
|
|
175
|
+
# [ccTLD ("top-level
|
|
176
|
+
# domain")](https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains
|
|
177
|
+
# #Country_code_top-level_domains) two-character value. Most ccTLD codes are
|
|
178
|
+
# identical to ISO 3166-1 codes, with some notable exceptions. For example,
|
|
179
|
+
# the United Kingdom's ccTLD is "uk" (.co.uk) while its ISO 3166-1 code is
|
|
180
|
+
# "gb" (technically for the entity of "The United Kingdom of Great Britain
|
|
181
|
+
# and Northern Ireland").
|
|
182
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
183
|
+
def geocode(address: nil,
|
|
184
|
+
bounds: nil,
|
|
185
|
+
components: nil,
|
|
186
|
+
latlng: nil,
|
|
187
|
+
location_type: nil,
|
|
188
|
+
place_id: nil,
|
|
189
|
+
result_type: nil,
|
|
190
|
+
language: Language::EN,
|
|
191
|
+
region: Region::EN)
|
|
192
|
+
@api_call
|
|
193
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
194
|
+
'/maps/api/geocode/json',
|
|
195
|
+
Server::DEFAULT)
|
|
196
|
+
.query_param(new_parameter(address, key: 'address'))
|
|
197
|
+
.query_param(new_parameter(bounds, key: 'bounds'))
|
|
198
|
+
.query_param(new_parameter(components, key: 'components'))
|
|
199
|
+
.query_param(new_parameter(latlng, key: 'latlng'))
|
|
200
|
+
.query_param(new_parameter(location_type, key: 'location_type'))
|
|
201
|
+
.query_param(new_parameter(place_id, key: 'place_id'))
|
|
202
|
+
.query_param(new_parameter(result_type, key: 'result_type'))
|
|
203
|
+
.query_param(new_parameter(language, key: 'language'))
|
|
204
|
+
.query_param(new_parameter(region, key: 'region'))
|
|
205
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
206
|
+
.auth(Single.new('ApiKeyAuth')))
|
|
207
|
+
.response(new_response_handler
|
|
208
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
209
|
+
.deserialize_into(GeocodingResponse.method(:from_hash))
|
|
210
|
+
.is_api_response(true))
|
|
211
|
+
.execute
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
# GeolocationApiController
|
|
8
|
+
class GeolocationApiController < BaseController
|
|
9
|
+
# Geolocation API returns a location and accuracy radius based on
|
|
10
|
+
# information about cell towers and WiFi nodes that the mobile client can
|
|
11
|
+
# detect. This document describes the protocol used to send this data to the
|
|
12
|
+
# server and to return a response to the client.
|
|
13
|
+
# Communication is done over HTTPS using POST. Both request and response are
|
|
14
|
+
# formatted as JSON, and the content type of both is `application/json`.
|
|
15
|
+
# You must specify a key in your request, included as the value of a`key`
|
|
16
|
+
# parameter. A `key` is your application's API key. This key identifies
|
|
17
|
+
# your application for purposes of quota management. Learn how to [get a
|
|
18
|
+
# key](https://developers.google.com/maps/documentation/geolocation/get-api-
|
|
19
|
+
# key).
|
|
20
|
+
# @param [GeolocationRequest] body Optional parameter: The request body must
|
|
21
|
+
# be formatted as JSON.
|
|
22
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
23
|
+
def geolocate(body: nil)
|
|
24
|
+
@api_call
|
|
25
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
|
26
|
+
'/geolocation/v1/geolocate',
|
|
27
|
+
Server::DEFAULT)
|
|
28
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
|
29
|
+
.body_param(new_parameter(body))
|
|
30
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
31
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
|
32
|
+
.auth(Single.new('ApiKeyAuth')))
|
|
33
|
+
.response(new_response_handler
|
|
34
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
35
|
+
.deserialize_into(GeolocationResponse.method(:from_hash))
|
|
36
|
+
.is_api_response(true)
|
|
37
|
+
.local_error('400',
|
|
38
|
+
'400 BAD REQUEST',
|
|
39
|
+
ErrorResponseException)
|
|
40
|
+
.local_error('404',
|
|
41
|
+
'404 NOT FOUND',
|
|
42
|
+
ErrorResponseException))
|
|
43
|
+
.execute
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|