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,117 @@
|
|
|
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 object describing the location.
|
|
8
|
+
class GeocodingGeometry < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# An object describing a specific location with Latitude and Longitude in
|
|
13
|
+
# decimal degrees.
|
|
14
|
+
# @return [LatLngLiteral]
|
|
15
|
+
attr_accessor :location
|
|
16
|
+
|
|
17
|
+
# Stores additional data about the specified location. The following values
|
|
18
|
+
# are currently supported:
|
|
19
|
+
# - "ROOFTOP" indicates that the returned result is a precise geocode for
|
|
20
|
+
# which we have location information accurate down to street address
|
|
21
|
+
# precision.
|
|
22
|
+
# - "RANGE_INTERPOLATED" indicates that the returned result reflects an
|
|
23
|
+
# approximation (usually on a road) interpolated between two precise points
|
|
24
|
+
# (such as intersections). Interpolated results are generally returned when
|
|
25
|
+
# rooftop geocodes are unavailable for a street address.
|
|
26
|
+
# - "GEOMETRIC_CENTER" indicates that the returned result is the geometric
|
|
27
|
+
# center of a result such as a polyline (for example, a street) or polygon
|
|
28
|
+
# (region).
|
|
29
|
+
# - "APPROXIMATE" indicates that the returned result is approximate.
|
|
30
|
+
# @return [LocationType]
|
|
31
|
+
attr_accessor :location_type
|
|
32
|
+
|
|
33
|
+
# A rectangle in geographical coordinates from points at the southwest and
|
|
34
|
+
# northeast corners.
|
|
35
|
+
# @return [Bounds]
|
|
36
|
+
attr_accessor :bounds
|
|
37
|
+
|
|
38
|
+
# A rectangle in geographical coordinates from points at the southwest and
|
|
39
|
+
# northeast corners.
|
|
40
|
+
# @return [Bounds]
|
|
41
|
+
attr_accessor :viewport
|
|
42
|
+
|
|
43
|
+
# A mapping from model property names to API property names.
|
|
44
|
+
def self.names
|
|
45
|
+
@_hash = {} if @_hash.nil?
|
|
46
|
+
@_hash['location'] = 'location'
|
|
47
|
+
@_hash['location_type'] = 'location_type'
|
|
48
|
+
@_hash['bounds'] = 'bounds'
|
|
49
|
+
@_hash['viewport'] = 'viewport'
|
|
50
|
+
@_hash
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# An array for optional fields
|
|
54
|
+
def self.optionals
|
|
55
|
+
%w[
|
|
56
|
+
bounds
|
|
57
|
+
]
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# An array for nullable fields
|
|
61
|
+
def self.nullables
|
|
62
|
+
[]
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def initialize(location:, location_type:, viewport:, bounds: SKIP,
|
|
66
|
+
additional_properties: nil)
|
|
67
|
+
# Add additional model properties to the instance
|
|
68
|
+
additional_properties = {} if additional_properties.nil?
|
|
69
|
+
|
|
70
|
+
@location = location
|
|
71
|
+
@location_type = location_type
|
|
72
|
+
@bounds = bounds unless bounds == SKIP
|
|
73
|
+
@viewport = viewport
|
|
74
|
+
@additional_properties = additional_properties
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Creates an instance of the object from a hash.
|
|
78
|
+
def self.from_hash(hash)
|
|
79
|
+
return nil unless hash
|
|
80
|
+
|
|
81
|
+
# Extract variables from the hash.
|
|
82
|
+
location = LatLngLiteral.from_hash(hash['location']) if hash['location']
|
|
83
|
+
location_type = hash.key?('location_type') ? hash['location_type'] : nil
|
|
84
|
+
viewport = Bounds.from_hash(hash['viewport']) if hash['viewport']
|
|
85
|
+
bounds = Bounds.from_hash(hash['bounds']) if hash['bounds']
|
|
86
|
+
|
|
87
|
+
# Create a new hash for additional properties, removing known properties.
|
|
88
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
89
|
+
|
|
90
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
91
|
+
new_hash, proc { |value| value }
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
# Create object from extracted values.
|
|
95
|
+
GeocodingGeometry.new(location: location,
|
|
96
|
+
location_type: location_type,
|
|
97
|
+
viewport: viewport,
|
|
98
|
+
bounds: bounds,
|
|
99
|
+
additional_properties: additional_properties)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Provides a human-readable string representation of the object.
|
|
103
|
+
def to_s
|
|
104
|
+
class_name = self.class.name.split('::').last
|
|
105
|
+
"<#{class_name} location: #{@location}, location_type: #{@location_type}, bounds:"\
|
|
106
|
+
" #{@bounds}, viewport: #{@viewport}, additional_properties: #{@additional_properties}>"
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
110
|
+
def inspect
|
|
111
|
+
class_name = self.class.name.split('::').last
|
|
112
|
+
"<#{class_name} location: #{@location.inspect}, location_type: #{@location_type.inspect},"\
|
|
113
|
+
" bounds: #{@bounds.inspect}, viewport: #{@viewport.inspect}, additional_properties:"\
|
|
114
|
+
" #{@additional_properties}>"
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
end
|
|
@@ -0,0 +1,140 @@
|
|
|
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
|
+
# GeocodingResponse Model.
|
|
8
|
+
class GeocodingResponse < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# An encoded location reference, derived from latitude and longitude
|
|
13
|
+
# coordinates, that represents an area, 1/8000th of a degree by 1/8000th of
|
|
14
|
+
# a degree (about 14m x 14m at the equator) or smaller. Plus codes can be
|
|
15
|
+
# used as a replacement for street addresses in places where they do not
|
|
16
|
+
# exist (where buildings are not numbered or streets are not named).
|
|
17
|
+
# @return [PlusCode]
|
|
18
|
+
attr_accessor :plus_code
|
|
19
|
+
|
|
20
|
+
# An encoded location reference, derived from latitude and longitude
|
|
21
|
+
# coordinates, that represents an area, 1/8000th of a degree by 1/8000th of
|
|
22
|
+
# a degree (about 14m x 14m at the equator) or smaller. Plus codes can be
|
|
23
|
+
# used as a replacement for street addresses in places where they do not
|
|
24
|
+
# exist (where buildings are not numbered or streets are not named).
|
|
25
|
+
# @return [Array[GeocodingResult]]
|
|
26
|
+
attr_accessor :results
|
|
27
|
+
|
|
28
|
+
# The `status` field within the Geocoding response object contains the
|
|
29
|
+
# status of the request, and may contain debugging information to help you
|
|
30
|
+
# track down why geocoding is not working. The "status" field may contain
|
|
31
|
+
# the following values:
|
|
32
|
+
# - `OK` indicates that no errors occurred; the address was successfully
|
|
33
|
+
# parsed and at least one geocode was returned.
|
|
34
|
+
# - `ZERO_RESULTS` indicates that the geocode was successful but returned no
|
|
35
|
+
# results. This may occur if the geocoder was passed a non-existent address
|
|
36
|
+
# or a `latlng` in a remote location.
|
|
37
|
+
# - `OVER_DAILY_LIMIT` indicates any of the following:
|
|
38
|
+
# - The API key is missing or invalid.
|
|
39
|
+
# - Billing has not been enabled on your account.
|
|
40
|
+
# - A self-imposed usage cap has been exceeded.
|
|
41
|
+
# - The provided method of payment is no longer valid (for example, a
|
|
42
|
+
# credit card has expired).
|
|
43
|
+
# - `OVER_QUERY_LIMIT` indicates that you are over your quota.
|
|
44
|
+
# - `REQUEST_DENIED` indicates that your request was denied.
|
|
45
|
+
# - `INVALID_REQUEST` generally indicates that the query (address,
|
|
46
|
+
# components, or latlng) is missing.
|
|
47
|
+
# - `UNKNOWN_ERROR` indicates that the request could not be processed due to
|
|
48
|
+
# a server error. The request may succeed if you try again.
|
|
49
|
+
# @return [GeocodingStatus]
|
|
50
|
+
attr_accessor :status
|
|
51
|
+
|
|
52
|
+
# A short description of the error.
|
|
53
|
+
# @return [String]
|
|
54
|
+
attr_accessor :error_message
|
|
55
|
+
|
|
56
|
+
# A mapping from model property names to API property names.
|
|
57
|
+
def self.names
|
|
58
|
+
@_hash = {} if @_hash.nil?
|
|
59
|
+
@_hash['plus_code'] = 'plus_code'
|
|
60
|
+
@_hash['results'] = 'results'
|
|
61
|
+
@_hash['status'] = 'status'
|
|
62
|
+
@_hash['error_message'] = 'error_message'
|
|
63
|
+
@_hash
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# An array for optional fields
|
|
67
|
+
def self.optionals
|
|
68
|
+
%w[
|
|
69
|
+
plus_code
|
|
70
|
+
error_message
|
|
71
|
+
]
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# An array for nullable fields
|
|
75
|
+
def self.nullables
|
|
76
|
+
[]
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def initialize(results:, status:, plus_code: SKIP, error_message: SKIP,
|
|
80
|
+
additional_properties: nil)
|
|
81
|
+
# Add additional model properties to the instance
|
|
82
|
+
additional_properties = {} if additional_properties.nil?
|
|
83
|
+
|
|
84
|
+
@plus_code = plus_code unless plus_code == SKIP
|
|
85
|
+
@results = results
|
|
86
|
+
@status = status
|
|
87
|
+
@error_message = error_message unless error_message == SKIP
|
|
88
|
+
@additional_properties = additional_properties
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Creates an instance of the object from a hash.
|
|
92
|
+
def self.from_hash(hash)
|
|
93
|
+
return nil unless hash
|
|
94
|
+
|
|
95
|
+
# Extract variables from the hash.
|
|
96
|
+
# Parameter is an array, so we need to iterate through it
|
|
97
|
+
results = nil
|
|
98
|
+
unless hash['results'].nil?
|
|
99
|
+
results = []
|
|
100
|
+
hash['results'].each do |structure|
|
|
101
|
+
results << (GeocodingResult.from_hash(structure) if structure)
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
results = nil unless hash.key?('results')
|
|
106
|
+
status = hash.key?('status') ? hash['status'] : nil
|
|
107
|
+
plus_code = PlusCode.from_hash(hash['plus_code']) if hash['plus_code']
|
|
108
|
+
error_message = hash.key?('error_message') ? hash['error_message'] : SKIP
|
|
109
|
+
|
|
110
|
+
# Create a new hash for additional properties, removing known properties.
|
|
111
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
112
|
+
|
|
113
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
114
|
+
new_hash, proc { |value| value }
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
# Create object from extracted values.
|
|
118
|
+
GeocodingResponse.new(results: results,
|
|
119
|
+
status: status,
|
|
120
|
+
plus_code: plus_code,
|
|
121
|
+
error_message: error_message,
|
|
122
|
+
additional_properties: additional_properties)
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# Provides a human-readable string representation of the object.
|
|
126
|
+
def to_s
|
|
127
|
+
class_name = self.class.name.split('::').last
|
|
128
|
+
"<#{class_name} plus_code: #{@plus_code}, results: #{@results}, status: #{@status},"\
|
|
129
|
+
" error_message: #{@error_message}, additional_properties: #{@additional_properties}>"
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
133
|
+
def inspect
|
|
134
|
+
class_name = self.class.name.split('::').last
|
|
135
|
+
"<#{class_name} plus_code: #{@plus_code.inspect}, results: #{@results.inspect}, status:"\
|
|
136
|
+
" #{@status.inspect}, error_message: #{@error_message.inspect}, additional_properties:"\
|
|
137
|
+
" #{@additional_properties}>"
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
end
|
|
@@ -0,0 +1,174 @@
|
|
|
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
|
+
# GeocodingResult Model.
|
|
8
|
+
class GeocodingResult < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# An array containing the separate components applicable to this address.
|
|
13
|
+
# @return [Array[AddressComponent]]
|
|
14
|
+
attr_accessor :address_components
|
|
15
|
+
|
|
16
|
+
# The human-readable address of this location.
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :formatted_address
|
|
19
|
+
|
|
20
|
+
# An object describing the location.
|
|
21
|
+
# @return [GeocodingGeometry]
|
|
22
|
+
attr_accessor :geometry
|
|
23
|
+
|
|
24
|
+
# A unique identifier that can be used with other Google APIs. For example,
|
|
25
|
+
# you can use the `place_id` in a Places API request to get details of a
|
|
26
|
+
# local business, such as phone number, opening hours, user reviews, and
|
|
27
|
+
# more. See the [place ID
|
|
28
|
+
# overview](https://developers.google.com/places/place-id).
|
|
29
|
+
# @return [String]
|
|
30
|
+
attr_accessor :place_id
|
|
31
|
+
|
|
32
|
+
# An encoded location reference, derived from latitude and longitude
|
|
33
|
+
# coordinates, that represents an area, 1/8000th of a degree by 1/8000th of
|
|
34
|
+
# a degree (about 14m x 14m at the equator) or smaller. Plus codes can be
|
|
35
|
+
# used as a replacement for street addresses in places where they do not
|
|
36
|
+
# exist (where buildings are not numbered or streets are not named).
|
|
37
|
+
# @return [PlusCode]
|
|
38
|
+
attr_accessor :plus_code
|
|
39
|
+
|
|
40
|
+
# The `types[]` array indicates the type of the returned result. This array
|
|
41
|
+
# contains a set of zero or more tags identifying the type of feature
|
|
42
|
+
# returned in the result. For example, a geocode of "Chicago" returns
|
|
43
|
+
# "locality" which indicates that "Chicago" is a city, and also returns
|
|
44
|
+
# "political" which indicates it is a political entity.
|
|
45
|
+
# @return [Array[String]]
|
|
46
|
+
attr_accessor :types
|
|
47
|
+
|
|
48
|
+
# An array denoting all the localities contained in a postal code. This is
|
|
49
|
+
# only present when the result is a postal code that contains multiple
|
|
50
|
+
# localities.
|
|
51
|
+
# @return [Array[String]]
|
|
52
|
+
attr_accessor :postcode_localities
|
|
53
|
+
|
|
54
|
+
# Indicates that the geocoder did not return an exact match for the original
|
|
55
|
+
# request, though it was able to match part of the requested address. You
|
|
56
|
+
# may wish to examine the original request for misspellings and/or an
|
|
57
|
+
# incomplete address.
|
|
58
|
+
# Partial matches most often occur for street addresses that do not exist
|
|
59
|
+
# within the locality you pass in the request. Partial matches may also be
|
|
60
|
+
# returned when a request matches two or more locations in the same
|
|
61
|
+
# locality.
|
|
62
|
+
# @return [TrueClass | FalseClass]
|
|
63
|
+
attr_accessor :partial_match
|
|
64
|
+
|
|
65
|
+
# A mapping from model property names to API property names.
|
|
66
|
+
def self.names
|
|
67
|
+
@_hash = {} if @_hash.nil?
|
|
68
|
+
@_hash['address_components'] = 'address_components'
|
|
69
|
+
@_hash['formatted_address'] = 'formatted_address'
|
|
70
|
+
@_hash['geometry'] = 'geometry'
|
|
71
|
+
@_hash['place_id'] = 'place_id'
|
|
72
|
+
@_hash['plus_code'] = 'plus_code'
|
|
73
|
+
@_hash['types'] = 'types'
|
|
74
|
+
@_hash['postcode_localities'] = 'postcode_localities'
|
|
75
|
+
@_hash['partial_match'] = 'partial_match'
|
|
76
|
+
@_hash
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# An array for optional fields
|
|
80
|
+
def self.optionals
|
|
81
|
+
%w[
|
|
82
|
+
plus_code
|
|
83
|
+
postcode_localities
|
|
84
|
+
partial_match
|
|
85
|
+
]
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# An array for nullable fields
|
|
89
|
+
def self.nullables
|
|
90
|
+
[]
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def initialize(address_components:, formatted_address:, geometry:,
|
|
94
|
+
place_id:, types:, plus_code: SKIP,
|
|
95
|
+
postcode_localities: SKIP, partial_match: SKIP,
|
|
96
|
+
additional_properties: nil)
|
|
97
|
+
# Add additional model properties to the instance
|
|
98
|
+
additional_properties = {} if additional_properties.nil?
|
|
99
|
+
|
|
100
|
+
@address_components = address_components
|
|
101
|
+
@formatted_address = formatted_address
|
|
102
|
+
@geometry = geometry
|
|
103
|
+
@place_id = place_id
|
|
104
|
+
@plus_code = plus_code unless plus_code == SKIP
|
|
105
|
+
@types = types
|
|
106
|
+
@postcode_localities = postcode_localities unless postcode_localities == SKIP
|
|
107
|
+
@partial_match = partial_match unless partial_match == SKIP
|
|
108
|
+
@additional_properties = additional_properties
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# Creates an instance of the object from a hash.
|
|
112
|
+
def self.from_hash(hash)
|
|
113
|
+
return nil unless hash
|
|
114
|
+
|
|
115
|
+
# Extract variables from the hash.
|
|
116
|
+
# Parameter is an array, so we need to iterate through it
|
|
117
|
+
address_components = nil
|
|
118
|
+
unless hash['address_components'].nil?
|
|
119
|
+
address_components = []
|
|
120
|
+
hash['address_components'].each do |structure|
|
|
121
|
+
address_components << (AddressComponent.from_hash(structure) if structure)
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
address_components = nil unless hash.key?('address_components')
|
|
126
|
+
formatted_address =
|
|
127
|
+
hash.key?('formatted_address') ? hash['formatted_address'] : nil
|
|
128
|
+
geometry = GeocodingGeometry.from_hash(hash['geometry']) if hash['geometry']
|
|
129
|
+
place_id = hash.key?('place_id') ? hash['place_id'] : nil
|
|
130
|
+
types = hash.key?('types') ? hash['types'] : nil
|
|
131
|
+
plus_code = PlusCode.from_hash(hash['plus_code']) if hash['plus_code']
|
|
132
|
+
postcode_localities =
|
|
133
|
+
hash.key?('postcode_localities') ? hash['postcode_localities'] : SKIP
|
|
134
|
+
partial_match = hash.key?('partial_match') ? hash['partial_match'] : SKIP
|
|
135
|
+
|
|
136
|
+
# Create a new hash for additional properties, removing known properties.
|
|
137
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
138
|
+
|
|
139
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
140
|
+
new_hash, proc { |value| value }
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
# Create object from extracted values.
|
|
144
|
+
GeocodingResult.new(address_components: address_components,
|
|
145
|
+
formatted_address: formatted_address,
|
|
146
|
+
geometry: geometry,
|
|
147
|
+
place_id: place_id,
|
|
148
|
+
types: types,
|
|
149
|
+
plus_code: plus_code,
|
|
150
|
+
postcode_localities: postcode_localities,
|
|
151
|
+
partial_match: partial_match,
|
|
152
|
+
additional_properties: additional_properties)
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# Provides a human-readable string representation of the object.
|
|
156
|
+
def to_s
|
|
157
|
+
class_name = self.class.name.split('::').last
|
|
158
|
+
"<#{class_name} address_components: #{@address_components}, formatted_address:"\
|
|
159
|
+
" #{@formatted_address}, geometry: #{@geometry}, place_id: #{@place_id}, plus_code:"\
|
|
160
|
+
" #{@plus_code}, types: #{@types}, postcode_localities: #{@postcode_localities},"\
|
|
161
|
+
" partial_match: #{@partial_match}, additional_properties: #{@additional_properties}>"
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
165
|
+
def inspect
|
|
166
|
+
class_name = self.class.name.split('::').last
|
|
167
|
+
"<#{class_name} address_components: #{@address_components.inspect}, formatted_address:"\
|
|
168
|
+
" #{@formatted_address.inspect}, geometry: #{@geometry.inspect}, place_id:"\
|
|
169
|
+
" #{@place_id.inspect}, plus_code: #{@plus_code.inspect}, types: #{@types.inspect},"\
|
|
170
|
+
" postcode_localities: #{@postcode_localities.inspect}, partial_match:"\
|
|
171
|
+
" #{@partial_match.inspect}, additional_properties: #{@additional_properties}>"
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
end
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# google_maps_platform
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC
|
|
4
|
+
# v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module GoogleMapsPlatform
|
|
7
|
+
# The `status` field within the Geocoding response object contains the status
|
|
8
|
+
# of the request, and may contain debugging information to help you track down
|
|
9
|
+
# why geocoding is not working. The "status" field may contain the following
|
|
10
|
+
# values: - `OK` indicates that no errors occurred; the address was
|
|
11
|
+
# successfully parsed and at least one geocode was returned. - `ZERO_RESULTS`
|
|
12
|
+
# indicates that the geocode was successful but returned no results. This may
|
|
13
|
+
# occur if the geocoder was passed a non-existent address or a `latlng` in a
|
|
14
|
+
# remote location. - `OVER_DAILY_LIMIT` indicates any of the following: -
|
|
15
|
+
# The API key is missing or invalid. - Billing has not been enabled on your
|
|
16
|
+
# account. - A self-imposed usage cap has been exceeded. - The provided
|
|
17
|
+
# method of payment is no longer valid (for example, a credit card has
|
|
18
|
+
# expired). - `OVER_QUERY_LIMIT` indicates that you are over your quota. -
|
|
19
|
+
# `REQUEST_DENIED` indicates that your request was denied. - `INVALID_REQUEST`
|
|
20
|
+
# generally indicates that the query (address, components, or latlng) is
|
|
21
|
+
# missing. - `UNKNOWN_ERROR` indicates that the request could not be processed
|
|
22
|
+
# due to a server error. The request may succeed if you try again.
|
|
23
|
+
class GeocodingStatus
|
|
24
|
+
GEOCODING_STATUS = [
|
|
25
|
+
# TODO: Write general description for OK
|
|
26
|
+
OK = 'OK'.freeze,
|
|
27
|
+
|
|
28
|
+
# TODO: Write general description for INVALID_REQUEST
|
|
29
|
+
INVALID_REQUEST = 'INVALID_REQUEST'.freeze,
|
|
30
|
+
|
|
31
|
+
# TODO: Write general description for OVER_DAILY_LIMIT
|
|
32
|
+
OVER_DAILY_LIMIT = 'OVER_DAILY_LIMIT'.freeze,
|
|
33
|
+
|
|
34
|
+
# TODO: Write general description for OVER_QUERY_LIMIT
|
|
35
|
+
OVER_QUERY_LIMIT = 'OVER_QUERY_LIMIT'.freeze,
|
|
36
|
+
|
|
37
|
+
# TODO: Write general description for REQUEST_DENIED
|
|
38
|
+
REQUEST_DENIED = 'REQUEST_DENIED'.freeze,
|
|
39
|
+
|
|
40
|
+
# TODO: Write general description for UNKNOWN_ERROR
|
|
41
|
+
UNKNOWN_ERROR = 'UNKNOWN_ERROR'.freeze,
|
|
42
|
+
|
|
43
|
+
# TODO: Write general description for ZERO_RESULTS
|
|
44
|
+
ZERO_RESULTS = 'ZERO_RESULTS'.freeze
|
|
45
|
+
].freeze
|
|
46
|
+
|
|
47
|
+
def self.validate(value)
|
|
48
|
+
return false if value.nil?
|
|
49
|
+
|
|
50
|
+
GEOCODING_STATUS.include?(value)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def self.from_value(value, default_value = OK)
|
|
54
|
+
return default_value if value.nil?
|
|
55
|
+
|
|
56
|
+
str = value.to_s.strip
|
|
57
|
+
|
|
58
|
+
case str.downcase
|
|
59
|
+
when 'ok' then OK
|
|
60
|
+
when 'invalid_request' then INVALID_REQUEST
|
|
61
|
+
when 'over_daily_limit' then OVER_DAILY_LIMIT
|
|
62
|
+
when 'over_query_limit' then OVER_QUERY_LIMIT
|
|
63
|
+
when 'request_denied' then REQUEST_DENIED
|
|
64
|
+
when 'unknown_error' then UNKNOWN_ERROR
|
|
65
|
+
when 'zero_results' then ZERO_RESULTS
|
|
66
|
+
else
|
|
67
|
+
default_value
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
@@ -0,0 +1,166 @@
|
|
|
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 request body must be formatted as JSON. The following fields are
|
|
8
|
+
# supported, and all fields are optional.
|
|
9
|
+
class GeolocationRequest < BaseModel
|
|
10
|
+
SKIP = Object.new
|
|
11
|
+
private_constant :SKIP
|
|
12
|
+
|
|
13
|
+
# The cell tower's Mobile Country Code (MCC).
|
|
14
|
+
# @return [Integer]
|
|
15
|
+
attr_accessor :home_mobile_country_code
|
|
16
|
+
|
|
17
|
+
# The cell tower's Mobile Network Code. This is the MNC for GSM and WCDMA;
|
|
18
|
+
# CDMA uses the System ID (SID).
|
|
19
|
+
# @return [Integer]
|
|
20
|
+
attr_accessor :home_mobile_network_code
|
|
21
|
+
|
|
22
|
+
# The mobile radio type. Supported values are lte, gsm, cdma, and wcdma.
|
|
23
|
+
# While this field is optional, it should be included if a value is
|
|
24
|
+
# available, for more accurate results.
|
|
25
|
+
# @return [String]
|
|
26
|
+
attr_accessor :radio_type
|
|
27
|
+
|
|
28
|
+
# The carrier name.
|
|
29
|
+
# @return [String]
|
|
30
|
+
attr_accessor :carrier
|
|
31
|
+
|
|
32
|
+
# Specifies whether to fall back to IP geolocation if wifi and cell tower
|
|
33
|
+
# signals are not available. Defaults to true. Set considerIp to false to
|
|
34
|
+
# disable fall back.
|
|
35
|
+
# @return [String]
|
|
36
|
+
attr_accessor :consider_ip
|
|
37
|
+
|
|
38
|
+
# The request body's cellTowers array contains zero or more cell tower
|
|
39
|
+
# objects.
|
|
40
|
+
# @return [Array[CellTower]]
|
|
41
|
+
attr_accessor :cell_towers
|
|
42
|
+
|
|
43
|
+
# An array of two or more WiFi access point objects.
|
|
44
|
+
# @return [Array[WiFiAccessPoint]]
|
|
45
|
+
attr_accessor :wifi_access_points
|
|
46
|
+
|
|
47
|
+
# A mapping from model property names to API property names.
|
|
48
|
+
def self.names
|
|
49
|
+
@_hash = {} if @_hash.nil?
|
|
50
|
+
@_hash['home_mobile_country_code'] = 'homeMobileCountryCode'
|
|
51
|
+
@_hash['home_mobile_network_code'] = 'homeMobileNetworkCode'
|
|
52
|
+
@_hash['radio_type'] = 'radioType'
|
|
53
|
+
@_hash['carrier'] = 'carrier'
|
|
54
|
+
@_hash['consider_ip'] = 'considerIp'
|
|
55
|
+
@_hash['cell_towers'] = 'cellTowers'
|
|
56
|
+
@_hash['wifi_access_points'] = 'wifiAccessPoints'
|
|
57
|
+
@_hash
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# An array for optional fields
|
|
61
|
+
def self.optionals
|
|
62
|
+
%w[
|
|
63
|
+
home_mobile_country_code
|
|
64
|
+
home_mobile_network_code
|
|
65
|
+
radio_type
|
|
66
|
+
carrier
|
|
67
|
+
consider_ip
|
|
68
|
+
cell_towers
|
|
69
|
+
wifi_access_points
|
|
70
|
+
]
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# An array for nullable fields
|
|
74
|
+
def self.nullables
|
|
75
|
+
[]
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def initialize(home_mobile_country_code: SKIP,
|
|
79
|
+
home_mobile_network_code: SKIP, radio_type: SKIP,
|
|
80
|
+
carrier: SKIP, consider_ip: SKIP, cell_towers: SKIP,
|
|
81
|
+
wifi_access_points: SKIP, additional_properties: nil)
|
|
82
|
+
# Add additional model properties to the instance
|
|
83
|
+
additional_properties = {} if additional_properties.nil?
|
|
84
|
+
|
|
85
|
+
@home_mobile_country_code = home_mobile_country_code unless home_mobile_country_code == SKIP
|
|
86
|
+
@home_mobile_network_code = home_mobile_network_code unless home_mobile_network_code == SKIP
|
|
87
|
+
@radio_type = radio_type unless radio_type == SKIP
|
|
88
|
+
@carrier = carrier unless carrier == SKIP
|
|
89
|
+
@consider_ip = consider_ip unless consider_ip == SKIP
|
|
90
|
+
@cell_towers = cell_towers unless cell_towers == SKIP
|
|
91
|
+
@wifi_access_points = wifi_access_points unless wifi_access_points == SKIP
|
|
92
|
+
@additional_properties = additional_properties
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Creates an instance of the object from a hash.
|
|
96
|
+
def self.from_hash(hash)
|
|
97
|
+
return nil unless hash
|
|
98
|
+
|
|
99
|
+
# Extract variables from the hash.
|
|
100
|
+
home_mobile_country_code =
|
|
101
|
+
hash.key?('homeMobileCountryCode') ? hash['homeMobileCountryCode'] : SKIP
|
|
102
|
+
home_mobile_network_code =
|
|
103
|
+
hash.key?('homeMobileNetworkCode') ? hash['homeMobileNetworkCode'] : SKIP
|
|
104
|
+
radio_type = hash.key?('radioType') ? hash['radioType'] : SKIP
|
|
105
|
+
carrier = hash.key?('carrier') ? hash['carrier'] : SKIP
|
|
106
|
+
consider_ip = hash.key?('considerIp') ? hash['considerIp'] : SKIP
|
|
107
|
+
# Parameter is an array, so we need to iterate through it
|
|
108
|
+
cell_towers = nil
|
|
109
|
+
unless hash['cellTowers'].nil?
|
|
110
|
+
cell_towers = []
|
|
111
|
+
hash['cellTowers'].each do |structure|
|
|
112
|
+
cell_towers << (CellTower.from_hash(structure) if structure)
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
cell_towers = SKIP unless hash.key?('cellTowers')
|
|
117
|
+
# Parameter is an array, so we need to iterate through it
|
|
118
|
+
wifi_access_points = nil
|
|
119
|
+
unless hash['wifiAccessPoints'].nil?
|
|
120
|
+
wifi_access_points = []
|
|
121
|
+
hash['wifiAccessPoints'].each do |structure|
|
|
122
|
+
wifi_access_points << (WiFiAccessPoint.from_hash(structure) if structure)
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
wifi_access_points = SKIP unless hash.key?('wifiAccessPoints')
|
|
127
|
+
|
|
128
|
+
# Create a new hash for additional properties, removing known properties.
|
|
129
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
130
|
+
|
|
131
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
132
|
+
new_hash, proc { |value| value }
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
# Create object from extracted values.
|
|
136
|
+
GeolocationRequest.new(home_mobile_country_code: home_mobile_country_code,
|
|
137
|
+
home_mobile_network_code: home_mobile_network_code,
|
|
138
|
+
radio_type: radio_type,
|
|
139
|
+
carrier: carrier,
|
|
140
|
+
consider_ip: consider_ip,
|
|
141
|
+
cell_towers: cell_towers,
|
|
142
|
+
wifi_access_points: wifi_access_points,
|
|
143
|
+
additional_properties: additional_properties)
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# Provides a human-readable string representation of the object.
|
|
147
|
+
def to_s
|
|
148
|
+
class_name = self.class.name.split('::').last
|
|
149
|
+
"<#{class_name} home_mobile_country_code: #{@home_mobile_country_code},"\
|
|
150
|
+
" home_mobile_network_code: #{@home_mobile_network_code}, radio_type: #{@radio_type},"\
|
|
151
|
+
" carrier: #{@carrier}, consider_ip: #{@consider_ip}, cell_towers: #{@cell_towers},"\
|
|
152
|
+
" wifi_access_points: #{@wifi_access_points}, additional_properties:"\
|
|
153
|
+
" #{@additional_properties}>"
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
157
|
+
def inspect
|
|
158
|
+
class_name = self.class.name.split('::').last
|
|
159
|
+
"<#{class_name} home_mobile_country_code: #{@home_mobile_country_code.inspect},"\
|
|
160
|
+
" home_mobile_network_code: #{@home_mobile_network_code.inspect}, radio_type:"\
|
|
161
|
+
" #{@radio_type.inspect}, carrier: #{@carrier.inspect}, consider_ip:"\
|
|
162
|
+
" #{@consider_ip.inspect}, cell_towers: #{@cell_towers.inspect}, wifi_access_points:"\
|
|
163
|
+
" #{@wifi_access_points.inspect}, additional_properties: #{@additional_properties}>"
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
end
|