google-maps-platform-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/apis/base_api.rb +67 -0
  7. data/lib/google_maps_platform/apis/directions_api.rb +341 -0
  8. data/lib/google_maps_platform/apis/distance_matrix_api.rb +224 -0
  9. data/lib/google_maps_platform/apis/elevation_api.rb +71 -0
  10. data/lib/google_maps_platform/apis/geocoding_api.rb +214 -0
  11. data/lib/google_maps_platform/apis/geolocation_api.rb +46 -0
  12. data/lib/google_maps_platform/apis/places_api.rb +866 -0
  13. data/lib/google_maps_platform/apis/roads_api.rb +81 -0
  14. data/lib/google_maps_platform/apis/street_view_api.rb +198 -0
  15. data/lib/google_maps_platform/apis/time_zone_api.rb +65 -0
  16. data/lib/google_maps_platform/client.rb +123 -0
  17. data/lib/google_maps_platform/configuration.rb +181 -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 +153 -0
  127. metadata +211 -0
@@ -0,0 +1,81 @@
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
+ # RoadsApi
8
+ class RoadsApi < BaseApi
9
+ # This service returns the best-fit road geometry for a given set of GPS
10
+ # coordinates. This service takes up to 100 GPS points collected along a
11
+ # route, and returns a similar set of data with the points snapped to the
12
+ # most likely roads the vehicle was traveling along. Optionally, you can
13
+ # request that the points be interpolated, resulting in a path that smoothly
14
+ # follows the geometry of the road.
15
+ # @param [Array[String]] path Required parameter: The path to be snapped.
16
+ # The path parameter accepts a list of latitude/longitude pairs. Latitude
17
+ # and longitude values should be separated by commas. Coordinates should be
18
+ # separated by the pipe character: "|". For example:
19
+ # `path=60.170880,24.942795|60.170879,24.942796|60.170877,24.942796`. <div
20
+ # class="note">Note: The snapping algorithm works best for points that are
21
+ # not too far apart. If you observe odd snapping behavior, try creating
22
+ # paths that have points closer together. To ensure the best snap-to-road
23
+ # quality, you should aim to provide paths on which consecutive pairs of
24
+ # points are within 300m of each other. This will also help in handling any
25
+ # isolated, long jumps between consecutive points caused by GPS signal loss,
26
+ # or noise.</div>
27
+ # @param [TrueClass | FalseClass] interpolate Optional parameter: Whether to
28
+ # interpolate a path to include all points forming the full road-geometry.
29
+ # When true, additional interpolated points will also be returned, resulting
30
+ # in a path that smoothly follows the geometry of the road, even around
31
+ # corners and through tunnels. Interpolated paths will most likely contain
32
+ # more points than the original path. Defaults to `false`.
33
+ # @return [ApiResponse] Complete http response with raw body and status code.
34
+ def snap_to_roads(path,
35
+ interpolate: nil)
36
+ @api_call
37
+ .request(new_request_builder(HttpMethodEnum::GET,
38
+ '/v1/snaptoroads',
39
+ Server::DEFAULT)
40
+ .query_param(new_parameter(path, key: 'path')
41
+ .is_required(true))
42
+ .query_param(new_parameter(interpolate, key: 'interpolate'))
43
+ .header_param(new_parameter('application/json', key: 'accept'))
44
+ .auth(Single.new('ApiKeyAuth')))
45
+ .response(new_response_handler
46
+ .deserializer(APIHelper.method(:custom_type_deserializer))
47
+ .deserialize_into(SnapToRoadsResponse.method(:from_hash))
48
+ .is_api_response(true))
49
+ .execute
50
+ end
51
+
52
+ # This service returns individual road segments for a given set of GPS
53
+ # coordinates. This services takes up to 100 GPS points and returns the
54
+ # closest road segments for each point. The points passed do not need to be
55
+ # part of a continuous path.
56
+ # @param [Array[String]] points Required parameter: The points to be
57
+ # snapped. The points parameter accepts a list of latitude/longitude pairs.
58
+ # Separate latitude and longitude values with commas. Separate coordinates
59
+ # with the pipe character: "|". For example:
60
+ # `points=60.170880,24.942795|60.170879,24.942796|60.170877,24.942796`.
61
+ # @return [ApiResponse] Complete http response with raw body and status code.
62
+ def nearest_roads(points)
63
+ @api_call
64
+ .request(new_request_builder(HttpMethodEnum::GET,
65
+ '/v1/nearestRoads',
66
+ Server::DEFAULT)
67
+ .query_param(new_parameter(points, key: 'points')
68
+ .is_required(true))
69
+ .header_param(new_parameter('application/json', key: 'accept'))
70
+ .auth(Single.new('ApiKeyAuth')))
71
+ .response(new_response_handler
72
+ .deserializer(APIHelper.method(:custom_type_deserializer))
73
+ .deserialize_into(NearestRoadsResponse.method(:from_hash))
74
+ .is_api_response(true)
75
+ .local_error('400',
76
+ '400 BAD REQUEST',
77
+ NearestRoadsErrorResponseException))
78
+ .execute
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,198 @@
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
+ # StreetViewApi
8
+ class StreetViewApi < BaseApi
9
+ # The Street View Static API lets you embed a static (non-interactive)
10
+ # Street View panorama or thumbnail into your web page, without the use of
11
+ # JavaScript. The viewport is defined with URL parameters sent through a
12
+ # standard HTTP request, and is returned as a static image.
13
+ # @param [String] size Required parameter: Specifies the output size of the
14
+ # image in pixels. Must not exceed 640 pixels wide or high, anything over
15
+ # will default to 640 pixels. Size is specified as `{width}x{height}` - for
16
+ # example, `size=600x400` returns an image 600 pixels wide, and 400 high.
17
+ # @param [Float] fov Optional parameter: Determines the horizontal field of
18
+ # view of the image. The field of view is expressed in degrees, with a
19
+ # maximum allowed value of 120. When dealing with a fixed-size viewport, as
20
+ # with a Street View image of a set size, field of view in essence
21
+ # represents zoom, with smaller numbers indicating a higher level of zoom.
22
+ # Default is 90.
23
+ # @param [Float] heading Optional parameter: Indicates the compass heading
24
+ # of the camera. Accepted values are from 0 to 360 (both values indicating
25
+ # North, with 90 indicating East, and 180 South). If no heading is
26
+ # specified, a value will be calculated that directs the camera towards the
27
+ # specified location, from the point at which the closest photograph was
28
+ # taken.
29
+ # @param [String] location Optional parameter: The point around which to
30
+ # retrieve place information. The Street View Static API will snap to the
31
+ # panorama photographed closest to this location. When an address text
32
+ # string is provided, the API may use a different camera location to better
33
+ # display the specified location. When a lat/lng is provided, the API
34
+ # searches a 50 meter radius for a photograph closest to this location.
35
+ # Because Street View imagery is periodically refreshed, and photographs may
36
+ # be taken from slightly different positions each time, it's possible that
37
+ # your `location` may snap to a different panorama when imagery is
38
+ # updated.
39
+ # @param [String] pano Optional parameter: A specific panorama ID. These are
40
+ # generally stable, though panoramas may change ID over time as imagery is
41
+ # refreshed.
42
+ # @param [Float] pitch Optional parameter: Specifies the up or down angle of
43
+ # the camera relative to the Street View vehicle. This is often, but not
44
+ # always, flat horizontal. Positive values angle the camera up (with 90
45
+ # degrees indicating straight up); negative values angle the camera down
46
+ # (with -90 indicating straight down). Default is 0.
47
+ # @param [Float] radius Optional parameter: Sets a radius, specified in
48
+ # meters, in which to search for a panorama, centered on the given latitude
49
+ # and longitude. Valid values are non-negative integers. Default is 50
50
+ # meters.
51
+ # @param [TrueClass | FalseClass] return_error_code Optional parameter:
52
+ # Indicates whether the API should return a non `200 Ok` HTTP status when no
53
+ # image is found (`404 NOT FOUND`), or in response to an invalid request
54
+ # (400 BAD REQUEST). Valid values are `true` and `false`. If set to `true`,
55
+ # an error message is returned in place of the generic gray image. This
56
+ # eliminates the need to make a separate call to check for image
57
+ # availability.
58
+ # @param [String] signature Optional parameter: A digital signature used to
59
+ # verify that any site generating requests using your API key is authorized
60
+ # to do so. Requests that do not include a digital signature might fail. For
61
+ # more information, see [Get a Key and
62
+ # Signature](https://developers.google.com/maps/documentation/streetview/get
63
+ # -api-key).
64
+ # @param [Source] source Optional parameter: Limits Street View searches to
65
+ # selected sources. Valid values are: * `default` uses the default sources
66
+ # for Street View; searches are not limited to specific sources. * `outdoor`
67
+ # limits searches to outdoor collections. Indoor collections are not
68
+ # included in search results. Note that outdoor panoramas may not exist for
69
+ # the specified location. Also note that the search only returns panoramas
70
+ # where it's possible to determine whether they're indoors or outdoors. For
71
+ # example, PhotoSpheres are not returned because it's unknown whether they
72
+ # are indoors or outdoors.
73
+ # @return [ApiResponse] Complete http response with raw body and status code.
74
+ def street_view(size,
75
+ fov: nil,
76
+ heading: nil,
77
+ location: nil,
78
+ pano: nil,
79
+ pitch: nil,
80
+ radius: nil,
81
+ return_error_code: nil,
82
+ signature: nil,
83
+ source: nil)
84
+ @api_call
85
+ .request(new_request_builder(HttpMethodEnum::GET,
86
+ '/maps/api/streetview',
87
+ Server::DEFAULT)
88
+ .query_param(new_parameter(size, key: 'size')
89
+ .is_required(true))
90
+ .query_param(new_parameter(fov, key: 'fov'))
91
+ .query_param(new_parameter(heading, key: 'heading'))
92
+ .query_param(new_parameter(location, key: 'location'))
93
+ .query_param(new_parameter(pano, key: 'pano'))
94
+ .query_param(new_parameter(pitch, key: 'pitch'))
95
+ .query_param(new_parameter(radius, key: 'radius'))
96
+ .query_param(new_parameter(return_error_code, key: 'return_error_code'))
97
+ .query_param(new_parameter(signature, key: 'signature'))
98
+ .query_param(new_parameter(source, key: 'source'))
99
+ .header_param(new_parameter('application/json', key: 'accept'))
100
+ .auth(Single.new('ApiKeyAuth')))
101
+ .response(new_response_handler
102
+ .deserializer(APIHelper.method(:dynamic_deserializer))
103
+ .is_api_response(true))
104
+ .execute
105
+ end
106
+
107
+ # The Street View Static API metadata requests provide data about Street
108
+ # View panoramas. Using the metadata, you can find out if a Street View
109
+ # image is available at a given location, as well as getting programmatic
110
+ # access to the latitude and longitude, the panorama ID, the date the photo
111
+ # was taken, and the copyright information for the image. Accessing this
112
+ # metadata allows you to customize error behavior in your application.
113
+ # @param [Float] heading Optional parameter: Indicates the compass heading
114
+ # of the camera. Accepted values are from 0 to 360 (both values indicating
115
+ # North, with 90 indicating East, and 180 South). If no heading is
116
+ # specified, a value will be calculated that directs the camera towards the
117
+ # specified location, from the point at which the closest photograph was
118
+ # taken.
119
+ # @param [String] location Optional parameter: The point around which to
120
+ # retrieve place information. The Street View Static API will snap to the
121
+ # panorama photographed closest to this location. When an address text
122
+ # string is provided, the API may use a different camera location to better
123
+ # display the specified location. When a lat/lng is provided, the API
124
+ # searches a 50 meter radius for a photograph closest to this location.
125
+ # Because Street View imagery is periodically refreshed, and photographs may
126
+ # be taken from slightly different positions each time, it's possible that
127
+ # your `location` may snap to a different panorama when imagery is
128
+ # updated.
129
+ # @param [String] pano Optional parameter: A specific panorama ID. These are
130
+ # generally stable, though panoramas may change ID over time as imagery is
131
+ # refreshed.
132
+ # @param [Float] pitch Optional parameter: Specifies the up or down angle of
133
+ # the camera relative to the Street View vehicle. This is often, but not
134
+ # always, flat horizontal. Positive values angle the camera up (with 90
135
+ # degrees indicating straight up); negative values angle the camera down
136
+ # (with -90 indicating straight down). Default is 0.
137
+ # @param [Float] radius Optional parameter: Sets a radius, specified in
138
+ # meters, in which to search for a panorama, centered on the given latitude
139
+ # and longitude. Valid values are non-negative integers. Default is 50
140
+ # meters.
141
+ # @param [TrueClass | FalseClass] return_error_code Optional parameter:
142
+ # Indicates whether the API should return a non `200 Ok` HTTP status when no
143
+ # image is found (`404 NOT FOUND`), or in response to an invalid request
144
+ # (400 BAD REQUEST). Valid values are `true` and `false`. If set to `true`,
145
+ # an error message is returned in place of the generic gray image. This
146
+ # eliminates the need to make a separate call to check for image
147
+ # availability.
148
+ # @param [String] signature Optional parameter: A digital signature used to
149
+ # verify that any site generating requests using your API key is authorized
150
+ # to do so. Requests that do not include a digital signature might fail. For
151
+ # more information, see [Get a Key and
152
+ # Signature](https://developers.google.com/maps/documentation/streetview/get
153
+ # -api-key).
154
+ # @param [String] size Optional parameter: Specifies the output size of the
155
+ # image in pixels. Size is specified as `{width}x{height}` - for example,
156
+ # `size=600x400` returns an image 600 pixels wide, and 400 high.
157
+ # @param [Source] source Optional parameter: Limits Street View searches to
158
+ # selected sources. Valid values are: * `default` uses the default sources
159
+ # for Street View; searches are not limited to specific sources. * `outdoor`
160
+ # limits searches to outdoor collections. Indoor collections are not
161
+ # included in search results. Note that outdoor panoramas may not exist for
162
+ # the specified location. Also note that the search only returns panoramas
163
+ # where it's possible to determine whether they're indoors or outdoors. For
164
+ # example, PhotoSpheres are not returned because it's unknown whether they
165
+ # are indoors or outdoors.
166
+ # @return [ApiResponse] Complete http response with raw body and status code.
167
+ def street_view_metadata(heading: nil,
168
+ location: nil,
169
+ pano: nil,
170
+ pitch: nil,
171
+ radius: nil,
172
+ return_error_code: nil,
173
+ signature: nil,
174
+ size: nil,
175
+ source: nil)
176
+ @api_call
177
+ .request(new_request_builder(HttpMethodEnum::GET,
178
+ '/maps/api/streetview/metadata',
179
+ Server::DEFAULT)
180
+ .query_param(new_parameter(heading, key: 'heading'))
181
+ .query_param(new_parameter(location, key: 'location'))
182
+ .query_param(new_parameter(pano, key: 'pano'))
183
+ .query_param(new_parameter(pitch, key: 'pitch'))
184
+ .query_param(new_parameter(radius, key: 'radius'))
185
+ .query_param(new_parameter(return_error_code, key: 'return_error_code'))
186
+ .query_param(new_parameter(signature, key: 'signature'))
187
+ .query_param(new_parameter(size, key: 'size'))
188
+ .query_param(new_parameter(source, key: 'source'))
189
+ .header_param(new_parameter('application/json', key: 'accept'))
190
+ .auth(Single.new('ApiKeyAuth')))
191
+ .response(new_response_handler
192
+ .deserializer(APIHelper.method(:custom_type_deserializer))
193
+ .deserialize_into(StreetViewResponse.method(:from_hash))
194
+ .is_api_response(true))
195
+ .execute
196
+ end
197
+ end
198
+ end
@@ -0,0 +1,65 @@
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
+ # TimeZoneApi
8
+ class TimeZoneApi < BaseApi
9
+ # The Time Zone API provides a simple interface to request the time zone for
10
+ # locations on the surface of the earth, as well as the time offset from UTC
11
+ # for each of those locations. You request the time zone information for a
12
+ # specific latitude/longitude pair and date. The API returns the name of
13
+ # that time zone, the time offset from UTC, and the daylight savings offset.
14
+ # @param [String] location Required parameter: A comma-separated
15
+ # latitude,longitude tuple, `location=39.6034810,-119.6822510`, representing
16
+ # the location to look up.
17
+ # @param [Float] timestamp Required parameter: The desired time as seconds
18
+ # since midnight, January 1, 1970 UTC. The Time Zone API uses the
19
+ # `timestamp` to determine whether or not Daylight Savings should be
20
+ # applied, based on the time zone of the `location`. Note that the API
21
+ # does not take historical time zones into account. That is, if you specify
22
+ # a past timestamp, the API does not take into account the possibility that
23
+ # the location was previously in a different time zone.
24
+ # @param [Language] language Optional parameter: The language in which to
25
+ # return results. * See the [list of supported
26
+ # languages](https://developers.google.com/maps/faq#languagesupport). Google
27
+ # often updates the supported languages, so this list may not be exhaustive.
28
+ # * If `language` is not supplied, the API attempts to use the preferred
29
+ # language as specified in the `Accept-Language` header. * The API does its
30
+ # best to provide a street address that is readable for both the user and
31
+ # locals. To achieve that goal, it returns street addresses in the local
32
+ # language, transliterated to a script readable by the user if necessary,
33
+ # observing the preferred language. All other addresses are returned in the
34
+ # preferred language. Address components are all returned in the same
35
+ # language, which is chosen from the first component. * If a name is not
36
+ # available in the preferred language, the API uses the closest match. * The
37
+ # preferred language has a small influence on the set of results that the
38
+ # API chooses to return, and the order in which they are returned. The
39
+ # geocoder interprets abbreviations differently depending on language, such
40
+ # as the abbreviations for street types, or synonyms that may be valid in
41
+ # one language but not in another. For example, _utca_ and _tér_ are
42
+ # synonyms for street in Hungarian.
43
+ # @return [ApiResponse] Complete http response with raw body and status code.
44
+ def timezone(location,
45
+ timestamp,
46
+ language: Language::EN)
47
+ @api_call
48
+ .request(new_request_builder(HttpMethodEnum::GET,
49
+ '/maps/api/timezone/json',
50
+ Server::DEFAULT)
51
+ .query_param(new_parameter(location, key: 'location')
52
+ .is_required(true))
53
+ .query_param(new_parameter(timestamp, key: 'timestamp')
54
+ .is_required(true))
55
+ .query_param(new_parameter(language, key: 'language'))
56
+ .header_param(new_parameter('application/json', key: 'accept'))
57
+ .auth(Single.new('ApiKeyAuth')))
58
+ .response(new_response_handler
59
+ .deserializer(APIHelper.method(:custom_type_deserializer))
60
+ .deserialize_into(TimeZoneResponse.method(:from_hash))
61
+ .is_api_response(true))
62
+ .execute
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,123 @@
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
+ # google_maps_platform client class.
8
+ class Client
9
+ include CoreLibrary
10
+ attr_reader :config, :auth_managers
11
+
12
+ def user_agent_detail
13
+ config.user_agent_detail
14
+ end
15
+
16
+ # Access to geolocation_api controller.
17
+ # @return [GeolocationApi] Returns the controller instance.
18
+ def geolocation_api
19
+ @geolocation_api ||= GeolocationApi.new @global_configuration
20
+ end
21
+
22
+ # Access to directions_api controller.
23
+ # @return [DirectionsApi] Returns the controller instance.
24
+ def directions_api
25
+ @directions_api ||= DirectionsApi.new @global_configuration
26
+ end
27
+
28
+ # Access to elevation_api controller.
29
+ # @return [ElevationApi] Returns the controller instance.
30
+ def elevation_api
31
+ @elevation_api ||= ElevationApi.new @global_configuration
32
+ end
33
+
34
+ # Access to geocoding_api controller.
35
+ # @return [GeocodingApi] Returns the controller instance.
36
+ def geocoding_api
37
+ @geocoding_api ||= GeocodingApi.new @global_configuration
38
+ end
39
+
40
+ # Access to time_zone_api controller.
41
+ # @return [TimeZoneApi] Returns the controller instance.
42
+ def time_zone_api
43
+ @time_zone_api ||= TimeZoneApi.new @global_configuration
44
+ end
45
+
46
+ # Access to roads_api controller.
47
+ # @return [RoadsApi] Returns the controller instance.
48
+ def roads_api
49
+ @roads_api ||= RoadsApi.new @global_configuration
50
+ end
51
+
52
+ # Access to distance_matrix_api controller.
53
+ # @return [DistanceMatrixApi] Returns the controller instance.
54
+ def distance_matrix_api
55
+ @distance_matrix_api ||= DistanceMatrixApi.new @global_configuration
56
+ end
57
+
58
+ # Access to places_api controller.
59
+ # @return [PlacesApi] Returns the controller instance.
60
+ def places_api
61
+ @places_api ||= PlacesApi.new @global_configuration
62
+ end
63
+
64
+ # Access to street_view_api controller.
65
+ # @return [StreetViewApi] Returns the controller instance.
66
+ def street_view_api
67
+ @street_view_api ||= StreetViewApi.new @global_configuration
68
+ end
69
+
70
+ def initialize(
71
+ connection: nil, adapter: :net_http_persistent, timeout: 30,
72
+ max_retries: 0, retry_interval: 1, backoff_factor: 2,
73
+ retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
74
+ retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
75
+ logging_configuration: nil, environment: Environment::PRODUCTION,
76
+ custom_query_authentication_credentials: nil, config: nil
77
+ )
78
+ @config = if config.nil?
79
+ Configuration.new(
80
+ connection: connection, adapter: adapter, timeout: timeout,
81
+ max_retries: max_retries, retry_interval: retry_interval,
82
+ backoff_factor: backoff_factor,
83
+ retry_statuses: retry_statuses,
84
+ retry_methods: retry_methods, http_callback: http_callback,
85
+ proxy_settings: proxy_settings,
86
+ logging_configuration: logging_configuration,
87
+ environment: environment,
88
+ custom_query_authentication_credentials: custom_query_authentication_credentials
89
+ )
90
+ else
91
+ config
92
+ end
93
+ user_agent_params = BaseApi.user_agent_parameters
94
+
95
+ @global_configuration = GlobalConfiguration.new(client_configuration: @config)
96
+ .base_uri_executor(@config.method(:get_base_uri))
97
+ .global_errors(BaseApi::GLOBAL_ERRORS)
98
+ .user_agent(BaseApi.user_agent,
99
+ agent_parameters: user_agent_params)
100
+
101
+ initialize_auth_managers(@global_configuration)
102
+ @global_configuration = @global_configuration.auth_managers(@auth_managers)
103
+ end
104
+
105
+ # Initializes the auth managers hash used for authenticating API calls.
106
+ # @param [GlobalConfiguration] global_config The global configuration of the SDK)
107
+ def initialize_auth_managers(global_config)
108
+ @auth_managers = {}
109
+ http_client_config = global_config.client_configuration
110
+ %w[ApiKeyAuth].each { |auth| @auth_managers[auth] = nil }
111
+ @auth_managers['ApiKeyAuth'] = CustomQueryAuthentication.new(
112
+ http_client_config.custom_query_authentication_credentials
113
+ )
114
+ end
115
+
116
+ # Creates a client directly from environment variables.
117
+ def self.from_env(**overrides)
118
+ default_config = Configuration.build_default_config_from_env
119
+ new_config = default_config.clone_with(**overrides)
120
+ new(config: new_config)
121
+ end
122
+ end
123
+ end
@@ -0,0 +1,181 @@
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
+ # An enum for SDK environments.
8
+ class Environment
9
+ ENVIRONMENT = [
10
+ PRODUCTION = 'production'.freeze,
11
+ ENVIRONMENT2 = 'environment2'.freeze,
12
+ ENVIRONMENT3 = 'environment3'.freeze
13
+ ].freeze
14
+
15
+ # Converts a string or symbol into a valid Environment constant.
16
+ def self.from_value(value, default_value = PRODUCTION)
17
+ return default_value if value.nil?
18
+
19
+ str = value.to_s.strip.downcase
20
+ case str
21
+ when 'production' then PRODUCTION
22
+ when 'environment2' then ENVIRONMENT2
23
+ when 'environment3' then ENVIRONMENT3
24
+
25
+ else
26
+ warn "[Environment] Unknown environment '#{value}', falling back to #{default_value} "
27
+ default_value
28
+ end
29
+ end
30
+ end
31
+
32
+ # An enum for API servers.
33
+ class Server
34
+ SERVER = [
35
+ DEFAULT = 'default'.freeze
36
+ ].freeze
37
+
38
+ # Converts a string or symbol into a valid Server constant.
39
+ def self.from_value(value, default_value = DEFAULT)
40
+ return default_value if value.nil?
41
+
42
+ default_value
43
+ end
44
+ end
45
+
46
+ # All configuration including auth info and base URI for the API access
47
+ # are configured in this class.
48
+ class Configuration < CoreLibrary::HttpClientConfiguration
49
+ # The attribute readers for properties.
50
+ attr_reader :environment, :custom_query_authentication_credentials
51
+
52
+ class << self
53
+ attr_reader :environments
54
+ end
55
+
56
+ def initialize(
57
+ connection: nil, adapter: :net_http_persistent, timeout: 30,
58
+ max_retries: 0, retry_interval: 1, backoff_factor: 2,
59
+ retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
60
+ retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
61
+ logging_configuration: nil, environment: Environment::PRODUCTION,
62
+ custom_query_authentication_credentials: nil
63
+ )
64
+ super connection: connection, adapter: adapter, timeout: timeout,
65
+ max_retries: max_retries, retry_interval: retry_interval,
66
+ backoff_factor: backoff_factor, retry_statuses: retry_statuses,
67
+ retry_methods: retry_methods, http_callback: http_callback,
68
+ proxy_settings: proxy_settings,
69
+ logging_configuration: logging_configuration
70
+
71
+ # Current API environment
72
+ @environment = String(environment)
73
+
74
+ # The object holding Custom Query Parameter credentials
75
+ @custom_query_authentication_credentials = custom_query_authentication_credentials
76
+
77
+ # Initializing Custom Query Parameter credentials with the provided auth parameters
78
+ @custom_query_authentication_credentials = custom_query_authentication_credentials
79
+
80
+ # The Http Client to use for making requests.
81
+ set_http_client CoreLibrary::FaradayClient.new(self)
82
+ end
83
+
84
+ def clone_with(connection: nil, adapter: nil, timeout: nil,
85
+ max_retries: nil, retry_interval: nil, backoff_factor: nil,
86
+ retry_statuses: nil, retry_methods: nil, http_callback: nil,
87
+ proxy_settings: nil, logging_configuration: nil,
88
+ environment: nil,
89
+ custom_query_authentication_credentials: nil)
90
+ connection ||= self.connection
91
+ adapter ||= self.adapter
92
+ timeout ||= self.timeout
93
+ max_retries ||= self.max_retries
94
+ retry_interval ||= self.retry_interval
95
+ backoff_factor ||= self.backoff_factor
96
+ retry_statuses ||= self.retry_statuses
97
+ retry_methods ||= self.retry_methods
98
+ http_callback ||= self.http_callback
99
+ proxy_settings ||= self.proxy_settings
100
+ logging_configuration ||= self.logging_configuration
101
+ environment ||= self.environment
102
+ custom_query_authentication_credentials ||= self.custom_query_authentication_credentials
103
+
104
+ Configuration.new(
105
+ connection: connection, adapter: adapter, timeout: timeout,
106
+ max_retries: max_retries, retry_interval: retry_interval,
107
+ backoff_factor: backoff_factor, retry_statuses: retry_statuses,
108
+ retry_methods: retry_methods, http_callback: http_callback,
109
+ proxy_settings: proxy_settings,
110
+ logging_configuration: logging_configuration, environment: environment,
111
+ custom_query_authentication_credentials: custom_query_authentication_credentials
112
+ )
113
+ end
114
+
115
+
116
+ # All the environments the SDK can run in.
117
+ ENVIRONMENTS = {
118
+ Environment::PRODUCTION => {
119
+ Server::DEFAULT => 'https://www.googleapis.com'
120
+ },
121
+ Environment::ENVIRONMENT2 => {
122
+ Server::DEFAULT => 'https://maps.googleapis.com'
123
+ },
124
+ Environment::ENVIRONMENT3 => {
125
+ Server::DEFAULT => 'https://roads.googleapis.com'
126
+ }
127
+ }.freeze
128
+
129
+ # Generates the appropriate base URI for the environment and the server.
130
+ # @param [Configuration::Server] server The server enum for which the base URI is
131
+ # required.
132
+ # @return [String] The base URI.
133
+ def get_base_uri(server = Server::DEFAULT)
134
+ ENVIRONMENTS[environment][server].clone
135
+ end
136
+
137
+ # Builds a Configuration instance using environment variables.
138
+ def self.build_default_config_from_env
139
+ # === Core environment ===
140
+ environment = Environment.from_value(ENV.fetch('ENVIRONMENT', 'production'))
141
+ timeout = (ENV['TIMEOUT'] || 30).to_f
142
+ max_retries = (ENV['MAX_RETRIES'] || 0).to_i
143
+ retry_interval = (ENV['RETRY_INTERVAL'] || 1).to_f
144
+ backoff_factor = (ENV['BACKOFF_FACTOR'] || 2).to_f
145
+ retry_statuses = ENV.fetch('RETRY_STATUSES',
146
+ '[408, 413, 429, 500, 502, 503, 504, 521, 522, 524]').gsub(/[\[\]]/, '')
147
+ .split(',')
148
+ .map(&:strip)
149
+ .map do |item|
150
+ item.match?(/\A\d+\z/) ? item.to_i : item.downcase
151
+ end
152
+ retry_methods = ENV.fetch('RETRY_METHODS', '%i[get put]').gsub(/[\[\]]/, '')
153
+ .split(',')
154
+ .map(&:strip)
155
+ .map do |item|
156
+ item.match?(/\A\d+\z/) ? item.to_i : item.downcase
157
+ end
158
+
159
+ # === Authentication credentials ===
160
+ custom_query_authentication_credentials = CustomQueryAuthenticationCredentials.from_env
161
+
162
+ # === Proxy settings ===
163
+ proxy_settings = ProxySettings.from_env
164
+ # === Logging Configuration ===
165
+ logging_configuration = LoggingConfiguration.from_env if LoggingConfiguration.any_logging_configured?
166
+
167
+ Configuration.new(
168
+ environment: environment,
169
+ timeout: timeout,
170
+ max_retries: max_retries,
171
+ retry_interval: retry_interval,
172
+ backoff_factor: backoff_factor,
173
+ retry_statuses: retry_statuses,
174
+ retry_methods: retry_methods,
175
+ custom_query_authentication_credentials: custom_query_authentication_credentials,
176
+ proxy_settings: proxy_settings,
177
+ logging_configuration: logging_configuration
178
+ )
179
+ end
180
+ end
181
+ end
@@ -0,0 +1,21 @@
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
+ # Class for exceptions when there is a network error, status code error, etc.
8
+ class APIException < CoreLibrary::ApiException
9
+ # Provides a human-readable string representation of the object.
10
+ def to_s
11
+ class_name = self.class.name.split('::').last
12
+ "<#{class_name} status_code: #{@response_code}, reason: #{@reason}>"
13
+ end
14
+
15
+ # Provides a debugging-friendly string with detailed object information.
16
+ def inspect
17
+ class_name = self.class.name.split('::').last
18
+ "<#{class_name} status_code: #{@response_code.inspect}, reason: #{@reason.inspect}>"
19
+ end
20
+ end
21
+ end