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,188 @@
|
|
|
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
|
+
# Routes consist of nested `legs` and `steps`.
|
|
8
|
+
class DirectionsRoute < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# An array which contains information about a leg of the route, between two
|
|
13
|
+
# locations within the given route. A separate leg will be present for each
|
|
14
|
+
# waypoint or destination specified. (A route with no waypoints will contain
|
|
15
|
+
# exactly one leg within the legs array.) Each leg consists of a series of
|
|
16
|
+
# steps.
|
|
17
|
+
# @return [Array[DirectionsLeg]]
|
|
18
|
+
attr_accessor :legs
|
|
19
|
+
|
|
20
|
+
# A rectangle in geographical coordinates from points at the southwest and
|
|
21
|
+
# northeast corners.
|
|
22
|
+
# @return [Bounds]
|
|
23
|
+
attr_accessor :bounds
|
|
24
|
+
|
|
25
|
+
# Contains the copyright notices to be displayed for this route. You must
|
|
26
|
+
# handle and display this information yourself. This content is meant to be
|
|
27
|
+
# read as-is. Do not programmatically parse this display-only content.
|
|
28
|
+
# @return [String]
|
|
29
|
+
attr_accessor :copyrights
|
|
30
|
+
|
|
31
|
+
# Contains a short textual description for the route, suitable for naming
|
|
32
|
+
# and disambiguating the route from alternatives.
|
|
33
|
+
# @return [String]
|
|
34
|
+
attr_accessor :summary
|
|
35
|
+
|
|
36
|
+
# An array indicating the order of any waypoints in the calculated route.
|
|
37
|
+
# This waypoints may be reordered if the request was passed optimize:true
|
|
38
|
+
# within its waypoints parameter.
|
|
39
|
+
# @return [Array[Integer]]
|
|
40
|
+
attr_accessor :waypoint_order
|
|
41
|
+
|
|
42
|
+
# Contains an array of warnings to be displayed when showing these
|
|
43
|
+
# directions. You must handle and display these warnings yourself.
|
|
44
|
+
# @return [Array[String]]
|
|
45
|
+
attr_accessor :warnings
|
|
46
|
+
|
|
47
|
+
# [Polyline
|
|
48
|
+
# encoding](https://developers.google.com/maps/documentation/utilities/polyl
|
|
49
|
+
# inealgorithm) is a lossy compression algorithm that allows you to store a
|
|
50
|
+
# series of coordinates as a single string. Point coordinates are encoded
|
|
51
|
+
# using signed values. If you only have a few static points, you may also
|
|
52
|
+
# wish to use the interactive polyline encoding utility.
|
|
53
|
+
# The encoding process converts a binary value into a series of character
|
|
54
|
+
# codes for ASCII characters using the familiar base64 encoding scheme: to
|
|
55
|
+
# ensure proper display of these characters, encoded values are summed with
|
|
56
|
+
# 63 (the ASCII character '?') before converting them into ASCII. The
|
|
57
|
+
# algorithm also checks for additional character codes for a given point by
|
|
58
|
+
# checking the least significant bit of each byte group; if this bit is set
|
|
59
|
+
# to 1, the point is not yet fully formed and additional data must follow.
|
|
60
|
+
# Additionally, to conserve space, points only include the offset from the
|
|
61
|
+
# previous point (except of course for the first point). All points are
|
|
62
|
+
# encoded in Base64 as signed integers, as latitudes and longitudes are
|
|
63
|
+
# signed values. The encoding format within a polyline needs to represent
|
|
64
|
+
# two coordinates representing latitude and longitude to a reasonable
|
|
65
|
+
# precision. Given a maximum longitude of +/- 180 degrees to a precision of
|
|
66
|
+
# 5 decimal places (180.00000 to -180.00000), this results in the need for a
|
|
67
|
+
# 32 bit signed binary integer value.
|
|
68
|
+
# @return [DirectionsPolyline]
|
|
69
|
+
attr_accessor :overview_polyline
|
|
70
|
+
|
|
71
|
+
# The total fare for the route.
|
|
72
|
+
# ```
|
|
73
|
+
# {
|
|
74
|
+
# "currency" : "USD",
|
|
75
|
+
# "value" : 6,
|
|
76
|
+
# "text" : "$6.00"
|
|
77
|
+
# }
|
|
78
|
+
# ```
|
|
79
|
+
# @return [Fare]
|
|
80
|
+
attr_accessor :fare
|
|
81
|
+
|
|
82
|
+
# A mapping from model property names to API property names.
|
|
83
|
+
def self.names
|
|
84
|
+
@_hash = {} if @_hash.nil?
|
|
85
|
+
@_hash['legs'] = 'legs'
|
|
86
|
+
@_hash['bounds'] = 'bounds'
|
|
87
|
+
@_hash['copyrights'] = 'copyrights'
|
|
88
|
+
@_hash['summary'] = 'summary'
|
|
89
|
+
@_hash['waypoint_order'] = 'waypoint_order'
|
|
90
|
+
@_hash['warnings'] = 'warnings'
|
|
91
|
+
@_hash['overview_polyline'] = 'overview_polyline'
|
|
92
|
+
@_hash['fare'] = 'fare'
|
|
93
|
+
@_hash
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# An array for optional fields
|
|
97
|
+
def self.optionals
|
|
98
|
+
%w[
|
|
99
|
+
fare
|
|
100
|
+
]
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# An array for nullable fields
|
|
104
|
+
def self.nullables
|
|
105
|
+
[]
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def initialize(legs:, bounds:, copyrights:, summary:, waypoint_order:,
|
|
109
|
+
warnings:, overview_polyline:, fare: SKIP,
|
|
110
|
+
additional_properties: nil)
|
|
111
|
+
# Add additional model properties to the instance
|
|
112
|
+
additional_properties = {} if additional_properties.nil?
|
|
113
|
+
|
|
114
|
+
@legs = legs
|
|
115
|
+
@bounds = bounds
|
|
116
|
+
@copyrights = copyrights
|
|
117
|
+
@summary = summary
|
|
118
|
+
@waypoint_order = waypoint_order
|
|
119
|
+
@warnings = warnings
|
|
120
|
+
@overview_polyline = overview_polyline
|
|
121
|
+
@fare = fare unless fare == SKIP
|
|
122
|
+
@additional_properties = additional_properties
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# Creates an instance of the object from a hash.
|
|
126
|
+
def self.from_hash(hash)
|
|
127
|
+
return nil unless hash
|
|
128
|
+
|
|
129
|
+
# Extract variables from the hash.
|
|
130
|
+
# Parameter is an array, so we need to iterate through it
|
|
131
|
+
legs = nil
|
|
132
|
+
unless hash['legs'].nil?
|
|
133
|
+
legs = []
|
|
134
|
+
hash['legs'].each do |structure|
|
|
135
|
+
legs << (DirectionsLeg.from_hash(structure) if structure)
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
legs = nil unless hash.key?('legs')
|
|
140
|
+
bounds = Bounds.from_hash(hash['bounds']) if hash['bounds']
|
|
141
|
+
copyrights = hash.key?('copyrights') ? hash['copyrights'] : nil
|
|
142
|
+
summary = hash.key?('summary') ? hash['summary'] : nil
|
|
143
|
+
waypoint_order =
|
|
144
|
+
hash.key?('waypoint_order') ? hash['waypoint_order'] : nil
|
|
145
|
+
warnings = hash.key?('warnings') ? hash['warnings'] : nil
|
|
146
|
+
overview_polyline = DirectionsPolyline.from_hash(hash['overview_polyline']) if
|
|
147
|
+
hash['overview_polyline']
|
|
148
|
+
fare = Fare.from_hash(hash['fare']) if hash['fare']
|
|
149
|
+
|
|
150
|
+
# Create a new hash for additional properties, removing known properties.
|
|
151
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
152
|
+
|
|
153
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
154
|
+
new_hash, proc { |value| value }
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
# Create object from extracted values.
|
|
158
|
+
DirectionsRoute.new(legs: legs,
|
|
159
|
+
bounds: bounds,
|
|
160
|
+
copyrights: copyrights,
|
|
161
|
+
summary: summary,
|
|
162
|
+
waypoint_order: waypoint_order,
|
|
163
|
+
warnings: warnings,
|
|
164
|
+
overview_polyline: overview_polyline,
|
|
165
|
+
fare: fare,
|
|
166
|
+
additional_properties: additional_properties)
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# Provides a human-readable string representation of the object.
|
|
170
|
+
def to_s
|
|
171
|
+
class_name = self.class.name.split('::').last
|
|
172
|
+
"<#{class_name} legs: #{@legs}, bounds: #{@bounds}, copyrights: #{@copyrights}, summary:"\
|
|
173
|
+
" #{@summary}, waypoint_order: #{@waypoint_order}, warnings: #{@warnings},"\
|
|
174
|
+
" overview_polyline: #{@overview_polyline}, fare: #{@fare}, additional_properties:"\
|
|
175
|
+
" #{@additional_properties}>"
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
179
|
+
def inspect
|
|
180
|
+
class_name = self.class.name.split('::').last
|
|
181
|
+
"<#{class_name} legs: #{@legs.inspect}, bounds: #{@bounds.inspect}, copyrights:"\
|
|
182
|
+
" #{@copyrights.inspect}, summary: #{@summary.inspect}, waypoint_order:"\
|
|
183
|
+
" #{@waypoint_order.inspect}, warnings: #{@warnings.inspect}, overview_polyline:"\
|
|
184
|
+
" #{@overview_polyline.inspect}, fare: #{@fare.inspect}, additional_properties:"\
|
|
185
|
+
" #{@additional_properties}>"
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
end
|
|
@@ -0,0 +1,94 @@
|
|
|
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
|
+
# The status field within the Directions response object contains the status
|
|
8
|
+
# of the request, and may contain debugging information to help you track down
|
|
9
|
+
# why the Directions service failed. The status field may contain the
|
|
10
|
+
# following values: - `OK` indicates the response contains a valid result. -
|
|
11
|
+
# `NOT_FOUND` indicates at least one of the locations specified in the
|
|
12
|
+
# request's origin, destination, or waypoints could not be geocoded. -
|
|
13
|
+
# `ZERO_RESULTS` indicates no route could be found between the origin and
|
|
14
|
+
# destination. - `MAX_WAYPOINTS_EXCEEDED` indicates that too many waypoints
|
|
15
|
+
# were provided in the request. For applications using the Directions API as a
|
|
16
|
+
# web service, or the directions service in the Maps JavaScript API, the
|
|
17
|
+
# maximum allowed number of waypoints is 25, plus the origin and destination.
|
|
18
|
+
# - `MAX_ROUTE_LENGTH_EXCEEDED` indicates the requested route is too long and
|
|
19
|
+
# cannot be processed. This error occurs when more complex directions are
|
|
20
|
+
# returned. Try reducing the number of waypoints, turns, or instructions. -
|
|
21
|
+
# `INVALID_REQUEST` indicates that the provided request was invalid. Common
|
|
22
|
+
# causes of this status include an invalid parameter or parameter value. -
|
|
23
|
+
# `OVER_DAILY_LIMIT` indicates any of the following: - The API key is
|
|
24
|
+
# missing or invalid. - Billing has not been enabled on your account.
|
|
25
|
+
# - A self-imposed usage cap has been exceeded. - The provided method of
|
|
26
|
+
# payment is no longer valid (for example, a credit card has expired). See
|
|
27
|
+
# the [Maps FAQ](https://developers.google.com/maps/faq#over-limit-key-error)
|
|
28
|
+
# to learn how to fix this. - `OVER_QUERY_LIMIT` indicates the service has
|
|
29
|
+
# received too many requests from your application within the allowed time
|
|
30
|
+
# period. - `REQUEST_DENIED` indicates that the service denied use of the
|
|
31
|
+
# directions service by your application. - `UNKNOWN_ERROR` indicates a
|
|
32
|
+
# directions request could not be processed due to a server error. The request
|
|
33
|
+
# may succeed if you try again.
|
|
34
|
+
class DirectionsStatus
|
|
35
|
+
DIRECTIONS_STATUS = [
|
|
36
|
+
# TODO: Write general description for OK
|
|
37
|
+
OK = 'OK'.freeze,
|
|
38
|
+
|
|
39
|
+
# TODO: Write general description for NOT_FOUND
|
|
40
|
+
NOT_FOUND = 'NOT_FOUND'.freeze,
|
|
41
|
+
|
|
42
|
+
# TODO: Write general description for ZERO_RESULTS
|
|
43
|
+
ZERO_RESULTS = 'ZERO_RESULTS'.freeze,
|
|
44
|
+
|
|
45
|
+
# TODO: Write general description for MAX_WAYPOINTS_EXCEEDED
|
|
46
|
+
MAX_WAYPOINTS_EXCEEDED = 'MAX_WAYPOINTS_EXCEEDED'.freeze,
|
|
47
|
+
|
|
48
|
+
# TODO: Write general description for MAX_ROUTE_LENGTH_EXCEEDED
|
|
49
|
+
MAX_ROUTE_LENGTH_EXCEEDED = 'MAX_ROUTE_LENGTH_EXCEEDED'.freeze,
|
|
50
|
+
|
|
51
|
+
# TODO: Write general description for INVALID_REQUEST
|
|
52
|
+
INVALID_REQUEST = 'INVALID_REQUEST'.freeze,
|
|
53
|
+
|
|
54
|
+
# TODO: Write general description for OVER_DAILY_LIMIT
|
|
55
|
+
OVER_DAILY_LIMIT = 'OVER_DAILY_LIMIT'.freeze,
|
|
56
|
+
|
|
57
|
+
# TODO: Write general description for OVER_QUERY_LIMIT
|
|
58
|
+
OVER_QUERY_LIMIT = 'OVER_QUERY_LIMIT'.freeze,
|
|
59
|
+
|
|
60
|
+
# TODO: Write general description for REQUEST_DENIED
|
|
61
|
+
REQUEST_DENIED = 'REQUEST_DENIED'.freeze,
|
|
62
|
+
|
|
63
|
+
# TODO: Write general description for UNKNOWN_ERROR
|
|
64
|
+
UNKNOWN_ERROR = 'UNKNOWN_ERROR'.freeze
|
|
65
|
+
].freeze
|
|
66
|
+
|
|
67
|
+
def self.validate(value)
|
|
68
|
+
return false if value.nil?
|
|
69
|
+
|
|
70
|
+
DIRECTIONS_STATUS.include?(value)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def self.from_value(value, default_value = OK)
|
|
74
|
+
return default_value if value.nil?
|
|
75
|
+
|
|
76
|
+
str = value.to_s.strip
|
|
77
|
+
|
|
78
|
+
case str.downcase
|
|
79
|
+
when 'ok' then OK
|
|
80
|
+
when 'not_found' then NOT_FOUND
|
|
81
|
+
when 'zero_results' then ZERO_RESULTS
|
|
82
|
+
when 'max_waypoints_exceeded' then MAX_WAYPOINTS_EXCEEDED
|
|
83
|
+
when 'max_route_length_exceeded' then MAX_ROUTE_LENGTH_EXCEEDED
|
|
84
|
+
when 'invalid_request' then INVALID_REQUEST
|
|
85
|
+
when 'over_daily_limit' then OVER_DAILY_LIMIT
|
|
86
|
+
when 'over_query_limit' then OVER_QUERY_LIMIT
|
|
87
|
+
when 'request_denied' then REQUEST_DENIED
|
|
88
|
+
when 'unknown_error' then UNKNOWN_ERROR
|
|
89
|
+
else
|
|
90
|
+
default_value
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
@@ -0,0 +1,216 @@
|
|
|
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
|
+
# Each element in the steps array defines a single step of the calculated
|
|
8
|
+
# directions. A step is the most atomic unit of a direction's route,
|
|
9
|
+
# containing a single step describing a specific, single instruction on the
|
|
10
|
+
# journey. E.g. "Turn left at W. 4th St." The step not only describes the
|
|
11
|
+
# instruction but also contains distance and duration information relating to
|
|
12
|
+
# how this step relates to the following step. For example, a step denoted as
|
|
13
|
+
# "Merge onto I-80 West" may contain a duration of "37 miles" and "40
|
|
14
|
+
# minutes," indicating that the next step is 37 miles/40 minutes from this
|
|
15
|
+
# step. When using the Directions API to search for transit directions, the
|
|
16
|
+
# steps array will include additional transit details in the form of a
|
|
17
|
+
# transit_details array. If the directions include multiple modes of
|
|
18
|
+
# transportation, detailed directions will be provided for walking or driving
|
|
19
|
+
# steps in an inner steps array. For example, a walking step will include
|
|
20
|
+
# directions from the start and end locations: "Walk to Innes Ave & Fitch St".
|
|
21
|
+
# That step will include detailed walking directions for that route in the
|
|
22
|
+
# inner steps array, such as: "Head north-west", "Turn left onto Arelious
|
|
23
|
+
# Walker", and "Turn left onto Innes Ave".
|
|
24
|
+
class DirectionsStep < BaseModel
|
|
25
|
+
SKIP = Object.new
|
|
26
|
+
private_constant :SKIP
|
|
27
|
+
|
|
28
|
+
# An object containing a numeric value and its formatted text
|
|
29
|
+
# representation.
|
|
30
|
+
# @return [TextValueObject]
|
|
31
|
+
attr_accessor :distance
|
|
32
|
+
|
|
33
|
+
# An object containing a numeric value and its formatted text
|
|
34
|
+
# representation.
|
|
35
|
+
# @return [TextValueObject]
|
|
36
|
+
attr_accessor :duration
|
|
37
|
+
|
|
38
|
+
# An object describing a specific location with Latitude and Longitude in
|
|
39
|
+
# decimal degrees.
|
|
40
|
+
# @return [LatLngLiteral]
|
|
41
|
+
attr_accessor :end_location
|
|
42
|
+
|
|
43
|
+
# Contains formatted instructions for this step, presented as an HTML text
|
|
44
|
+
# string. This content is meant to be read as-is. Do not programmatically
|
|
45
|
+
# parse this display-only content.
|
|
46
|
+
# @return [String]
|
|
47
|
+
attr_accessor :html_instructions
|
|
48
|
+
|
|
49
|
+
# Contains the action to take for the current step (turn left, merge,
|
|
50
|
+
# straight, etc.). Values are subject to change, and new values may be
|
|
51
|
+
# introduced without prior notice.
|
|
52
|
+
# @return [Maneuver]
|
|
53
|
+
attr_accessor :maneuver
|
|
54
|
+
|
|
55
|
+
# [Polyline
|
|
56
|
+
# encoding](https://developers.google.com/maps/documentation/utilities/polyl
|
|
57
|
+
# inealgorithm) is a lossy compression algorithm that allows you to store a
|
|
58
|
+
# series of coordinates as a single string. Point coordinates are encoded
|
|
59
|
+
# using signed values. If you only have a few static points, you may also
|
|
60
|
+
# wish to use the interactive polyline encoding utility.
|
|
61
|
+
# The encoding process converts a binary value into a series of character
|
|
62
|
+
# codes for ASCII characters using the familiar base64 encoding scheme: to
|
|
63
|
+
# ensure proper display of these characters, encoded values are summed with
|
|
64
|
+
# 63 (the ASCII character '?') before converting them into ASCII. The
|
|
65
|
+
# algorithm also checks for additional character codes for a given point by
|
|
66
|
+
# checking the least significant bit of each byte group; if this bit is set
|
|
67
|
+
# to 1, the point is not yet fully formed and additional data must follow.
|
|
68
|
+
# Additionally, to conserve space, points only include the offset from the
|
|
69
|
+
# previous point (except of course for the first point). All points are
|
|
70
|
+
# encoded in Base64 as signed integers, as latitudes and longitudes are
|
|
71
|
+
# signed values. The encoding format within a polyline needs to represent
|
|
72
|
+
# two coordinates representing latitude and longitude to a reasonable
|
|
73
|
+
# precision. Given a maximum longitude of +/- 180 degrees to a precision of
|
|
74
|
+
# 5 decimal places (180.00000 to -180.00000), this results in the need for a
|
|
75
|
+
# 32 bit signed binary integer value.
|
|
76
|
+
# @return [DirectionsPolyline]
|
|
77
|
+
attr_accessor :polyline
|
|
78
|
+
|
|
79
|
+
# An object describing a specific location with Latitude and Longitude in
|
|
80
|
+
# decimal degrees.
|
|
81
|
+
# @return [LatLngLiteral]
|
|
82
|
+
attr_accessor :start_location
|
|
83
|
+
|
|
84
|
+
# Additional information that is not relevant for other modes of
|
|
85
|
+
# transportation.
|
|
86
|
+
# @return [DirectionsTransitDetails]
|
|
87
|
+
attr_accessor :transit_details
|
|
88
|
+
|
|
89
|
+
# - `DRIVING` (default) indicates calculation using the road network.
|
|
90
|
+
# - `BICYCLING` requests calculation for bicycling via bicycle paths &
|
|
91
|
+
# preferred streets (where available).
|
|
92
|
+
# - `TRANSIT` requests calculation via public transit routes (where
|
|
93
|
+
# available).
|
|
94
|
+
# - `WALKING` requests calculation for walking via pedestrian paths &
|
|
95
|
+
# sidewalks (where available).
|
|
96
|
+
# @return [TravelMode]
|
|
97
|
+
attr_accessor :travel_mode
|
|
98
|
+
|
|
99
|
+
# Contains detailed directions for walking or driving steps in transit
|
|
100
|
+
# directions. Substeps are only available when travel_mode is set to
|
|
101
|
+
# "transit". The inner steps array is of the same type as steps.
|
|
102
|
+
# @return [Object]
|
|
103
|
+
attr_accessor :steps
|
|
104
|
+
|
|
105
|
+
# A mapping from model property names to API property names.
|
|
106
|
+
def self.names
|
|
107
|
+
@_hash = {} if @_hash.nil?
|
|
108
|
+
@_hash['distance'] = 'distance'
|
|
109
|
+
@_hash['duration'] = 'duration'
|
|
110
|
+
@_hash['end_location'] = 'end_location'
|
|
111
|
+
@_hash['html_instructions'] = 'html_instructions'
|
|
112
|
+
@_hash['maneuver'] = 'maneuver'
|
|
113
|
+
@_hash['polyline'] = 'polyline'
|
|
114
|
+
@_hash['start_location'] = 'start_location'
|
|
115
|
+
@_hash['transit_details'] = 'transit_details'
|
|
116
|
+
@_hash['travel_mode'] = 'travel_mode'
|
|
117
|
+
@_hash['steps'] = 'steps'
|
|
118
|
+
@_hash
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# An array for optional fields
|
|
122
|
+
def self.optionals
|
|
123
|
+
%w[
|
|
124
|
+
distance
|
|
125
|
+
maneuver
|
|
126
|
+
transit_details
|
|
127
|
+
steps
|
|
128
|
+
]
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# An array for nullable fields
|
|
132
|
+
def self.nullables
|
|
133
|
+
[]
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def initialize(duration:, end_location:, html_instructions:, polyline:,
|
|
137
|
+
start_location:, travel_mode:, distance: SKIP,
|
|
138
|
+
maneuver: SKIP, transit_details: SKIP, steps: SKIP,
|
|
139
|
+
additional_properties: nil)
|
|
140
|
+
# Add additional model properties to the instance
|
|
141
|
+
additional_properties = {} if additional_properties.nil?
|
|
142
|
+
|
|
143
|
+
@distance = distance unless distance == SKIP
|
|
144
|
+
@duration = duration
|
|
145
|
+
@end_location = end_location
|
|
146
|
+
@html_instructions = html_instructions
|
|
147
|
+
@maneuver = maneuver unless maneuver == SKIP
|
|
148
|
+
@polyline = polyline
|
|
149
|
+
@start_location = start_location
|
|
150
|
+
@transit_details = transit_details unless transit_details == SKIP
|
|
151
|
+
@travel_mode = travel_mode
|
|
152
|
+
@steps = steps unless steps == SKIP
|
|
153
|
+
@additional_properties = additional_properties
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
# Creates an instance of the object from a hash.
|
|
157
|
+
def self.from_hash(hash)
|
|
158
|
+
return nil unless hash
|
|
159
|
+
|
|
160
|
+
# Extract variables from the hash.
|
|
161
|
+
duration = TextValueObject.from_hash(hash['duration']) if hash['duration']
|
|
162
|
+
end_location = LatLngLiteral.from_hash(hash['end_location']) if hash['end_location']
|
|
163
|
+
html_instructions =
|
|
164
|
+
hash.key?('html_instructions') ? hash['html_instructions'] : nil
|
|
165
|
+
polyline = DirectionsPolyline.from_hash(hash['polyline']) if hash['polyline']
|
|
166
|
+
start_location = LatLngLiteral.from_hash(hash['start_location']) if hash['start_location']
|
|
167
|
+
travel_mode = hash.key?('travel_mode') ? hash['travel_mode'] : nil
|
|
168
|
+
distance = TextValueObject.from_hash(hash['distance']) if hash['distance']
|
|
169
|
+
maneuver = hash.key?('maneuver') ? hash['maneuver'] : SKIP
|
|
170
|
+
transit_details = DirectionsTransitDetails.from_hash(hash['transit_details']) if
|
|
171
|
+
hash['transit_details']
|
|
172
|
+
steps = hash.key?('steps') ? hash['steps'] : SKIP
|
|
173
|
+
|
|
174
|
+
# Create a new hash for additional properties, removing known properties.
|
|
175
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
176
|
+
|
|
177
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
178
|
+
new_hash, proc { |value| value }
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
# Create object from extracted values.
|
|
182
|
+
DirectionsStep.new(duration: duration,
|
|
183
|
+
end_location: end_location,
|
|
184
|
+
html_instructions: html_instructions,
|
|
185
|
+
polyline: polyline,
|
|
186
|
+
start_location: start_location,
|
|
187
|
+
travel_mode: travel_mode,
|
|
188
|
+
distance: distance,
|
|
189
|
+
maneuver: maneuver,
|
|
190
|
+
transit_details: transit_details,
|
|
191
|
+
steps: steps,
|
|
192
|
+
additional_properties: additional_properties)
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# Provides a human-readable string representation of the object.
|
|
196
|
+
def to_s
|
|
197
|
+
class_name = self.class.name.split('::').last
|
|
198
|
+
"<#{class_name} distance: #{@distance}, duration: #{@duration}, end_location:"\
|
|
199
|
+
" #{@end_location}, html_instructions: #{@html_instructions}, maneuver: #{@maneuver},"\
|
|
200
|
+
" polyline: #{@polyline}, start_location: #{@start_location}, transit_details:"\
|
|
201
|
+
" #{@transit_details}, travel_mode: #{@travel_mode}, steps: #{@steps},"\
|
|
202
|
+
" additional_properties: #{@additional_properties}>"
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
206
|
+
def inspect
|
|
207
|
+
class_name = self.class.name.split('::').last
|
|
208
|
+
"<#{class_name} distance: #{@distance.inspect}, duration: #{@duration.inspect},"\
|
|
209
|
+
" end_location: #{@end_location.inspect}, html_instructions: #{@html_instructions.inspect},"\
|
|
210
|
+
" maneuver: #{@maneuver.inspect}, polyline: #{@polyline.inspect}, start_location:"\
|
|
211
|
+
" #{@start_location.inspect}, transit_details: #{@transit_details.inspect}, travel_mode:"\
|
|
212
|
+
" #{@travel_mode.inspect}, steps: #{@steps.inspect}, additional_properties:"\
|
|
213
|
+
" #{@additional_properties}>"
|
|
214
|
+
end
|
|
215
|
+
end
|
|
216
|
+
end
|
|
@@ -0,0 +1,84 @@
|
|
|
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
|
+
# DirectionsTrafficSpeedEntry Model.
|
|
8
|
+
class DirectionsTrafficSpeedEntry < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# The current traffic/speed conditions on this portion of a path.
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :speed_category
|
|
15
|
+
|
|
16
|
+
# The offset along the path (in meters) up to which this speed category is
|
|
17
|
+
# valid.
|
|
18
|
+
# @return [Float]
|
|
19
|
+
attr_accessor :offset_meters
|
|
20
|
+
|
|
21
|
+
# A mapping from model property names to API property names.
|
|
22
|
+
def self.names
|
|
23
|
+
@_hash = {} if @_hash.nil?
|
|
24
|
+
@_hash['speed_category'] = 'speed_category'
|
|
25
|
+
@_hash['offset_meters'] = 'offset_meters'
|
|
26
|
+
@_hash
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# An array for optional fields
|
|
30
|
+
def self.optionals
|
|
31
|
+
[]
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# An array for nullable fields
|
|
35
|
+
def self.nullables
|
|
36
|
+
[]
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def initialize(speed_category:, offset_meters:, additional_properties: nil)
|
|
40
|
+
# Add additional model properties to the instance
|
|
41
|
+
additional_properties = {} if additional_properties.nil?
|
|
42
|
+
|
|
43
|
+
@speed_category = speed_category
|
|
44
|
+
@offset_meters = offset_meters
|
|
45
|
+
@additional_properties = additional_properties
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Creates an instance of the object from a hash.
|
|
49
|
+
def self.from_hash(hash)
|
|
50
|
+
return nil unless hash
|
|
51
|
+
|
|
52
|
+
# Extract variables from the hash.
|
|
53
|
+
speed_category =
|
|
54
|
+
hash.key?('speed_category') ? hash['speed_category'] : nil
|
|
55
|
+
offset_meters = hash.key?('offset_meters') ? hash['offset_meters'] : nil
|
|
56
|
+
|
|
57
|
+
# Create a new hash for additional properties, removing known properties.
|
|
58
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
59
|
+
|
|
60
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
61
|
+
new_hash, proc { |value| value }
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
# Create object from extracted values.
|
|
65
|
+
DirectionsTrafficSpeedEntry.new(speed_category: speed_category,
|
|
66
|
+
offset_meters: offset_meters,
|
|
67
|
+
additional_properties: additional_properties)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Provides a human-readable string representation of the object.
|
|
71
|
+
def to_s
|
|
72
|
+
class_name = self.class.name.split('::').last
|
|
73
|
+
"<#{class_name} speed_category: #{@speed_category}, offset_meters: #{@offset_meters},"\
|
|
74
|
+
" additional_properties: #{@additional_properties}>"
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
78
|
+
def inspect
|
|
79
|
+
class_name = self.class.name.split('::').last
|
|
80
|
+
"<#{class_name} speed_category: #{@speed_category.inspect}, offset_meters:"\
|
|
81
|
+
" #{@offset_meters.inspect}, additional_properties: #{@additional_properties}>"
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
@@ -0,0 +1,95 @@
|
|
|
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
|
+
# DirectionsTransitAgency Model.
|
|
8
|
+
class DirectionsTransitAgency < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# The name of this transit agency.
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :name
|
|
15
|
+
|
|
16
|
+
# The transit agency's phone number.
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :phone
|
|
19
|
+
|
|
20
|
+
# The transit agency's URL.
|
|
21
|
+
# @return [String]
|
|
22
|
+
attr_accessor :url
|
|
23
|
+
|
|
24
|
+
# A mapping from model property names to API property names.
|
|
25
|
+
def self.names
|
|
26
|
+
@_hash = {} if @_hash.nil?
|
|
27
|
+
@_hash['name'] = 'name'
|
|
28
|
+
@_hash['phone'] = 'phone'
|
|
29
|
+
@_hash['url'] = 'url'
|
|
30
|
+
@_hash
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# An array for optional fields
|
|
34
|
+
def self.optionals
|
|
35
|
+
%w[
|
|
36
|
+
name
|
|
37
|
+
phone
|
|
38
|
+
url
|
|
39
|
+
]
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# An array for nullable fields
|
|
43
|
+
def self.nullables
|
|
44
|
+
[]
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def initialize(name: SKIP, phone: SKIP, url: SKIP,
|
|
48
|
+
additional_properties: nil)
|
|
49
|
+
# Add additional model properties to the instance
|
|
50
|
+
additional_properties = {} if additional_properties.nil?
|
|
51
|
+
|
|
52
|
+
@name = name unless name == SKIP
|
|
53
|
+
@phone = phone unless phone == SKIP
|
|
54
|
+
@url = url unless url == SKIP
|
|
55
|
+
@additional_properties = additional_properties
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Creates an instance of the object from a hash.
|
|
59
|
+
def self.from_hash(hash)
|
|
60
|
+
return nil unless hash
|
|
61
|
+
|
|
62
|
+
# Extract variables from the hash.
|
|
63
|
+
name = hash.key?('name') ? hash['name'] : SKIP
|
|
64
|
+
phone = hash.key?('phone') ? hash['phone'] : SKIP
|
|
65
|
+
url = hash.key?('url') ? hash['url'] : SKIP
|
|
66
|
+
|
|
67
|
+
# Create a new hash for additional properties, removing known properties.
|
|
68
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
69
|
+
|
|
70
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
71
|
+
new_hash, proc { |value| value }
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
# Create object from extracted values.
|
|
75
|
+
DirectionsTransitAgency.new(name: name,
|
|
76
|
+
phone: phone,
|
|
77
|
+
url: url,
|
|
78
|
+
additional_properties: additional_properties)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Provides a human-readable string representation of the object.
|
|
82
|
+
def to_s
|
|
83
|
+
class_name = self.class.name.split('::').last
|
|
84
|
+
"<#{class_name} name: #{@name}, phone: #{@phone}, url: #{@url}, additional_properties:"\
|
|
85
|
+
" #{@additional_properties}>"
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
89
|
+
def inspect
|
|
90
|
+
class_name = self.class.name.split('::').last
|
|
91
|
+
"<#{class_name} name: #{@name.inspect}, phone: #{@phone.inspect}, url: #{@url.inspect},"\
|
|
92
|
+
" additional_properties: #{@additional_properties}>"
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|