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,341 @@
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
+ # DirectionsApiController
8
+ class DirectionsApiController < BaseController
9
+ # The Directions API is a web service that uses an HTTP request to return
10
+ # JSON or XML-formatted directions between locations. You can receive
11
+ # directions for several modes of transportation, such as transit, driving,
12
+ # walking, or cycling.
13
+ # @param [String] destination Required parameter: The place ID, address, or
14
+ # textual latitude/longitude value to which you wish to calculate
15
+ # directions. The options for the destination parameter are the same as for
16
+ # the origin parameter.
17
+ # @param [String] origin Required parameter: The place ID, address, or
18
+ # textual latitude/longitude value from which you wish to calculate
19
+ # directions. * Place IDs must be prefixed with `place_id:`. You can
20
+ # retrieve place IDs from the Geocoding API and the Places API (including
21
+ # Place Autocomplete). For an example using place IDs from Place
22
+ # Autocomplete, see [Place Autocomplete and
23
+ # Directions](https://developers.google.com/maps/documentation/javascript/ex
24
+ # amples/places-autocomplete-directions). For more about place IDs, see the
25
+ # [Place ID
26
+ # overview](https://developers.google.com/maps/documentation/places/web-serv
27
+ # ice/place-id). ``` origin=place_id:ChIJ3S-JXmauEmsRUcIaWtf4MzE
28
+ # ``` * If you pass an address, the Directions service geocodes the
29
+ # string and converts it to a latitude/longitude coordinate to calculate
30
+ # directions. This coordinate may be different from that returned by the
31
+ # Geocoding API, for example a building entrance rather than its center.
32
+ # ``` origin=24+Sussex+Drive+Ottawa+ON ``` Using place IDs is
33
+ # preferred over using addresses or latitude/longitude coordinates. Using
34
+ # coordinates will always result in the point being snapped to the road
35
+ # nearest to those coordinates - which may not be an access point to the
36
+ # property, or even a road that will quickly or safely lead to the
37
+ # destination. * If you pass coordinates, the point will snap to the nearest
38
+ # road. Passing a place ID is preferred. If you do pass coordinates, ensure
39
+ # that no space exists between the latitude and longitude values. ```
40
+ # origin=41.43206,-81.38992 ``` * Plus codes must be formatted as a
41
+ # global code or a compound code. Format plus codes as shown here (plus
42
+ # signs are url-escaped to `%2B` and spaces are url-escaped to `%20`).
43
+ # * **Global code** is a 4 character area code and 6 character or longer
44
+ # local code (849VCWC8+R9 is `849VCWC8%2BR9`). * **Compound code** is a 6
45
+ # character or longer local code with an explicit location (CWC8+R9 Mountain
46
+ # View, CA, USA is `CWC8%2BR9%20Mountain%20View%20CA%20USA`). <div
47
+ # class="note">Note: For efficiency and accuracy, use place ID's when
48
+ # possible. These ID's are uniquely explicit like a lat/lng value pair and
49
+ # provide geocoding benefits for routing such as access points and traffic
50
+ # variables. Unlike an address, ID's do not require the service to perform a
51
+ # search or an intermediate request for place details; therefore,
52
+ # performance is better.</div>
53
+ # @param [Float] arrival_time Optional parameter: Specifies the desired time
54
+ # of arrival for transit directions, in seconds since midnight, January 1,
55
+ # 1970 UTC. You can specify either `departure_time` or `arrival_time`, but
56
+ # not both. Note that `arrival_time` must be specified as an integer.
57
+ # @param [Float] departure_time Optional parameter: Specifies the desired
58
+ # time of departure. You can specify the time as an integer in seconds since
59
+ # midnight, January 1, 1970 UTC. If a `departure_time` later than
60
+ # 9999-12-31T23:59:59.999999999Z is specified, the API will fall back the
61
+ # `departure_time` to 9999-12-31T23:59:59.999999999Z. Alternatively, you can
62
+ # specify a value of now, which sets the departure time to the current time
63
+ # (correct to the nearest second). The departure time may be specified in
64
+ # two cases: * For requests where the travel mode is transit: You can
65
+ # optionally specify one of `departure_time` or `arrival_time`. If neither
66
+ # time is specified, the `departure_time` defaults to now (that is, the
67
+ # departure time defaults to the current time). * For requests where the
68
+ # travel mode is driving: You can specify the `departure_time` to receive a
69
+ # route and trip duration (response field: duration_in_traffic) that take
70
+ # traffic conditions into account. The `departure_time` must be set to the
71
+ # current time or some time in the future. It cannot be in the past. <div
72
+ # class="note">Note: If departure time is not specified, choice of route and
73
+ # duration are based on road network and average time-independent traffic
74
+ # conditions. Results for a given request may vary over time due to changes
75
+ # in the road network, updated average traffic conditions, and the
76
+ # distributed nature of the service. Results may also vary between
77
+ # nearly-equivalent routes at any time or frequency.</div> <div
78
+ # class="note">Note: Distance Matrix requests specifying `departure_time`
79
+ # when `mode=driving` are limited to a maximum of 100 elements per request.
80
+ # The number of origins times the number of destinations defines the number
81
+ # of elements.</div>
82
+ # @param [TrueClass | FalseClass] alternatives Optional parameter: If set to
83
+ # `true`, specifies that the Directions service may provide more than one
84
+ # route alternative in the response. Note that providing route alternatives
85
+ # may increase the response time from the server. This is only available for
86
+ # requests without intermediate waypoints. For more information, see the
87
+ # [guide to
88
+ # waypoints](https://developers.google.com/maps/documentation/directions/get
89
+ # -directions#Waypoints).
90
+ # @param [String] avoid Optional parameter: Indicates that the calculated
91
+ # route(s) should avoid the indicated features. This parameter supports the
92
+ # following arguments: * `tolls` indicates that the calculated route should
93
+ # avoid toll roads/bridges. * `highways` indicates that the calculated route
94
+ # should avoid highways. * `ferries` indicates that the calculated route
95
+ # should avoid ferries. * `indoor` indicates that the calculated route
96
+ # should avoid indoor steps for walking and transit directions. It's
97
+ # possible to request a route that avoids any combination of tolls, highways
98
+ # and ferries by passing multiple restrictions to the avoid parameter. For
99
+ # example: ``` avoid=tolls|highways|ferries. ```
100
+ # @param [Units] units Optional parameter: Specifies the unit system to use
101
+ # when displaying results. Directions results contain text within distance
102
+ # fields that may be displayed to the user to indicate the distance of a
103
+ # particular "step" of the route. By default, this text uses the unit system
104
+ # of the origin's country or region. For example, a route from "Chicago,
105
+ # IL" to "Toronto, ONT" will display results in miles, while the reverse
106
+ # route will display results in kilometers. You may override this unit
107
+ # system by setting one explicitly within the request's units parameter,
108
+ # passing one of the following values: * `metric` specifies usage of the
109
+ # metric system. Textual distances are returned using kilometers and meters.
110
+ # * `imperial` specifies usage of the Imperial (English) system. Textual
111
+ # distances are returned using miles and feet. <div class="note">Note: this
112
+ # unit system setting only affects the text displayed within distance
113
+ # fields. The distance fields also contain values which are always expressed
114
+ # in meters.</div>
115
+ # @param [String] waypoints Optional parameter: <div
116
+ # class="caution">Caution: Requests using more than 10 waypoints (between 11
117
+ # and 25), or waypoint optimization, are billed at a higher rate. <a
118
+ # href="https://developers.google.com/maps/billing-and-pricing/pricing#direc
119
+ # tions-advanced">Learn more about billing</a> for Google Maps Platform
120
+ # products.</div> Specifies an array of intermediate locations to include
121
+ # along the route between the origin and destination points as pass through
122
+ # or stopover locations. Waypoints alter a route by directing it through the
123
+ # specified location(s). The API supports waypoints for these travel modes:
124
+ # driving, walking and bicycling; not transit. You can supply one or more
125
+ # locations separated by the pipe character (`|` or `%7C`), in the form of a
126
+ # place ID, an address, or latitude/longitude coordinates. By default, the
127
+ # Directions service calculates a route using the waypoints in the order
128
+ # they are given. The precedence for parsing the value of the waypoint is
129
+ # place ID, latitude/longitude coordinates, then address. * If you pass a
130
+ # place ID, you must prefix it with `place_id:`. You can retrieve place IDs
131
+ # from the Geocoding API and the Places API (including Place Autocomplete).
132
+ # For an example using place IDs from Place Autocomplete, see [Place
133
+ # Autocomplete and
134
+ # Directions](/maps/documentation/javascript/examples/places-autocomplete-di
135
+ # rections). For more about place IDs, see the [Place ID
136
+ # overview](/maps/documentation/places/web-service/place-id). <div
137
+ # class="note">For efficiency and accuracy, use place ID's when possible.
138
+ # These ID's are uniquely explicit like a lat/lng value pair and provide
139
+ # geocoding benefits for routing such as access points and traffic
140
+ # variables. Unlike an address, ID's do not require the service to perform a
141
+ # search or an intermediate request for place details; therefore,
142
+ # performance is better.</div> * If you pass latitude/longitude coordinates,
143
+ # the values go directly to the front-end server to calculate directions
144
+ # without geocoding. The points are snapped to roads and might not provide
145
+ # the accuracy your app needs. Use coordinates when you are confident the
146
+ # values truly specify the points your app needs for routing without regard
147
+ # to possible access points or additional geocoding details. Ensure that a
148
+ # comma (`%2C`) and not a space (`%20`) separates the latitude and longitude
149
+ # values. * If you pass an address, the Directions service will geocode the
150
+ # string and convert it into latitude/longitude coordinates to calculate
151
+ # directions. If the address value is ambiguous, the value might evoke a
152
+ # search to disambiguate from similar addresses. For example, "1st Street"
153
+ # could be a complete value or a partial value for "1st street NE" or "1st
154
+ # St SE". This result may be different from that returned by the Geocoding
155
+ # API. You can avoid possible misinterpretations using place IDs. *
156
+ # Alternatively, you can supply an encoded set of points using the [Encoded
157
+ # Polyline
158
+ # Algorithm](https://developers.google.com/maps/documentation/utilities/poly
159
+ # linealgorithm). You will find an encoded set is useful for a large number
160
+ # of waypoints, because the URL is significantly shorter. All web services
161
+ # have a URL limit of 8192 characters. * Encoded polylines must be
162
+ # prefixed with `enc:` and followed by a colon (`:`). For example:
163
+ # `waypoints=enc:gfo}EtohhU:`. * You can also include multiple encoded
164
+ # polylines, separated by the pipe character (`|`). For example,
165
+ # `waypoints=via:enc:wc~oAwquwMdlTxiKtqLyiK:|enc:c~vnAamswMvlTor@tjGi}L:|
166
+ # via:enc:udymA{~bxM:` ##### Influence routes with stopover and pass
167
+ # through points For each waypoint in the request, the directions response
168
+ # appends an entry to the `legs` array to provide the details for stopovers
169
+ # on that leg of the journey. If you'd like to influence the route using
170
+ # waypoints without adding a stopover, add the prefix `via:` to the
171
+ # waypoint. Waypoints prefixed with `via:` will not add an entry to the
172
+ # `legs` array, but will route the journey through the waypoint. The
173
+ # following URL modifies the previous request such that the journey is
174
+ # routed through Lexington without stopping: ```
175
+ # https://maps.googleapis.com/maps/api/directions/json?
176
+ # origin=Boston,MA&destination=Concord,MA
177
+ # &waypoints=Charlestown,MA|via:Lexington,MA ``` The `via:` prefix is
178
+ # most effective when creating routes in response to the user dragging the
179
+ # waypoints on the map. Doing so allows the user to see how the final route
180
+ # may look in real-time and helps ensure that waypoints are placed in
181
+ # locations that are accessible to the Directions API. <div
182
+ # class="caution">Caution: Using the `via:` prefix to avoid stopovers
183
+ # results in directions that are strict in their interpretation of the
184
+ # waypoint. This interpretation may result in severe detours on the route or
185
+ # `ZERO_RESULTS` in the response status code if the Directions API is unable
186
+ # to create directions through that point.</div> ##### Optimize your
187
+ # waypoints By default, the Directions service calculates a route through
188
+ # the provided waypoints in their given order. Optionally, you may pass
189
+ # `optimize:true` as the first argument within the waypoints parameter to
190
+ # allow the Directions service to optimize the provided route by rearranging
191
+ # the waypoints in a more efficient order. (This optimization is an
192
+ # application of the traveling salesperson problem.) Travel time is the
193
+ # primary factor which is optimized, but other factors such as distance,
194
+ # number of turns and many more may be taken into account when deciding
195
+ # which route is the most efficient. All waypoints must be stopovers for the
196
+ # Directions service to optimize their route. If you instruct the
197
+ # Directions service to optimize the order of its waypoints, their order
198
+ # will be returned in the `waypoint_order` field within the routes object.
199
+ # The `waypoint_order` field returns values which are zero-based. The
200
+ # following example calculates a road journey from Adelaide, South Australia
201
+ # to each of South Australia's main wine regions using route optimization.
202
+ # ``` https://maps.googleapis.com/maps/api/directions/json?
203
+ # origin=Adelaide,SA&destination=Adelaide,SA
204
+ # &waypoints=optimize:true|Barossa+Valley,SA|Clare,SA|Connawarra,SA|McLaren+
205
+ # Vale,SA ``` Inspection of the calculated route will indicate that
206
+ # calculation uses waypoints in the following waypoint order: ```
207
+ # "waypoint_order": [ 3, 2, 0, 1 ] ``` <div class="caution">Caution:
208
+ # Requests using waypoint optimization are billed at a higher rate. <a
209
+ # href="https://developers.google.com/maps/billing-and-pricing/pricing#direc
210
+ # tions-advanced">Learn more about how Google Maps Platform products are
211
+ # billed.</a></div>
212
+ # @param [Language] language Optional parameter: The language in which to
213
+ # return results. * See the [list of supported
214
+ # languages](https://developers.google.com/maps/faq#languagesupport). Google
215
+ # often updates the supported languages, so this list may not be exhaustive.
216
+ # * If `language` is not supplied, the API attempts to use the preferred
217
+ # language as specified in the `Accept-Language` header. * The API does its
218
+ # best to provide a street address that is readable for both the user and
219
+ # locals. To achieve that goal, it returns street addresses in the local
220
+ # language, transliterated to a script readable by the user if necessary,
221
+ # observing the preferred language. All other addresses are returned in the
222
+ # preferred language. Address components are all returned in the same
223
+ # language, which is chosen from the first component. * If a name is not
224
+ # available in the preferred language, the API uses the closest match. * The
225
+ # preferred language has a small influence on the set of results that the
226
+ # API chooses to return, and the order in which they are returned. The
227
+ # geocoder interprets abbreviations differently depending on language, such
228
+ # as the abbreviations for street types, or synonyms that may be valid in
229
+ # one language but not in another. For example, _utca_ and _tér_ are
230
+ # synonyms for street in Hungarian.
231
+ # @param [Mode] mode Optional parameter: For the calculation of distances
232
+ # and directions, you may specify the transportation mode to use. By
233
+ # default, `DRIVING` mode is used. By default, directions are calculated as
234
+ # driving directions. The following travel modes are supported: * `driving`
235
+ # (default) indicates standard driving directions or distance using the road
236
+ # network. * `walking` requests walking directions or distance via
237
+ # pedestrian paths & sidewalks (where available). * `bicycling` requests
238
+ # bicycling directions or distance via bicycle paths & preferred streets
239
+ # (where available). * `transit` requests directions or distance via public
240
+ # transit routes (where available). Transit trips are available for up to 7
241
+ # days in the past or 100 days in the future. If you set the mode to
242
+ # transit, you can optionally specify either a `departure_time` or an
243
+ # `arrival_time`. If neither time is specified, the `departure_time`
244
+ # defaults to now (that is, the departure time defaults to the current
245
+ # time). You can also optionally include a `transit_mode` and/or a
246
+ # `transit_routing_preference`. <div class="note">Note: Both walking and
247
+ # bicycling directions may sometimes not include clear pedestrian or
248
+ # bicycling paths, so these directions will return warnings in the returned
249
+ # result which you must display to the user.</div>
250
+ # @param [Region] region Optional parameter: The region code, specified as a
251
+ # [ccTLD ("top-level
252
+ # domain")](https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains
253
+ # #Country_code_top-level_domains) two-character value. Most ccTLD codes are
254
+ # identical to ISO 3166-1 codes, with some notable exceptions. For example,
255
+ # the United Kingdom's ccTLD is "uk" (.co.uk) while its ISO 3166-1 code is
256
+ # "gb" (technically for the entity of "The United Kingdom of Great Britain
257
+ # and Northern Ireland").
258
+ # @param [TrafficModel] traffic_model Optional parameter: Specifies the
259
+ # assumptions to use when calculating time in traffic. This setting affects
260
+ # the value returned in the duration_in_traffic field in the response, which
261
+ # contains the predicted time in traffic based on historical averages. The
262
+ # `traffic_model` parameter may only be specified for driving directions
263
+ # where the request includes a `departure_time`. The available values for
264
+ # this parameter are: * `best_guess` (default) indicates that the returned
265
+ # duration_in_traffic should be the best estimate of travel time given what
266
+ # is known about both historical traffic conditions and live traffic. Live
267
+ # traffic becomes more important the closer the `departure_time` is to now.
268
+ # * `pessimistic` indicates that the returned duration_in_traffic should be
269
+ # longer than the actual travel time on most days, though occasional days
270
+ # with particularly bad traffic conditions may exceed this value. *
271
+ # `optimistic` indicates that the returned duration_in_traffic should be
272
+ # shorter than the actual travel time on most days, though occasional days
273
+ # with particularly good traffic conditions may be faster than this value.
274
+ # The default value of `best_guess` will give the most useful predictions
275
+ # for the vast majority of use cases. It is possible the `best_guess` travel
276
+ # time prediction may be shorter than `optimistic`, or alternatively, longer
277
+ # than `pessimistic`, due to the way the `best_guess` prediction model
278
+ # integrates live traffic information.
279
+ # @param [String] transit_mode Optional parameter: Specifies one or more
280
+ # preferred modes of transit. This parameter may only be specified for
281
+ # transit directions. The parameter supports the following arguments: *
282
+ # `bus` indicates that the calculated route should prefer travel by bus. *
283
+ # `subway` indicates that the calculated route should prefer travel by
284
+ # subway. * `train` indicates that the calculated route should prefer travel
285
+ # by train. * `tram` indicates that the calculated route should prefer
286
+ # travel by tram and light rail. * `rail` indicates that the calculated
287
+ # route should prefer travel by train, tram, light rail, and subway. This is
288
+ # equivalent to `transit_mode=train|tram|subway`.
289
+ # @param [TransitRoutingPreference] transit_routing_preference Optional
290
+ # parameter: Specifies preferences for transit routes. Using this parameter,
291
+ # you can bias the options returned, rather than accepting the default best
292
+ # route chosen by the API. This parameter may only be specified for transit
293
+ # directions. The parameter supports the following arguments: *
294
+ # `less_walking` indicates that the calculated route should prefer limited
295
+ # amounts of walking. * `fewer_transfers` indicates that the calculated
296
+ # route should prefer a limited number of transfers.
297
+ # @return [ApiResponse] Complete http response with raw body and status code.
298
+ def directions(destination,
299
+ origin,
300
+ arrival_time: nil,
301
+ departure_time: nil,
302
+ alternatives: nil,
303
+ avoid: nil,
304
+ units: nil,
305
+ waypoints: nil,
306
+ language: Language::EN,
307
+ mode: nil,
308
+ region: Region::EN,
309
+ traffic_model: TrafficModel::BEST_GUESS,
310
+ transit_mode: nil,
311
+ transit_routing_preference: nil)
312
+ @api_call
313
+ .request(new_request_builder(HttpMethodEnum::GET,
314
+ '/maps/api/directions/json',
315
+ Server::DEFAULT)
316
+ .query_param(new_parameter(destination, key: 'destination')
317
+ .is_required(true))
318
+ .query_param(new_parameter(origin, key: 'origin')
319
+ .is_required(true))
320
+ .query_param(new_parameter(arrival_time, key: 'arrival_time'))
321
+ .query_param(new_parameter(departure_time, key: 'departure_time'))
322
+ .query_param(new_parameter(alternatives, key: 'alternatives'))
323
+ .query_param(new_parameter(avoid, key: 'avoid'))
324
+ .query_param(new_parameter(units, key: 'units'))
325
+ .query_param(new_parameter(waypoints, key: 'waypoints'))
326
+ .query_param(new_parameter(language, key: 'language'))
327
+ .query_param(new_parameter(mode, key: 'mode'))
328
+ .query_param(new_parameter(region, key: 'region'))
329
+ .query_param(new_parameter(traffic_model, key: 'traffic_model'))
330
+ .query_param(new_parameter(transit_mode, key: 'transit_mode'))
331
+ .query_param(new_parameter(transit_routing_preference, key: 'transit_routing_preference'))
332
+ .header_param(new_parameter('application/json', key: 'accept'))
333
+ .auth(Single.new('ApiKeyAuth')))
334
+ .response(new_response_handler
335
+ .deserializer(APIHelper.method(:custom_type_deserializer))
336
+ .deserialize_into(DirectionsResponse.method(:from_hash))
337
+ .is_api_response(true))
338
+ .execute
339
+ end
340
+ end
341
+ end
@@ -0,0 +1,224 @@
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
+ # DistanceMatrixApiController
8
+ class DistanceMatrixApiController < BaseController
9
+ # The Distance Matrix API is a service that provides travel distance and
10
+ # time for a matrix of origins and destinations. The API returns information
11
+ # based on the recommended route between start and end points, as calculated
12
+ # by the Google Maps API, and consists of rows containing duration and
13
+ # distance values for each pair.
14
+ # @param [Array[String]] destinations Required parameter: One or more
15
+ # locations to use as the finishing point for calculating travel distance
16
+ # and time. The options for the destinations parameter are the same as for
17
+ # the origins parameter.
18
+ # @param [Array[String]] origins Required parameter: The starting point for
19
+ # calculating travel distance and time. You can supply one or more locations
20
+ # separated by the pipe character (|), in the form of a place ID, an
21
+ # address, or latitude/longitude coordinates: - **Place ID**: If you supply
22
+ # a place ID, you must prefix it with `place_id:`. - **Address**: If you
23
+ # pass an address, the service geocodes the string and converts it to a
24
+ # latitude/longitude coordinate to calculate distance. This coordinate may
25
+ # be different from that returned by the Geocoding API, for example a
26
+ # building entrance rather than its center. <div class="note">Note: using
27
+ # place IDs is preferred over using addresses or latitude/longitude
28
+ # coordinates. Using coordinates will always result in the point being
29
+ # snapped to the road nearest to those coordinates - which may not be an
30
+ # access point to the property, or even a road that will quickly or safely
31
+ # lead to the destination. Using the address will provide the distance to
32
+ # the center of the building, as opposed to an entrance to the
33
+ # building.</div> - **Coordinates**: If you pass latitude/longitude
34
+ # coordinates, they they will snap to the nearest road. Passing a place ID
35
+ # is preferred. If you do pass coordinates, ensure that no space exists
36
+ # between the latitude and longitude values. - **Plus codes** must be
37
+ # formatted as a global code or a compound code. Format plus codes as shown
38
+ # here (plus signs are url-escaped to %2B and spaces are url-escaped to
39
+ # %20): - **global code** is a 4 character area code and 6 character or
40
+ # longer local code (`849VCWC8+R9` is encoded to `849VCWC8%2BR9`). -
41
+ # **compound code** is a 6 character or longer local code with an explicit
42
+ # location (`CWC8+R9 Mountain View, CA, USA` is encoded to
43
+ # `CWC8%2BR9%20Mountain%20View%20CA%20USA`). - **Encoded Polyline**
44
+ # Alternatively, you can supply an encoded set of coordinates using the
45
+ # [Encoded Polyline
46
+ # Algorithm](https://developers.google.com/maps/documentation/utilities/poly
47
+ # linealgorithm). This is particularly useful if you have a large number of
48
+ # origin points, because the URL is significantly shorter when using an
49
+ # encoded polyline. - Encoded polylines must be prefixed with `enc:` and
50
+ # followed by a colon `:`. For example: `origins=enc:gfo}EtohhU:` - You
51
+ # can also include multiple encoded polylines, separated by the pipe
52
+ # character `|`. For example: ```
53
+ # origins=enc:wc~oAwquwMdlTxiKtqLyiK:|enc:c~vnAamswMvlTor@tjGi}L:|enc:udymA{
54
+ # ~bxM: ```
55
+ # @param [Float] arrival_time Optional parameter: Specifies the desired time
56
+ # of arrival for transit directions, in seconds since midnight, January 1,
57
+ # 1970 UTC. You can specify either `departure_time` or `arrival_time`, but
58
+ # not both. Note that `arrival_time` must be specified as an integer.
59
+ # @param [Float] departure_time Optional parameter: Specifies the desired
60
+ # time of departure. You can specify the time as an integer in seconds since
61
+ # midnight, January 1, 1970 UTC. If a `departure_time` later than
62
+ # 9999-12-31T23:59:59.999999999Z is specified, the API will fall back the
63
+ # `departure_time` to 9999-12-31T23:59:59.999999999Z. Alternatively, you can
64
+ # specify a value of now, which sets the departure time to the current time
65
+ # (correct to the nearest second). The departure time may be specified in
66
+ # two cases: * For requests where the travel mode is transit: You can
67
+ # optionally specify one of `departure_time` or `arrival_time`. If neither
68
+ # time is specified, the `departure_time` defaults to now (that is, the
69
+ # departure time defaults to the current time). * For requests where the
70
+ # travel mode is driving: You can specify the `departure_time` to receive a
71
+ # route and trip duration (response field: duration_in_traffic) that take
72
+ # traffic conditions into account. The `departure_time` must be set to the
73
+ # current time or some time in the future. It cannot be in the past. <div
74
+ # class="note">Note: If departure time is not specified, choice of route and
75
+ # duration are based on road network and average time-independent traffic
76
+ # conditions. Results for a given request may vary over time due to changes
77
+ # in the road network, updated average traffic conditions, and the
78
+ # distributed nature of the service. Results may also vary between
79
+ # nearly-equivalent routes at any time or frequency.</div> <div
80
+ # class="note">Note: Distance Matrix requests specifying `departure_time`
81
+ # when `mode=driving` are limited to a maximum of 100 elements per request.
82
+ # The number of origins times the number of destinations defines the number
83
+ # of elements.</div>
84
+ # @param [String] avoid Optional parameter: Distances may be calculated that
85
+ # adhere to certain restrictions. Restrictions are indicated by use of the
86
+ # avoid parameter, and an argument to that parameter indicating the
87
+ # restriction to avoid. The following restrictions are supported: * `tolls`
88
+ # indicates that the calculated route should avoid toll roads/bridges. *
89
+ # `highways` indicates that the calculated route should avoid highways. *
90
+ # `ferries` indicates that the calculated route should avoid ferries. *
91
+ # `indoor` indicates that the calculated route should avoid indoor steps for
92
+ # walking and transit directions. <div class="note">Note: The addition of
93
+ # restrictions does not preclude routes that include the restricted feature;
94
+ # it biases the result to more favorable routes.</div>
95
+ # @param [Units] units Optional parameter: Specifies the unit system to use
96
+ # when displaying results. <div class="note">Note: this unit system setting
97
+ # only affects the text displayed within distance fields. The distance
98
+ # fields also contain values which are always expressed in meters.</div>
99
+ # @param [Language] language Optional parameter: The language in which to
100
+ # return results. * See the [list of supported
101
+ # languages](https://developers.google.com/maps/faq#languagesupport). Google
102
+ # often updates the supported languages, so this list may not be exhaustive.
103
+ # * If `language` is not supplied, the API attempts to use the preferred
104
+ # language as specified in the `Accept-Language` header. * The API does its
105
+ # best to provide a street address that is readable for both the user and
106
+ # locals. To achieve that goal, it returns street addresses in the local
107
+ # language, transliterated to a script readable by the user if necessary,
108
+ # observing the preferred language. All other addresses are returned in the
109
+ # preferred language. Address components are all returned in the same
110
+ # language, which is chosen from the first component. * If a name is not
111
+ # available in the preferred language, the API uses the closest match. * The
112
+ # preferred language has a small influence on the set of results that the
113
+ # API chooses to return, and the order in which they are returned. The
114
+ # geocoder interprets abbreviations differently depending on language, such
115
+ # as the abbreviations for street types, or synonyms that may be valid in
116
+ # one language but not in another. For example, _utca_ and _tér_ are
117
+ # synonyms for street in Hungarian.
118
+ # @param [Mode] mode Optional parameter: For the calculation of distances
119
+ # and directions, you may specify the transportation mode to use. By
120
+ # default, `DRIVING` mode is used. By default, directions are calculated as
121
+ # driving directions. The following travel modes are supported: * `driving`
122
+ # (default) indicates standard driving directions or distance using the road
123
+ # network. * `walking` requests walking directions or distance via
124
+ # pedestrian paths & sidewalks (where available). * `bicycling` requests
125
+ # bicycling directions or distance via bicycle paths & preferred streets
126
+ # (where available). * `transit` requests directions or distance via public
127
+ # transit routes (where available). Transit trips are available for up to 7
128
+ # days in the past or 100 days in the future. If you set the mode to
129
+ # transit, you can optionally specify either a `departure_time` or an
130
+ # `arrival_time`. If neither time is specified, the `departure_time`
131
+ # defaults to now (that is, the departure time defaults to the current
132
+ # time). You can also optionally include a `transit_mode` and/or a
133
+ # `transit_routing_preference`. <div class="note">Note: Both walking and
134
+ # bicycling directions may sometimes not include clear pedestrian or
135
+ # bicycling paths, so these directions will return warnings in the returned
136
+ # result which you must display to the user.</div>
137
+ # @param [Region] region Optional parameter: The region code, specified as a
138
+ # [ccTLD ("top-level
139
+ # domain")](https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains
140
+ # #Country_code_top-level_domains) two-character value. Most ccTLD codes are
141
+ # identical to ISO 3166-1 codes, with some notable exceptions. For example,
142
+ # the United Kingdom's ccTLD is "uk" (.co.uk) while its ISO 3166-1 code is
143
+ # "gb" (technically for the entity of "The United Kingdom of Great Britain
144
+ # and Northern Ireland").
145
+ # @param [TrafficModel] traffic_model Optional parameter: Specifies the
146
+ # assumptions to use when calculating time in traffic. This setting affects
147
+ # the value returned in the duration_in_traffic field in the response, which
148
+ # contains the predicted time in traffic based on historical averages. The
149
+ # `traffic_model` parameter may only be specified for driving directions
150
+ # where the request includes a `departure_time`. The available values for
151
+ # this parameter are: * `best_guess` (default) indicates that the returned
152
+ # duration_in_traffic should be the best estimate of travel time given what
153
+ # is known about both historical traffic conditions and live traffic. Live
154
+ # traffic becomes more important the closer the `departure_time` is to now.
155
+ # * `pessimistic` indicates that the returned duration_in_traffic should be
156
+ # longer than the actual travel time on most days, though occasional days
157
+ # with particularly bad traffic conditions may exceed this value. *
158
+ # `optimistic` indicates that the returned duration_in_traffic should be
159
+ # shorter than the actual travel time on most days, though occasional days
160
+ # with particularly good traffic conditions may be faster than this value.
161
+ # The default value of `best_guess` will give the most useful predictions
162
+ # for the vast majority of use cases. It is possible the `best_guess` travel
163
+ # time prediction may be shorter than `optimistic`, or alternatively, longer
164
+ # than `pessimistic`, due to the way the `best_guess` prediction model
165
+ # integrates live traffic information.
166
+ # @param [String] transit_mode Optional parameter: Specifies one or more
167
+ # preferred modes of transit. This parameter may only be specified for
168
+ # transit directions. The parameter supports the following arguments: *
169
+ # `bus` indicates that the calculated route should prefer travel by bus. *
170
+ # `subway` indicates that the calculated route should prefer travel by
171
+ # subway. * `train` indicates that the calculated route should prefer travel
172
+ # by train. * `tram` indicates that the calculated route should prefer
173
+ # travel by tram and light rail. * `rail` indicates that the calculated
174
+ # route should prefer travel by train, tram, light rail, and subway. This is
175
+ # equivalent to `transit_mode=train|tram|subway`.
176
+ # @param [TransitRoutingPreference] transit_routing_preference Optional
177
+ # parameter: Specifies preferences for transit routes. Using this parameter,
178
+ # you can bias the options returned, rather than accepting the default best
179
+ # route chosen by the API. This parameter may only be specified for transit
180
+ # directions. The parameter supports the following arguments: *
181
+ # `less_walking` indicates that the calculated route should prefer limited
182
+ # amounts of walking. * `fewer_transfers` indicates that the calculated
183
+ # route should prefer a limited number of transfers.
184
+ # @return [ApiResponse] Complete http response with raw body and status code.
185
+ def distance_matrix(destinations,
186
+ origins,
187
+ arrival_time: nil,
188
+ departure_time: nil,
189
+ avoid: nil,
190
+ units: nil,
191
+ language: Language::EN,
192
+ mode: nil,
193
+ region: Region::EN,
194
+ traffic_model: TrafficModel::BEST_GUESS,
195
+ transit_mode: nil,
196
+ transit_routing_preference: nil)
197
+ @api_call
198
+ .request(new_request_builder(HttpMethodEnum::GET,
199
+ '/maps/api/distancematrix/json',
200
+ Server::DEFAULT)
201
+ .query_param(new_parameter(destinations, key: 'destinations')
202
+ .is_required(true))
203
+ .query_param(new_parameter(origins, key: 'origins')
204
+ .is_required(true))
205
+ .query_param(new_parameter(arrival_time, key: 'arrival_time'))
206
+ .query_param(new_parameter(departure_time, key: 'departure_time'))
207
+ .query_param(new_parameter(avoid, key: 'avoid'))
208
+ .query_param(new_parameter(units, key: 'units'))
209
+ .query_param(new_parameter(language, key: 'language'))
210
+ .query_param(new_parameter(mode, key: 'mode'))
211
+ .query_param(new_parameter(region, key: 'region'))
212
+ .query_param(new_parameter(traffic_model, key: 'traffic_model'))
213
+ .query_param(new_parameter(transit_mode, key: 'transit_mode'))
214
+ .query_param(new_parameter(transit_routing_preference, key: 'transit_routing_preference'))
215
+ .header_param(new_parameter('application/json', key: 'accept'))
216
+ .auth(Single.new('ApiKeyAuth')))
217
+ .response(new_response_handler
218
+ .deserializer(APIHelper.method(:custom_type_deserializer))
219
+ .deserialize_into(DistanceMatrixResponse.method(:from_hash))
220
+ .is_api_response(true))
221
+ .execute
222
+ end
223
+ end
224
+ end
@@ -0,0 +1,71 @@
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
+ # ElevationApiController
8
+ class ElevationApiController < BaseController
9
+ # The Elevation API provides a simple interface to query locations on the
10
+ # earth for elevation data. Additionally, you may request sampled elevation
11
+ # data along paths, allowing you to calculate elevation changes along
12
+ # routes. With the Elevation API, you can develop hiking and biking
13
+ # applications, positioning applications, or low resolution surveying
14
+ # applications.
15
+ # Elevation data is available for all locations on the surface of the earth,
16
+ # including depth locations on the ocean floor (which return negative
17
+ # values). In those cases where Google does not possess exact elevation
18
+ # measurements at the precise location you request, the service interpolates
19
+ # and returns an averaged value using the four nearest locations. Elevation
20
+ # values are expressed relative to local mean sea level (LMSL).
21
+ # Requests to the Elevation API utilize different parameters based on
22
+ # whether the request is for discrete locations or for an ordered path. For
23
+ # discrete locations, requests for elevation return data on the specific
24
+ # locations passed in the request; for paths, elevation requests are instead
25
+ # sampled along the given path.
26
+ # @param [Array[String]] locations Optional parameter: Positional requests
27
+ # are indicated through use of the locations parameter, indicating elevation
28
+ # requests for the specific locations passed as latitude/longitude values.
29
+ # The locations parameter may take the following arguments: - A single
30
+ # coordinate: `locations=40.714728,-73.998672` - An array of coordinates
31
+ # separated using the pipe ('|') character: ```
32
+ # locations=40.714728,-73.998672|-34.397,150.644 ``` - A set of encoded
33
+ # coordinates using the [Encoded Polyline
34
+ # Algorithm](https://developers.google.com/maps/documentation/utilities/poly
35
+ # linealgorithm): ``` locations=enc:gfo}EtohhU ``` Latitude and
36
+ # longitude coordinate strings are defined using numerals within a
37
+ # comma-separated text string. For example, "40.714728,-73.998672" is a
38
+ # valid locations value. Latitude and longitude values must correspond to a
39
+ # valid location on the face of the earth. Latitudes can take any value
40
+ # between -90 and 90 while longitude values can take any value between -180
41
+ # and 180. If you specify an invalid latitude or longitude value, your
42
+ # request will be rejected as a bad request. You may pass any number of
43
+ # multiple coordinates within an array or encoded polyline, while still
44
+ # constructing a valid URL. Note that when passing multiple coordinates, the
45
+ # accuracy of any returned data may be of lower resolution than when
46
+ # requesting data for a single coordinate.
47
+ # @param [Array[String]] path Optional parameter: An array of comma
48
+ # separated `latitude,longitude` strings.
49
+ # @param [Float] samples Optional parameter: Required if path parameter is
50
+ # set.
51
+ # @return [ApiResponse] Complete http response with raw body and status code.
52
+ def elevation(locations: nil,
53
+ path: nil,
54
+ samples: nil)
55
+ @api_call
56
+ .request(new_request_builder(HttpMethodEnum::GET,
57
+ '/maps/api/elevation/json',
58
+ Server::DEFAULT)
59
+ .query_param(new_parameter(locations, key: 'locations'))
60
+ .query_param(new_parameter(path, key: 'path'))
61
+ .query_param(new_parameter(samples, key: 'samples'))
62
+ .header_param(new_parameter('application/json', key: 'accept'))
63
+ .auth(Single.new('ApiKeyAuth')))
64
+ .response(new_response_handler
65
+ .deserializer(APIHelper.method(:custom_type_deserializer))
66
+ .deserialize_into(MapsApiElevationJsonResponse.method(:from_hash))
67
+ .is_api_response(true))
68
+ .execute
69
+ end
70
+ end
71
+ end