google-maps-api-sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +169 -0
  4. data/bin/console +15 -0
  5. data/lib/google_maps_platform/api_helper.rb +10 -0
  6. data/lib/google_maps_platform/client.rb +123 -0
  7. data/lib/google_maps_platform/configuration.rb +181 -0
  8. data/lib/google_maps_platform/controllers/base_controller.rb +67 -0
  9. data/lib/google_maps_platform/controllers/directions_api_controller.rb +341 -0
  10. data/lib/google_maps_platform/controllers/distance_matrix_api_controller.rb +224 -0
  11. data/lib/google_maps_platform/controllers/elevation_api_controller.rb +71 -0
  12. data/lib/google_maps_platform/controllers/geocoding_api_controller.rb +214 -0
  13. data/lib/google_maps_platform/controllers/geolocation_api_controller.rb +46 -0
  14. data/lib/google_maps_platform/controllers/places_api_controller.rb +866 -0
  15. data/lib/google_maps_platform/controllers/roads_api_controller.rb +81 -0
  16. data/lib/google_maps_platform/controllers/street_view_api_controller.rb +198 -0
  17. data/lib/google_maps_platform/controllers/time_zone_api_controller.rb +65 -0
  18. data/lib/google_maps_platform/exceptions/api_exception.rb +21 -0
  19. data/lib/google_maps_platform/exceptions/error_response_exception.rb +48 -0
  20. data/lib/google_maps_platform/exceptions/nearest_roads_error_response_exception.rb +46 -0
  21. data/lib/google_maps_platform/http/api_response.rb +19 -0
  22. data/lib/google_maps_platform/http/auth/custom_query_authentication.rb +52 -0
  23. data/lib/google_maps_platform/http/http_call_back.rb +10 -0
  24. data/lib/google_maps_platform/http/http_method_enum.rb +10 -0
  25. data/lib/google_maps_platform/http/http_request.rb +10 -0
  26. data/lib/google_maps_platform/http/http_response.rb +10 -0
  27. data/lib/google_maps_platform/http/proxy_settings.rb +22 -0
  28. data/lib/google_maps_platform/logging/configuration/api_logging_configuration.rb +186 -0
  29. data/lib/google_maps_platform/logging/sdk_logger.rb +17 -0
  30. data/lib/google_maps_platform/models/address_component.rb +97 -0
  31. data/lib/google_maps_platform/models/base_model.rb +110 -0
  32. data/lib/google_maps_platform/models/bounds.rb +85 -0
  33. data/lib/google_maps_platform/models/business_status.rb +41 -0
  34. data/lib/google_maps_platform/models/cell_tower.rb +146 -0
  35. data/lib/google_maps_platform/models/directions_geocoded_waypoint.rb +181 -0
  36. data/lib/google_maps_platform/models/directions_leg.rb +224 -0
  37. data/lib/google_maps_platform/models/directions_polyline.rb +93 -0
  38. data/lib/google_maps_platform/models/directions_response.rb +185 -0
  39. data/lib/google_maps_platform/models/directions_route.rb +188 -0
  40. data/lib/google_maps_platform/models/directions_status.rb +94 -0
  41. data/lib/google_maps_platform/models/directions_step.rb +216 -0
  42. data/lib/google_maps_platform/models/directions_traffic_speed_entry.rb +84 -0
  43. data/lib/google_maps_platform/models/directions_transit_agency.rb +95 -0
  44. data/lib/google_maps_platform/models/directions_transit_details.rb +176 -0
  45. data/lib/google_maps_platform/models/directions_transit_line.rb +152 -0
  46. data/lib/google_maps_platform/models/directions_transit_stop.rb +83 -0
  47. data/lib/google_maps_platform/models/directions_transit_vehicle.rb +126 -0
  48. data/lib/google_maps_platform/models/directions_via_waypoint.rb +99 -0
  49. data/lib/google_maps_platform/models/distance_matrix_element.rb +132 -0
  50. data/lib/google_maps_platform/models/distance_matrix_element_status.rb +48 -0
  51. data/lib/google_maps_platform/models/distance_matrix_response.rb +149 -0
  52. data/lib/google_maps_platform/models/distance_matrix_row.rb +89 -0
  53. data/lib/google_maps_platform/models/distance_matrix_status.rb +74 -0
  54. data/lib/google_maps_platform/models/elevation_response.rb +132 -0
  55. data/lib/google_maps_platform/models/elevation_result.rb +99 -0
  56. data/lib/google_maps_platform/models/elevation_status.rb +65 -0
  57. data/lib/google_maps_platform/models/error_detail.rb +135 -0
  58. data/lib/google_maps_platform/models/error_object.rb +130 -0
  59. data/lib/google_maps_platform/models/fare.rb +92 -0
  60. data/lib/google_maps_platform/models/field_violation.rb +82 -0
  61. data/lib/google_maps_platform/models/geocoder_status.rb +37 -0
  62. data/lib/google_maps_platform/models/geocoding_geometry.rb +117 -0
  63. data/lib/google_maps_platform/models/geocoding_response.rb +140 -0
  64. data/lib/google_maps_platform/models/geocoding_result.rb +174 -0
  65. data/lib/google_maps_platform/models/geocoding_status.rb +71 -0
  66. data/lib/google_maps_platform/models/geolocation_request.rb +166 -0
  67. data/lib/google_maps_platform/models/geolocation_response.rb +91 -0
  68. data/lib/google_maps_platform/models/geometry.rb +84 -0
  69. data/lib/google_maps_platform/models/inputtype.rb +36 -0
  70. data/lib/google_maps_platform/models/language.rb +240 -0
  71. data/lib/google_maps_platform/models/lat_lng_literal.rb +83 -0
  72. data/lib/google_maps_platform/models/latitude_longitude_literal.rb +83 -0
  73. data/lib/google_maps_platform/models/location_type.rb +54 -0
  74. data/lib/google_maps_platform/models/location_type1.rb +44 -0
  75. data/lib/google_maps_platform/models/maneuver.rb +110 -0
  76. data/lib/google_maps_platform/models/maps_api_elevation_json_response.rb +132 -0
  77. data/lib/google_maps_platform/models/maxprice.rb +48 -0
  78. data/lib/google_maps_platform/models/minprice.rb +48 -0
  79. data/lib/google_maps_platform/models/mode.rb +44 -0
  80. data/lib/google_maps_platform/models/nearest_roads_error.rb +90 -0
  81. data/lib/google_maps_platform/models/nearest_roads_response.rb +86 -0
  82. data/lib/google_maps_platform/models/place.rb +647 -0
  83. data/lib/google_maps_platform/models/place_autocomplete_matched_substring.rb +82 -0
  84. data/lib/google_maps_platform/models/place_autocomplete_prediction.rb +181 -0
  85. data/lib/google_maps_platform/models/place_autocomplete_structured_format.rb +136 -0
  86. data/lib/google_maps_platform/models/place_autocomplete_term.rb +83 -0
  87. data/lib/google_maps_platform/models/place_editorial_summary.rb +87 -0
  88. data/lib/google_maps_platform/models/place_opening_hours.rb +138 -0
  89. data/lib/google_maps_platform/models/place_opening_hours_period.rb +84 -0
  90. data/lib/google_maps_platform/models/place_opening_hours_period_detail.rb +108 -0
  91. data/lib/google_maps_platform/models/place_photo.rb +109 -0
  92. data/lib/google_maps_platform/models/place_review.rb +186 -0
  93. data/lib/google_maps_platform/models/place_special_day.rb +93 -0
  94. data/lib/google_maps_platform/models/places_autocomplete_response.rb +141 -0
  95. data/lib/google_maps_platform/models/places_autocomplete_status.rb +66 -0
  96. data/lib/google_maps_platform/models/places_details_response.rb +131 -0
  97. data/lib/google_maps_platform/models/places_details_status.rb +71 -0
  98. data/lib/google_maps_platform/models/places_find_place_from_text_response.rb +145 -0
  99. data/lib/google_maps_platform/models/places_nearby_search_response.rb +171 -0
  100. data/lib/google_maps_platform/models/places_query_autocomplete_response.rb +141 -0
  101. data/lib/google_maps_platform/models/places_search_status.rb +66 -0
  102. data/lib/google_maps_platform/models/places_text_search_response.rb +171 -0
  103. data/lib/google_maps_platform/models/plus_code.rb +92 -0
  104. data/lib/google_maps_platform/models/rankby.rb +36 -0
  105. data/lib/google_maps_platform/models/region.rb +1052 -0
  106. data/lib/google_maps_platform/models/result.rb +96 -0
  107. data/lib/google_maps_platform/models/result_type.rb +112 -0
  108. data/lib/google_maps_platform/models/snap_to_roads_response.rb +96 -0
  109. data/lib/google_maps_platform/models/snapped_point.rb +103 -0
  110. data/lib/google_maps_platform/models/source.rb +36 -0
  111. data/lib/google_maps_platform/models/street_view_response.rb +135 -0
  112. data/lib/google_maps_platform/models/street_view_status.rb +71 -0
  113. data/lib/google_maps_platform/models/text_value_object.rb +82 -0
  114. data/lib/google_maps_platform/models/time_zone_response.rb +154 -0
  115. data/lib/google_maps_platform/models/time_zone_status.rb +68 -0
  116. data/lib/google_maps_platform/models/time_zone_text_value_object.rb +94 -0
  117. data/lib/google_maps_platform/models/traffic_model.rb +40 -0
  118. data/lib/google_maps_platform/models/transit_routing_preference.rb +36 -0
  119. data/lib/google_maps_platform/models/travel_mode.rb +48 -0
  120. data/lib/google_maps_platform/models/type.rb +140 -0
  121. data/lib/google_maps_platform/models/type1.rb +112 -0
  122. data/lib/google_maps_platform/models/units.rb +36 -0
  123. data/lib/google_maps_platform/models/wi_fi_access_point.rb +119 -0
  124. data/lib/google_maps_platform/utilities/date_time_helper.rb +11 -0
  125. data/lib/google_maps_platform/utilities/file_wrapper.rb +28 -0
  126. data/lib/google_maps_platform.rb +154 -0
  127. metadata +210 -0
@@ -0,0 +1,171 @@
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
+ # PlacesNearbySearchResponse Model.
8
+ class PlacesNearbySearchResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # May contain a set of attributions about this listing which must be
13
+ # displayed to the user (some listings may not have attribution).
14
+ # @return [Array[String]]
15
+ attr_accessor :html_attributions
16
+
17
+ # Contains an array of places.
18
+ # <div class="caution">Place Search requests return a subset of the fields
19
+ # that are returned by Place Details requests. If the field you want is not
20
+ # returned by Place Search, you can use Place Search to get a `place_id`,
21
+ # then use that Place ID to make a Place Details request.</div>
22
+ # @return [Array[Place]]
23
+ attr_accessor :results
24
+
25
+ # Status codes returned by service.
26
+ # - `OK` indicating the API request was successful.
27
+ # - `ZERO_RESULTS` indicating that the search was successful but returned no
28
+ # results. This may occur if the search was passed a `latlng` in a remote
29
+ # location.
30
+ # - `INVALID_REQUEST` indicating the API request was malformed, generally
31
+ # due to missing required query parameter (`location` or `radius`).
32
+ # - `OVER_QUERY_LIMIT` indicating any of the following:
33
+ # - You have exceeded the QPS limits.
34
+ # - Billing has not been enabled on your account.
35
+ # - The monthly $200 credit, or a self-imposed usage cap, has been
36
+ # exceeded.
37
+ # - The provided method of payment is no longer valid (for example, a
38
+ # credit card has expired).
39
+ # See the [Maps
40
+ # FAQ](https://developers.google.com/maps/faq#over-limit-key-error) for more
41
+ # information about how to resolve this error.
42
+ # - `REQUEST_DENIED` indicating that your request was denied, generally
43
+ # because:
44
+ # - The request is missing an API key.
45
+ # - The `key` parameter is invalid.
46
+ # - `UNKNOWN_ERROR` indicating an unknown error.
47
+ # @return [PlacesSearchStatus]
48
+ attr_accessor :status
49
+
50
+ # When the service returns a status code other than `OK<`, there may be an
51
+ # additional `error_message` field within the response object. This field
52
+ # contains more detailed information about thereasons behind the given
53
+ # status code. This field is not always returned, and its content is subject
54
+ # to change.
55
+ # @return [String]
56
+ attr_accessor :error_message
57
+
58
+ # When the service returns additional information about the request
59
+ # specification, there may be an additional `info_messages` field within the
60
+ # response object. This field is only returned for successful requests. It
61
+ # may not always be returned, and its content is subject to change.
62
+ # @return [Array[String]]
63
+ attr_accessor :info_messages
64
+
65
+ # Contains a token that can be used to return up to 20 additional results. A
66
+ # next_page_token will not be returned if there are no additional results to
67
+ # display. The maximum number of results that can be returned is 60. There
68
+ # is a short delay between when a next_page_token is issued, and when it
69
+ # will become valid.
70
+ # @return [String]
71
+ attr_accessor :next_page_token
72
+
73
+ # A mapping from model property names to API property names.
74
+ def self.names
75
+ @_hash = {} if @_hash.nil?
76
+ @_hash['html_attributions'] = 'html_attributions'
77
+ @_hash['results'] = 'results'
78
+ @_hash['status'] = 'status'
79
+ @_hash['error_message'] = 'error_message'
80
+ @_hash['info_messages'] = 'info_messages'
81
+ @_hash['next_page_token'] = 'next_page_token'
82
+ @_hash
83
+ end
84
+
85
+ # An array for optional fields
86
+ def self.optionals
87
+ %w[
88
+ error_message
89
+ info_messages
90
+ next_page_token
91
+ ]
92
+ end
93
+
94
+ # An array for nullable fields
95
+ def self.nullables
96
+ []
97
+ end
98
+
99
+ def initialize(html_attributions:, results:, status:, error_message: SKIP,
100
+ info_messages: SKIP, next_page_token: SKIP,
101
+ additional_properties: nil)
102
+ # Add additional model properties to the instance
103
+ additional_properties = {} if additional_properties.nil?
104
+
105
+ @html_attributions = html_attributions
106
+ @results = results
107
+ @status = status
108
+ @error_message = error_message unless error_message == SKIP
109
+ @info_messages = info_messages unless info_messages == SKIP
110
+ @next_page_token = next_page_token unless next_page_token == SKIP
111
+ @additional_properties = additional_properties
112
+ end
113
+
114
+ # Creates an instance of the object from a hash.
115
+ def self.from_hash(hash)
116
+ return nil unless hash
117
+
118
+ # Extract variables from the hash.
119
+ html_attributions =
120
+ hash.key?('html_attributions') ? hash['html_attributions'] : nil
121
+ # Parameter is an array, so we need to iterate through it
122
+ results = nil
123
+ unless hash['results'].nil?
124
+ results = []
125
+ hash['results'].each do |structure|
126
+ results << (Place.from_hash(structure) if structure)
127
+ end
128
+ end
129
+
130
+ results = nil unless hash.key?('results')
131
+ status = hash.key?('status') ? hash['status'] : nil
132
+ error_message = hash.key?('error_message') ? hash['error_message'] : SKIP
133
+ info_messages = hash.key?('info_messages') ? hash['info_messages'] : SKIP
134
+ next_page_token =
135
+ hash.key?('next_page_token') ? hash['next_page_token'] : SKIP
136
+
137
+ # Create a new hash for additional properties, removing known properties.
138
+ new_hash = hash.reject { |k, _| names.value?(k) }
139
+
140
+ additional_properties = APIHelper.get_additional_properties(
141
+ new_hash, proc { |value| value }
142
+ )
143
+
144
+ # Create object from extracted values.
145
+ PlacesNearbySearchResponse.new(html_attributions: html_attributions,
146
+ results: results,
147
+ status: status,
148
+ error_message: error_message,
149
+ info_messages: info_messages,
150
+ next_page_token: next_page_token,
151
+ additional_properties: additional_properties)
152
+ end
153
+
154
+ # Provides a human-readable string representation of the object.
155
+ def to_s
156
+ class_name = self.class.name.split('::').last
157
+ "<#{class_name} html_attributions: #{@html_attributions}, results: #{@results}, status:"\
158
+ " #{@status}, error_message: #{@error_message}, info_messages: #{@info_messages},"\
159
+ " next_page_token: #{@next_page_token}, additional_properties: #{@additional_properties}>"
160
+ end
161
+
162
+ # Provides a debugging-friendly string with detailed object information.
163
+ def inspect
164
+ class_name = self.class.name.split('::').last
165
+ "<#{class_name} html_attributions: #{@html_attributions.inspect}, results:"\
166
+ " #{@results.inspect}, status: #{@status.inspect}, error_message: #{@error_message.inspect},"\
167
+ " info_messages: #{@info_messages.inspect}, next_page_token: #{@next_page_token.inspect},"\
168
+ " additional_properties: #{@additional_properties}>"
169
+ end
170
+ end
171
+ end
@@ -0,0 +1,141 @@
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
+ # PlacesQueryAutocompleteResponse Model.
8
+ class PlacesQueryAutocompleteResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Contains an array of predictions.
13
+ # @return [Array[PlaceAutocompletePrediction]]
14
+ attr_accessor :predictions
15
+
16
+ # Status codes returned by service.
17
+ # - `OK` indicating the API request was successful.
18
+ # - `ZERO_RESULTS` indicating that the search was successful but returned no
19
+ # results. This may occur if the search was passed a bounds in a remote
20
+ # location.
21
+ # - `INVALID_REQUEST` indicating the API request was malformed, generally
22
+ # due to the missing `input` parameter.
23
+ # - `OVER_QUERY_LIMIT` indicating any of the following:
24
+ # - You have exceeded the QPS limits.
25
+ # - Billing has not been enabled on your account.
26
+ # - The monthly $200 credit, or a self-imposed usage cap, has been
27
+ # exceeded.
28
+ # - The provided method of payment is no longer valid (for example, a
29
+ # credit card has expired).
30
+ # See the [Maps
31
+ # FAQ](https://developers.google.com/maps/faq#over-limit-key-error) for more
32
+ # information about how to resolve this error.
33
+ # - `REQUEST_DENIED` indicating that your request was denied, generally
34
+ # because:
35
+ # - The request is missing an API key.
36
+ # - The `key` parameter is invalid.
37
+ # - `UNKNOWN_ERROR` indicating an unknown error.
38
+ # @return [PlacesAutocompleteStatus]
39
+ attr_accessor :status
40
+
41
+ # When the service returns a status code other than `OK`, there may be an
42
+ # additional `error_message` field within the response object. This field
43
+ # contains more detailed information about thereasons behind the given
44
+ # status code. This field is not always returned, and its content is subject
45
+ # to change.
46
+ # @return [String]
47
+ attr_accessor :error_message
48
+
49
+ # When the service returns additional information about the request
50
+ # specification, there may be an additional `info_messages` field within the
51
+ # response object. This field is only returned for successful requests. It
52
+ # may not always be returned, and its content is subject to change.
53
+ # @return [Array[String]]
54
+ attr_accessor :info_messages
55
+
56
+ # A mapping from model property names to API property names.
57
+ def self.names
58
+ @_hash = {} if @_hash.nil?
59
+ @_hash['predictions'] = 'predictions'
60
+ @_hash['status'] = 'status'
61
+ @_hash['error_message'] = 'error_message'
62
+ @_hash['info_messages'] = 'info_messages'
63
+ @_hash
64
+ end
65
+
66
+ # An array for optional fields
67
+ def self.optionals
68
+ %w[
69
+ error_message
70
+ info_messages
71
+ ]
72
+ end
73
+
74
+ # An array for nullable fields
75
+ def self.nullables
76
+ []
77
+ end
78
+
79
+ def initialize(predictions:, status:, error_message: SKIP,
80
+ info_messages: SKIP, additional_properties: nil)
81
+ # Add additional model properties to the instance
82
+ additional_properties = {} if additional_properties.nil?
83
+
84
+ @predictions = predictions
85
+ @status = status
86
+ @error_message = error_message unless error_message == SKIP
87
+ @info_messages = info_messages unless info_messages == 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
+ predictions = nil
98
+ unless hash['predictions'].nil?
99
+ predictions = []
100
+ hash['predictions'].each do |structure|
101
+ predictions << (PlaceAutocompletePrediction.from_hash(structure) if structure)
102
+ end
103
+ end
104
+
105
+ predictions = nil unless hash.key?('predictions')
106
+ status = hash.key?('status') ? hash['status'] : nil
107
+ error_message = hash.key?('error_message') ? hash['error_message'] : SKIP
108
+ info_messages = hash.key?('info_messages') ? hash['info_messages'] : 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
+ PlacesQueryAutocompleteResponse.new(predictions: predictions,
119
+ status: status,
120
+ error_message: error_message,
121
+ info_messages: info_messages,
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} predictions: #{@predictions}, status: #{@status}, error_message:"\
129
+ " #{@error_message}, info_messages: #{@info_messages}, additional_properties:"\
130
+ " #{@additional_properties}>"
131
+ end
132
+
133
+ # Provides a debugging-friendly string with detailed object information.
134
+ def inspect
135
+ class_name = self.class.name.split('::').last
136
+ "<#{class_name} predictions: #{@predictions.inspect}, status: #{@status.inspect},"\
137
+ " error_message: #{@error_message.inspect}, info_messages: #{@info_messages.inspect},"\
138
+ " additional_properties: #{@additional_properties}>"
139
+ end
140
+ end
141
+ end
@@ -0,0 +1,66 @@
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
+ # Status codes returned by service. - `OK` indicating the API request was
8
+ # successful. - `ZERO_RESULTS` indicating that the search was successful but
9
+ # returned no results. This may occur if the search was passed a `latlng` in a
10
+ # remote location. - `INVALID_REQUEST` indicating the API request was
11
+ # malformed, generally due to missing required query parameter (`location` or
12
+ # `radius`). - `OVER_QUERY_LIMIT` indicating any of the following: - You
13
+ # have exceeded the QPS limits. - Billing has not been enabled on your
14
+ # account. - The monthly $200 credit, or a self-imposed usage cap, has been
15
+ # exceeded. - The provided method of payment is no longer valid (for
16
+ # example, a credit card has expired). See the [Maps
17
+ # FAQ](https://developers.google.com/maps/faq#over-limit-key-error) for more
18
+ # information about how to resolve this error. - `REQUEST_DENIED` indicating
19
+ # that your request was denied, generally because: - The request is missing
20
+ # an API key. - The `key` parameter is invalid. - `UNKNOWN_ERROR` indicating
21
+ # an unknown error.
22
+ class PlacesSearchStatus
23
+ PLACES_SEARCH_STATUS = [
24
+ # TODO: Write general description for OK
25
+ OK = 'OK'.freeze,
26
+
27
+ # TODO: Write general description for ZERO_RESULTS
28
+ ZERO_RESULTS = 'ZERO_RESULTS'.freeze,
29
+
30
+ # TODO: Write general description for INVALID_REQUEST
31
+ INVALID_REQUEST = 'INVALID_REQUEST'.freeze,
32
+
33
+ # TODO: Write general description for OVER_QUERY_LIMIT
34
+ OVER_QUERY_LIMIT = 'OVER_QUERY_LIMIT'.freeze,
35
+
36
+ # TODO: Write general description for REQUEST_DENIED
37
+ REQUEST_DENIED = 'REQUEST_DENIED'.freeze,
38
+
39
+ # TODO: Write general description for UNKNOWN_ERROR
40
+ UNKNOWN_ERROR = 'UNKNOWN_ERROR'.freeze
41
+ ].freeze
42
+
43
+ def self.validate(value)
44
+ return false if value.nil?
45
+
46
+ PLACES_SEARCH_STATUS.include?(value)
47
+ end
48
+
49
+ def self.from_value(value, default_value = OK)
50
+ return default_value if value.nil?
51
+
52
+ str = value.to_s.strip
53
+
54
+ case str.downcase
55
+ when 'ok' then OK
56
+ when 'zero_results' then ZERO_RESULTS
57
+ when 'invalid_request' then INVALID_REQUEST
58
+ when 'over_query_limit' then OVER_QUERY_LIMIT
59
+ when 'request_denied' then REQUEST_DENIED
60
+ when 'unknown_error' then UNKNOWN_ERROR
61
+ else
62
+ default_value
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,171 @@
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
+ # PlacesTextSearchResponse Model.
8
+ class PlacesTextSearchResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # May contain a set of attributions about this listing which must be
13
+ # displayed to the user (some listings may not have attribution).
14
+ # @return [Array[String]]
15
+ attr_accessor :html_attributions
16
+
17
+ # Contains an array of places.
18
+ # <div class="caution">Place Search requests return a subset of the fields
19
+ # that are returned by Place Details requests. If the field you want is not
20
+ # returned by Place Search, you can use Place Search to get a `place_id`,
21
+ # then use that Place ID to make a Place Details request.</div>
22
+ # @return [Array[Place]]
23
+ attr_accessor :results
24
+
25
+ # Status codes returned by service.
26
+ # - `OK` indicating the API request was successful.
27
+ # - `ZERO_RESULTS` indicating that the search was successful but returned no
28
+ # results. This may occur if the search was passed a `latlng` in a remote
29
+ # location.
30
+ # - `INVALID_REQUEST` indicating the API request was malformed, generally
31
+ # due to missing required query parameter (`location` or `radius`).
32
+ # - `OVER_QUERY_LIMIT` indicating any of the following:
33
+ # - You have exceeded the QPS limits.
34
+ # - Billing has not been enabled on your account.
35
+ # - The monthly $200 credit, or a self-imposed usage cap, has been
36
+ # exceeded.
37
+ # - The provided method of payment is no longer valid (for example, a
38
+ # credit card has expired).
39
+ # See the [Maps
40
+ # FAQ](https://developers.google.com/maps/faq#over-limit-key-error) for more
41
+ # information about how to resolve this error.
42
+ # - `REQUEST_DENIED` indicating that your request was denied, generally
43
+ # because:
44
+ # - The request is missing an API key.
45
+ # - The `key` parameter is invalid.
46
+ # - `UNKNOWN_ERROR` indicating an unknown error.
47
+ # @return [PlacesSearchStatus]
48
+ attr_accessor :status
49
+
50
+ # When the service returns a status code other than `OK<`, there may be an
51
+ # additional `error_message` field within the response object. This field
52
+ # contains more detailed information about thereasons behind the given
53
+ # status code. This field is not always returned, and its content is subject
54
+ # to change.
55
+ # @return [String]
56
+ attr_accessor :error_message
57
+
58
+ # When the service returns additional information about the request
59
+ # specification, there may be an additional `info_messages` field within the
60
+ # response object. This field is only returned for successful requests. It
61
+ # may not always be returned, and its content is subject to change.
62
+ # @return [Array[String]]
63
+ attr_accessor :info_messages
64
+
65
+ # Contains a token that can be used to return up to 20 additional results. A
66
+ # next_page_token will not be returned if there are no additional results to
67
+ # display. The maximum number of results that can be returned is 60. There
68
+ # is a short delay between when a next_page_token is issued, and when it
69
+ # will become valid.
70
+ # @return [String]
71
+ attr_accessor :next_page_token
72
+
73
+ # A mapping from model property names to API property names.
74
+ def self.names
75
+ @_hash = {} if @_hash.nil?
76
+ @_hash['html_attributions'] = 'html_attributions'
77
+ @_hash['results'] = 'results'
78
+ @_hash['status'] = 'status'
79
+ @_hash['error_message'] = 'error_message'
80
+ @_hash['info_messages'] = 'info_messages'
81
+ @_hash['next_page_token'] = 'next_page_token'
82
+ @_hash
83
+ end
84
+
85
+ # An array for optional fields
86
+ def self.optionals
87
+ %w[
88
+ error_message
89
+ info_messages
90
+ next_page_token
91
+ ]
92
+ end
93
+
94
+ # An array for nullable fields
95
+ def self.nullables
96
+ []
97
+ end
98
+
99
+ def initialize(html_attributions:, results:, status:, error_message: SKIP,
100
+ info_messages: SKIP, next_page_token: SKIP,
101
+ additional_properties: nil)
102
+ # Add additional model properties to the instance
103
+ additional_properties = {} if additional_properties.nil?
104
+
105
+ @html_attributions = html_attributions
106
+ @results = results
107
+ @status = status
108
+ @error_message = error_message unless error_message == SKIP
109
+ @info_messages = info_messages unless info_messages == SKIP
110
+ @next_page_token = next_page_token unless next_page_token == SKIP
111
+ @additional_properties = additional_properties
112
+ end
113
+
114
+ # Creates an instance of the object from a hash.
115
+ def self.from_hash(hash)
116
+ return nil unless hash
117
+
118
+ # Extract variables from the hash.
119
+ html_attributions =
120
+ hash.key?('html_attributions') ? hash['html_attributions'] : nil
121
+ # Parameter is an array, so we need to iterate through it
122
+ results = nil
123
+ unless hash['results'].nil?
124
+ results = []
125
+ hash['results'].each do |structure|
126
+ results << (Place.from_hash(structure) if structure)
127
+ end
128
+ end
129
+
130
+ results = nil unless hash.key?('results')
131
+ status = hash.key?('status') ? hash['status'] : nil
132
+ error_message = hash.key?('error_message') ? hash['error_message'] : SKIP
133
+ info_messages = hash.key?('info_messages') ? hash['info_messages'] : SKIP
134
+ next_page_token =
135
+ hash.key?('next_page_token') ? hash['next_page_token'] : SKIP
136
+
137
+ # Create a new hash for additional properties, removing known properties.
138
+ new_hash = hash.reject { |k, _| names.value?(k) }
139
+
140
+ additional_properties = APIHelper.get_additional_properties(
141
+ new_hash, proc { |value| value }
142
+ )
143
+
144
+ # Create object from extracted values.
145
+ PlacesTextSearchResponse.new(html_attributions: html_attributions,
146
+ results: results,
147
+ status: status,
148
+ error_message: error_message,
149
+ info_messages: info_messages,
150
+ next_page_token: next_page_token,
151
+ additional_properties: additional_properties)
152
+ end
153
+
154
+ # Provides a human-readable string representation of the object.
155
+ def to_s
156
+ class_name = self.class.name.split('::').last
157
+ "<#{class_name} html_attributions: #{@html_attributions}, results: #{@results}, status:"\
158
+ " #{@status}, error_message: #{@error_message}, info_messages: #{@info_messages},"\
159
+ " next_page_token: #{@next_page_token}, additional_properties: #{@additional_properties}>"
160
+ end
161
+
162
+ # Provides a debugging-friendly string with detailed object information.
163
+ def inspect
164
+ class_name = self.class.name.split('::').last
165
+ "<#{class_name} html_attributions: #{@html_attributions.inspect}, results:"\
166
+ " #{@results.inspect}, status: #{@status.inspect}, error_message: #{@error_message.inspect},"\
167
+ " info_messages: #{@info_messages.inspect}, next_page_token: #{@next_page_token.inspect},"\
168
+ " additional_properties: #{@additional_properties}>"
169
+ end
170
+ end
171
+ end
@@ -0,0 +1,92 @@
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 encoded location reference, derived from latitude and longitude
8
+ # coordinates, that represents an area, 1/8000th of a degree by 1/8000th of a
9
+ # degree (about 14m x 14m at the equator) or smaller. Plus codes can be used
10
+ # as a replacement for street addresses in places where they do not exist
11
+ # (where buildings are not numbered or streets are not named).
12
+ class PlusCode < BaseModel
13
+ SKIP = Object.new
14
+ private_constant :SKIP
15
+
16
+ # The `compound_code` is a 6 character or longer local code with an explicit
17
+ # location (`CWC8+R9, Mountain View, CA, USA`). Some APIs may return an
18
+ # empty string if the `compound_code` is not available.
19
+ # @return [String]
20
+ attr_accessor :compound_code
21
+
22
+ # The `global_code` is a 4 character area code and 6 character or longer
23
+ # local code (`849VCWC8+R9`).
24
+ # @return [String]
25
+ attr_accessor :global_code
26
+
27
+ # A mapping from model property names to API property names.
28
+ def self.names
29
+ @_hash = {} if @_hash.nil?
30
+ @_hash['compound_code'] = 'compound_code'
31
+ @_hash['global_code'] = 'global_code'
32
+ @_hash
33
+ end
34
+
35
+ # An array for optional fields
36
+ def self.optionals
37
+ %w[
38
+ compound_code
39
+ ]
40
+ end
41
+
42
+ # An array for nullable fields
43
+ def self.nullables
44
+ []
45
+ end
46
+
47
+ def initialize(global_code:, compound_code: SKIP,
48
+ additional_properties: nil)
49
+ # Add additional model properties to the instance
50
+ additional_properties = {} if additional_properties.nil?
51
+
52
+ @compound_code = compound_code unless compound_code == SKIP
53
+ @global_code = global_code
54
+ @additional_properties = additional_properties
55
+ end
56
+
57
+ # Creates an instance of the object from a hash.
58
+ def self.from_hash(hash)
59
+ return nil unless hash
60
+
61
+ # Extract variables from the hash.
62
+ global_code = hash.key?('global_code') ? hash['global_code'] : nil
63
+ compound_code = hash.key?('compound_code') ? hash['compound_code'] : SKIP
64
+
65
+ # Create a new hash for additional properties, removing known properties.
66
+ new_hash = hash.reject { |k, _| names.value?(k) }
67
+
68
+ additional_properties = APIHelper.get_additional_properties(
69
+ new_hash, proc { |value| value }
70
+ )
71
+
72
+ # Create object from extracted values.
73
+ PlusCode.new(global_code: global_code,
74
+ compound_code: compound_code,
75
+ additional_properties: additional_properties)
76
+ end
77
+
78
+ # Provides a human-readable string representation of the object.
79
+ def to_s
80
+ class_name = self.class.name.split('::').last
81
+ "<#{class_name} compound_code: #{@compound_code}, global_code: #{@global_code},"\
82
+ " additional_properties: #{@additional_properties}>"
83
+ end
84
+
85
+ # Provides a debugging-friendly string with detailed object information.
86
+ def inspect
87
+ class_name = self.class.name.split('::').last
88
+ "<#{class_name} compound_code: #{@compound_code.inspect}, global_code:"\
89
+ " #{@global_code.inspect}, additional_properties: #{@additional_properties}>"
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,36 @@
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
+ # rankby.
8
+ class Rankby
9
+ RANKBY = [
10
+ # TODO: Write general description for PROMINENCE
11
+ PROMINENCE = 'prominence'.freeze,
12
+
13
+ # TODO: Write general description for DISTANCE
14
+ DISTANCE = 'distance'.freeze
15
+ ].freeze
16
+
17
+ def self.validate(value)
18
+ return false if value.nil?
19
+
20
+ RANKBY.include?(value)
21
+ end
22
+
23
+ def self.from_value(value, default_value = PROMINENCE)
24
+ return default_value if value.nil?
25
+
26
+ str = value.to_s.strip
27
+
28
+ case str.downcase
29
+ when 'prominence' then PROMINENCE
30
+ when 'distance' then DISTANCE
31
+ else
32
+ default_value
33
+ end
34
+ end
35
+ end
36
+ end