google-maps-api-sdk 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +28 -0
- data/README.md +169 -0
- data/bin/console +15 -0
- data/lib/google_maps_platform/api_helper.rb +10 -0
- data/lib/google_maps_platform/client.rb +123 -0
- data/lib/google_maps_platform/configuration.rb +181 -0
- data/lib/google_maps_platform/controllers/base_controller.rb +67 -0
- data/lib/google_maps_platform/controllers/directions_api_controller.rb +341 -0
- data/lib/google_maps_platform/controllers/distance_matrix_api_controller.rb +224 -0
- data/lib/google_maps_platform/controllers/elevation_api_controller.rb +71 -0
- data/lib/google_maps_platform/controllers/geocoding_api_controller.rb +214 -0
- data/lib/google_maps_platform/controllers/geolocation_api_controller.rb +46 -0
- data/lib/google_maps_platform/controllers/places_api_controller.rb +866 -0
- data/lib/google_maps_platform/controllers/roads_api_controller.rb +81 -0
- data/lib/google_maps_platform/controllers/street_view_api_controller.rb +198 -0
- data/lib/google_maps_platform/controllers/time_zone_api_controller.rb +65 -0
- data/lib/google_maps_platform/exceptions/api_exception.rb +21 -0
- data/lib/google_maps_platform/exceptions/error_response_exception.rb +48 -0
- data/lib/google_maps_platform/exceptions/nearest_roads_error_response_exception.rb +46 -0
- data/lib/google_maps_platform/http/api_response.rb +19 -0
- data/lib/google_maps_platform/http/auth/custom_query_authentication.rb +52 -0
- data/lib/google_maps_platform/http/http_call_back.rb +10 -0
- data/lib/google_maps_platform/http/http_method_enum.rb +10 -0
- data/lib/google_maps_platform/http/http_request.rb +10 -0
- data/lib/google_maps_platform/http/http_response.rb +10 -0
- data/lib/google_maps_platform/http/proxy_settings.rb +22 -0
- data/lib/google_maps_platform/logging/configuration/api_logging_configuration.rb +186 -0
- data/lib/google_maps_platform/logging/sdk_logger.rb +17 -0
- data/lib/google_maps_platform/models/address_component.rb +97 -0
- data/lib/google_maps_platform/models/base_model.rb +110 -0
- data/lib/google_maps_platform/models/bounds.rb +85 -0
- data/lib/google_maps_platform/models/business_status.rb +41 -0
- data/lib/google_maps_platform/models/cell_tower.rb +146 -0
- data/lib/google_maps_platform/models/directions_geocoded_waypoint.rb +181 -0
- data/lib/google_maps_platform/models/directions_leg.rb +224 -0
- data/lib/google_maps_platform/models/directions_polyline.rb +93 -0
- data/lib/google_maps_platform/models/directions_response.rb +185 -0
- data/lib/google_maps_platform/models/directions_route.rb +188 -0
- data/lib/google_maps_platform/models/directions_status.rb +94 -0
- data/lib/google_maps_platform/models/directions_step.rb +216 -0
- data/lib/google_maps_platform/models/directions_traffic_speed_entry.rb +84 -0
- data/lib/google_maps_platform/models/directions_transit_agency.rb +95 -0
- data/lib/google_maps_platform/models/directions_transit_details.rb +176 -0
- data/lib/google_maps_platform/models/directions_transit_line.rb +152 -0
- data/lib/google_maps_platform/models/directions_transit_stop.rb +83 -0
- data/lib/google_maps_platform/models/directions_transit_vehicle.rb +126 -0
- data/lib/google_maps_platform/models/directions_via_waypoint.rb +99 -0
- data/lib/google_maps_platform/models/distance_matrix_element.rb +132 -0
- data/lib/google_maps_platform/models/distance_matrix_element_status.rb +48 -0
- data/lib/google_maps_platform/models/distance_matrix_response.rb +149 -0
- data/lib/google_maps_platform/models/distance_matrix_row.rb +89 -0
- data/lib/google_maps_platform/models/distance_matrix_status.rb +74 -0
- data/lib/google_maps_platform/models/elevation_response.rb +132 -0
- data/lib/google_maps_platform/models/elevation_result.rb +99 -0
- data/lib/google_maps_platform/models/elevation_status.rb +65 -0
- data/lib/google_maps_platform/models/error_detail.rb +135 -0
- data/lib/google_maps_platform/models/error_object.rb +130 -0
- data/lib/google_maps_platform/models/fare.rb +92 -0
- data/lib/google_maps_platform/models/field_violation.rb +82 -0
- data/lib/google_maps_platform/models/geocoder_status.rb +37 -0
- data/lib/google_maps_platform/models/geocoding_geometry.rb +117 -0
- data/lib/google_maps_platform/models/geocoding_response.rb +140 -0
- data/lib/google_maps_platform/models/geocoding_result.rb +174 -0
- data/lib/google_maps_platform/models/geocoding_status.rb +71 -0
- data/lib/google_maps_platform/models/geolocation_request.rb +166 -0
- data/lib/google_maps_platform/models/geolocation_response.rb +91 -0
- data/lib/google_maps_platform/models/geometry.rb +84 -0
- data/lib/google_maps_platform/models/inputtype.rb +36 -0
- data/lib/google_maps_platform/models/language.rb +240 -0
- data/lib/google_maps_platform/models/lat_lng_literal.rb +83 -0
- data/lib/google_maps_platform/models/latitude_longitude_literal.rb +83 -0
- data/lib/google_maps_platform/models/location_type.rb +54 -0
- data/lib/google_maps_platform/models/location_type1.rb +44 -0
- data/lib/google_maps_platform/models/maneuver.rb +110 -0
- data/lib/google_maps_platform/models/maps_api_elevation_json_response.rb +132 -0
- data/lib/google_maps_platform/models/maxprice.rb +48 -0
- data/lib/google_maps_platform/models/minprice.rb +48 -0
- data/lib/google_maps_platform/models/mode.rb +44 -0
- data/lib/google_maps_platform/models/nearest_roads_error.rb +90 -0
- data/lib/google_maps_platform/models/nearest_roads_response.rb +86 -0
- data/lib/google_maps_platform/models/place.rb +647 -0
- data/lib/google_maps_platform/models/place_autocomplete_matched_substring.rb +82 -0
- data/lib/google_maps_platform/models/place_autocomplete_prediction.rb +181 -0
- data/lib/google_maps_platform/models/place_autocomplete_structured_format.rb +136 -0
- data/lib/google_maps_platform/models/place_autocomplete_term.rb +83 -0
- data/lib/google_maps_platform/models/place_editorial_summary.rb +87 -0
- data/lib/google_maps_platform/models/place_opening_hours.rb +138 -0
- data/lib/google_maps_platform/models/place_opening_hours_period.rb +84 -0
- data/lib/google_maps_platform/models/place_opening_hours_period_detail.rb +108 -0
- data/lib/google_maps_platform/models/place_photo.rb +109 -0
- data/lib/google_maps_platform/models/place_review.rb +186 -0
- data/lib/google_maps_platform/models/place_special_day.rb +93 -0
- data/lib/google_maps_platform/models/places_autocomplete_response.rb +141 -0
- data/lib/google_maps_platform/models/places_autocomplete_status.rb +66 -0
- data/lib/google_maps_platform/models/places_details_response.rb +131 -0
- data/lib/google_maps_platform/models/places_details_status.rb +71 -0
- data/lib/google_maps_platform/models/places_find_place_from_text_response.rb +145 -0
- data/lib/google_maps_platform/models/places_nearby_search_response.rb +171 -0
- data/lib/google_maps_platform/models/places_query_autocomplete_response.rb +141 -0
- data/lib/google_maps_platform/models/places_search_status.rb +66 -0
- data/lib/google_maps_platform/models/places_text_search_response.rb +171 -0
- data/lib/google_maps_platform/models/plus_code.rb +92 -0
- data/lib/google_maps_platform/models/rankby.rb +36 -0
- data/lib/google_maps_platform/models/region.rb +1052 -0
- data/lib/google_maps_platform/models/result.rb +96 -0
- data/lib/google_maps_platform/models/result_type.rb +112 -0
- data/lib/google_maps_platform/models/snap_to_roads_response.rb +96 -0
- data/lib/google_maps_platform/models/snapped_point.rb +103 -0
- data/lib/google_maps_platform/models/source.rb +36 -0
- data/lib/google_maps_platform/models/street_view_response.rb +135 -0
- data/lib/google_maps_platform/models/street_view_status.rb +71 -0
- data/lib/google_maps_platform/models/text_value_object.rb +82 -0
- data/lib/google_maps_platform/models/time_zone_response.rb +154 -0
- data/lib/google_maps_platform/models/time_zone_status.rb +68 -0
- data/lib/google_maps_platform/models/time_zone_text_value_object.rb +94 -0
- data/lib/google_maps_platform/models/traffic_model.rb +40 -0
- data/lib/google_maps_platform/models/transit_routing_preference.rb +36 -0
- data/lib/google_maps_platform/models/travel_mode.rb +48 -0
- data/lib/google_maps_platform/models/type.rb +140 -0
- data/lib/google_maps_platform/models/type1.rb +112 -0
- data/lib/google_maps_platform/models/units.rb +36 -0
- data/lib/google_maps_platform/models/wi_fi_access_point.rb +119 -0
- data/lib/google_maps_platform/utilities/date_time_helper.rb +11 -0
- data/lib/google_maps_platform/utilities/file_wrapper.rb +28 -0
- data/lib/google_maps_platform.rb +154 -0
- metadata +210 -0
|
@@ -0,0 +1,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
|
+
# RoadsApiController
|
|
8
|
+
class RoadsApiController < BaseController
|
|
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
|
+
# StreetViewApiController
|
|
8
|
+
class StreetViewApiController < BaseController
|
|
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
|
+
# TimeZoneApiController
|
|
8
|
+
class TimeZoneApiController < BaseController
|
|
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,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
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
# In the case of an error, a standard format error response body will be
|
|
8
|
+
# returned and the HTTP status code will be set to an error status. The
|
|
9
|
+
# response contains an object with a single error object.
|
|
10
|
+
class ErrorResponseException < APIException
|
|
11
|
+
SKIP = Object.new
|
|
12
|
+
private_constant :SKIP
|
|
13
|
+
|
|
14
|
+
# TODO: Write general description for this method
|
|
15
|
+
# @return [ErrorObject]
|
|
16
|
+
attr_accessor :error
|
|
17
|
+
|
|
18
|
+
# The constructor.
|
|
19
|
+
# @param [String] reason The reason for raising an exception.
|
|
20
|
+
# @param [HttpResponse] response The HttpReponse of the API call.
|
|
21
|
+
def initialize(reason, response)
|
|
22
|
+
super(reason, response)
|
|
23
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
|
24
|
+
unbox(hash)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Populates this object by extracting properties from a hash.
|
|
28
|
+
# @param [Hash] hash The deserialized response sent by the server in the
|
|
29
|
+
# response body.
|
|
30
|
+
def unbox(hash)
|
|
31
|
+
return nil unless hash
|
|
32
|
+
|
|
33
|
+
@error = ErrorObject.from_hash(hash['error']) if hash['error']
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Provides a human-readable string representation of the object.
|
|
37
|
+
def to_s
|
|
38
|
+
class_name = self.class.name.split('::').last
|
|
39
|
+
"<#{class_name} error: #{@error}>"
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
43
|
+
def inspect
|
|
44
|
+
class_name = self.class.name.split('::').last
|
|
45
|
+
"<#{class_name} error: #{@error.inspect}>"
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# google_maps_platform
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC
|
|
4
|
+
# v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module GoogleMapsPlatform
|
|
7
|
+
# NearestRoadsErrorResponse class.
|
|
8
|
+
class NearestRoadsErrorResponseException < APIException
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [NearestRoadsError]
|
|
14
|
+
attr_accessor :error
|
|
15
|
+
|
|
16
|
+
# The constructor.
|
|
17
|
+
# @param [String] reason The reason for raising an exception.
|
|
18
|
+
# @param [HttpResponse] response The HttpReponse of the API call.
|
|
19
|
+
def initialize(reason, response)
|
|
20
|
+
super(reason, response)
|
|
21
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
|
22
|
+
unbox(hash)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Populates this object by extracting properties from a hash.
|
|
26
|
+
# @param [Hash] hash The deserialized response sent by the server in the
|
|
27
|
+
# response body.
|
|
28
|
+
def unbox(hash)
|
|
29
|
+
return nil unless hash
|
|
30
|
+
|
|
31
|
+
@error = NearestRoadsError.from_hash(hash['error']) if hash['error']
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Provides a human-readable string representation of the object.
|
|
35
|
+
def to_s
|
|
36
|
+
class_name = self.class.name.split('::').last
|
|
37
|
+
"<#{class_name} error: #{@error}>"
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
41
|
+
def inspect
|
|
42
|
+
class_name = self.class.name.split('::').last
|
|
43
|
+
"<#{class_name} error: #{@error.inspect}>"
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
# Http response received.
|
|
8
|
+
class ApiResponse < CoreLibrary::ApiResponse
|
|
9
|
+
# The constructor
|
|
10
|
+
# @param [HttpResponse] http_response The original, raw response from the api.
|
|
11
|
+
# @param [Object] data The data field specified for the response.
|
|
12
|
+
# @param [Array<String>] errors Any errors returned by the server.
|
|
13
|
+
def initialize(http_response,
|
|
14
|
+
data: nil,
|
|
15
|
+
errors: nil)
|
|
16
|
+
super
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
# Utility class for custom query_parameter authorization.
|
|
8
|
+
class CustomQueryAuthentication < CoreLibrary::QueryAuth
|
|
9
|
+
# Display error message on occurrence of authentication failure.
|
|
10
|
+
# @returns [String] The oAuth error message.
|
|
11
|
+
def error_message
|
|
12
|
+
'CustomQueryAuthentication: key is undefined.'
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Initialization constructor.
|
|
16
|
+
def initialize(custom_query_authentication_credentials)
|
|
17
|
+
auth_params = {}
|
|
18
|
+
auth_params['key'] = custom_query_authentication_credentials.key unless
|
|
19
|
+
custom_query_authentication_credentials.nil? || custom_query_authentication_credentials.key.nil?
|
|
20
|
+
|
|
21
|
+
super auth_params
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Data class for CustomQueryAuthenticationCredentials.
|
|
26
|
+
# Data class for CustomQueryAuthenticationCredentials.
|
|
27
|
+
class CustomQueryAuthenticationCredentials
|
|
28
|
+
attr_reader :key
|
|
29
|
+
|
|
30
|
+
def initialize(key:)
|
|
31
|
+
raise ArgumentError, 'key cannot be nil' if key.nil?
|
|
32
|
+
|
|
33
|
+
@key = key
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def self.from_env
|
|
37
|
+
key = ENV['KEY']
|
|
38
|
+
all_nil = [
|
|
39
|
+
key
|
|
40
|
+
].all?(&:nil?)
|
|
41
|
+
return nil if all_nil
|
|
42
|
+
|
|
43
|
+
new(key: key)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def clone_with(key: nil)
|
|
47
|
+
key ||= self.key
|
|
48
|
+
|
|
49
|
+
CustomQueryAuthenticationCredentials.new(key: key)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
# HttpCallBack allows defining callables for pre and post API calls.
|
|
8
|
+
class HttpCallBack < CoreLibrary::HttpCallback
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
##
|
|
8
|
+
# ProxySettings encapsulates HTTP proxy configuration for Faraday,
|
|
9
|
+
# including optional basic authentication.
|
|
10
|
+
#
|
|
11
|
+
class ProxySettings < CoreLibrary::ProxySettings
|
|
12
|
+
def self.from_env
|
|
13
|
+
address = ENV['PROXY_ADDRESS']
|
|
14
|
+
port = ENV['PROXY_PORT']
|
|
15
|
+
username = ENV['PROXY_USERNAME']
|
|
16
|
+
password = ENV['PROXY_PASSWORD']
|
|
17
|
+
return nil if address.nil? || address.strip.empty?
|
|
18
|
+
|
|
19
|
+
new(address: address, port: port, username: username, password: password)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|