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,93 @@
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
+ # PlaceSpecialDay Model.
8
+ class PlaceSpecialDay < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # A date expressed in RFC3339 format in the local timezone for the place,
13
+ # for example 2010-12-31.
14
+ # @return [String]
15
+ attr_accessor :date
16
+
17
+ # True if there are exceptional hours for this day. If `true`, this means
18
+ # that there is at least one exception for this day. Exceptions cause
19
+ # different values to occur in the subfields of `current_opening_hours` and
20
+ # `secondary_opening_hours` such as `periods`, `weekday_text`, `open_now`.
21
+ # The exceptions apply to the hours, and the hours are used to generate the
22
+ # other fields.
23
+ # @return [TrueClass | FalseClass]
24
+ attr_accessor :exceptional_hours
25
+
26
+ # A mapping from model property names to API property names.
27
+ def self.names
28
+ @_hash = {} if @_hash.nil?
29
+ @_hash['date'] = 'date'
30
+ @_hash['exceptional_hours'] = 'exceptional_hours'
31
+ @_hash
32
+ end
33
+
34
+ # An array for optional fields
35
+ def self.optionals
36
+ %w[
37
+ date
38
+ exceptional_hours
39
+ ]
40
+ end
41
+
42
+ # An array for nullable fields
43
+ def self.nullables
44
+ []
45
+ end
46
+
47
+ def initialize(date: SKIP, exceptional_hours: SKIP,
48
+ additional_properties: nil)
49
+ # Add additional model properties to the instance
50
+ additional_properties = {} if additional_properties.nil?
51
+
52
+ @date = date unless date == SKIP
53
+ @exceptional_hours = exceptional_hours unless exceptional_hours == SKIP
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
+ date = hash.key?('date') ? hash['date'] : SKIP
63
+ exceptional_hours =
64
+ hash.key?('exceptional_hours') ? hash['exceptional_hours'] : SKIP
65
+
66
+ # Create a new hash for additional properties, removing known properties.
67
+ new_hash = hash.reject { |k, _| names.value?(k) }
68
+
69
+ additional_properties = APIHelper.get_additional_properties(
70
+ new_hash, proc { |value| value }
71
+ )
72
+
73
+ # Create object from extracted values.
74
+ PlaceSpecialDay.new(date: date,
75
+ exceptional_hours: exceptional_hours,
76
+ additional_properties: additional_properties)
77
+ end
78
+
79
+ # Provides a human-readable string representation of the object.
80
+ def to_s
81
+ class_name = self.class.name.split('::').last
82
+ "<#{class_name} date: #{@date}, exceptional_hours: #{@exceptional_hours},"\
83
+ " additional_properties: #{@additional_properties}>"
84
+ end
85
+
86
+ # Provides a debugging-friendly string with detailed object information.
87
+ def inspect
88
+ class_name = self.class.name.split('::').last
89
+ "<#{class_name} date: #{@date.inspect}, exceptional_hours: #{@exceptional_hours.inspect},"\
90
+ " additional_properties: #{@additional_properties}>"
91
+ end
92
+ end
93
+ 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
+ # PlacesAutocompleteResponse Model.
8
+ class PlacesAutocompleteResponse < 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
+ PlacesAutocompleteResponse.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 bounds in a
10
+ # remote location. - `INVALID_REQUEST` indicating the API request was
11
+ # malformed, generally due to the missing `input` parameter. -
12
+ # `OVER_QUERY_LIMIT` indicating any of the following: - You have exceeded
13
+ # the QPS limits. - Billing has not been enabled on your account. - The
14
+ # monthly $200 credit, or a self-imposed usage cap, has been exceeded. - The
15
+ # provided method of payment is no longer valid (for example, a credit card
16
+ # 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 PlacesAutocompleteStatus
23
+ PLACES_AUTOCOMPLETE_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_AUTOCOMPLETE_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,131 @@
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
+ # PlacesDetailsResponse Model.
8
+ class PlacesDetailsResponse < 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
+ # Attributes describing a place. Not all attributes will be available for
18
+ # all place types.
19
+ # @return [Place]
20
+ attr_accessor :result
21
+
22
+ # Status codes returned by service.
23
+ # - `OK` indicating the API request was successful.
24
+ # - `ZERO_RESULTS` indicating that the referenced location, `place_id`, was
25
+ # valid but no longer refers to a valid result. This may occur if the
26
+ # establishment is no longer in business.
27
+ # - `NOT_FOUND` indicating that that the referenced location, `place_id`,
28
+ # was not found in the Places database.
29
+ # - `INVALID_REQUEST` indicating the API request was malformed.
30
+ # - `OVER_QUERY_LIMIT` indicating any of the following:
31
+ # - You have exceeded the QPS limits.
32
+ # - Billing has not been enabled on your account.
33
+ # - The monthly $200 credit, or a self-imposed usage cap, has been
34
+ # exceeded.
35
+ # - The provided method of payment is no longer valid (for example, a
36
+ # credit card has expired).
37
+ # See the [Maps
38
+ # FAQ](https://developers.google.com/maps/faq#over-limit-key-error) for more
39
+ # information about how to resolve this error.
40
+ # - `REQUEST_DENIED` indicating that your request was denied, generally
41
+ # because:
42
+ # - The request is missing an API key.
43
+ # - The `key` parameter is invalid.
44
+ # - `UNKNOWN_ERROR` indicating an unknown error.
45
+ # @return [PlacesDetailsStatus]
46
+ attr_accessor :status
47
+
48
+ # When the service returns additional information about the request
49
+ # specification, there may be an additional `info_messages` field within the
50
+ # response object. This field is only returned for successful requests. It
51
+ # may not always be returned, and its content is subject to change.
52
+ # @return [Array[String]]
53
+ attr_accessor :info_messages
54
+
55
+ # A mapping from model property names to API property names.
56
+ def self.names
57
+ @_hash = {} if @_hash.nil?
58
+ @_hash['html_attributions'] = 'html_attributions'
59
+ @_hash['result'] = 'result'
60
+ @_hash['status'] = 'status'
61
+ @_hash['info_messages'] = 'info_messages'
62
+ @_hash
63
+ end
64
+
65
+ # An array for optional fields
66
+ def self.optionals
67
+ %w[
68
+ info_messages
69
+ ]
70
+ end
71
+
72
+ # An array for nullable fields
73
+ def self.nullables
74
+ []
75
+ end
76
+
77
+ def initialize(html_attributions:, result:, status:, info_messages: SKIP,
78
+ additional_properties: nil)
79
+ # Add additional model properties to the instance
80
+ additional_properties = {} if additional_properties.nil?
81
+
82
+ @html_attributions = html_attributions
83
+ @result = result
84
+ @status = status
85
+ @info_messages = info_messages unless info_messages == SKIP
86
+ @additional_properties = additional_properties
87
+ end
88
+
89
+ # Creates an instance of the object from a hash.
90
+ def self.from_hash(hash)
91
+ return nil unless hash
92
+
93
+ # Extract variables from the hash.
94
+ html_attributions =
95
+ hash.key?('html_attributions') ? hash['html_attributions'] : nil
96
+ result = Place.from_hash(hash['result']) if hash['result']
97
+ status = hash.key?('status') ? hash['status'] : nil
98
+ info_messages = hash.key?('info_messages') ? hash['info_messages'] : SKIP
99
+
100
+ # Create a new hash for additional properties, removing known properties.
101
+ new_hash = hash.reject { |k, _| names.value?(k) }
102
+
103
+ additional_properties = APIHelper.get_additional_properties(
104
+ new_hash, proc { |value| value }
105
+ )
106
+
107
+ # Create object from extracted values.
108
+ PlacesDetailsResponse.new(html_attributions: html_attributions,
109
+ result: result,
110
+ status: status,
111
+ info_messages: info_messages,
112
+ additional_properties: additional_properties)
113
+ end
114
+
115
+ # Provides a human-readable string representation of the object.
116
+ def to_s
117
+ class_name = self.class.name.split('::').last
118
+ "<#{class_name} html_attributions: #{@html_attributions}, result: #{@result}, status:"\
119
+ " #{@status}, info_messages: #{@info_messages}, additional_properties:"\
120
+ " #{@additional_properties}>"
121
+ end
122
+
123
+ # Provides a debugging-friendly string with detailed object information.
124
+ def inspect
125
+ class_name = self.class.name.split('::').last
126
+ "<#{class_name} html_attributions: #{@html_attributions.inspect}, result:"\
127
+ " #{@result.inspect}, status: #{@status.inspect}, info_messages: #{@info_messages.inspect},"\
128
+ " additional_properties: #{@additional_properties}>"
129
+ end
130
+ end
131
+ 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
+ # Status codes returned by service. - `OK` indicating the API request was
8
+ # successful. - `ZERO_RESULTS` indicating that the referenced location,
9
+ # `place_id`, was valid but no longer refers to a valid result. This may occur
10
+ # if the establishment is no longer in business. - `NOT_FOUND` indicating
11
+ # that that the referenced location, `place_id`, was not found in the Places
12
+ # database. - `INVALID_REQUEST` indicating the API request was malformed. -
13
+ # `OVER_QUERY_LIMIT` indicating any of the following: - You have exceeded
14
+ # the QPS limits. - Billing has not been enabled on your account. - The
15
+ # monthly $200 credit, or a self-imposed usage cap, has been exceeded. - The
16
+ # provided method of payment is no longer valid (for example, a credit card
17
+ # has expired). See the [Maps
18
+ # FAQ](https://developers.google.com/maps/faq#over-limit-key-error) for more
19
+ # information about how to resolve this error. - `REQUEST_DENIED` indicating
20
+ # that your request was denied, generally because: - The request is missing
21
+ # an API key. - The `key` parameter is invalid. - `UNKNOWN_ERROR` indicating
22
+ # an unknown error.
23
+ class PlacesDetailsStatus
24
+ PLACES_DETAILS_STATUS = [
25
+ # TODO: Write general description for OK
26
+ OK = 'OK'.freeze,
27
+
28
+ # TODO: Write general description for ZERO_RESULTS
29
+ ZERO_RESULTS = 'ZERO_RESULTS'.freeze,
30
+
31
+ # TODO: Write general description for INVALID_REQUEST
32
+ INVALID_REQUEST = 'INVALID_REQUEST'.freeze,
33
+
34
+ # TODO: Write general description for NOT_FOUND
35
+ NOT_FOUND = 'NOT_FOUND'.freeze,
36
+
37
+ # TODO: Write general description for OVER_QUERY_LIMIT
38
+ OVER_QUERY_LIMIT = 'OVER_QUERY_LIMIT'.freeze,
39
+
40
+ # TODO: Write general description for REQUEST_DENIED
41
+ REQUEST_DENIED = 'REQUEST_DENIED'.freeze,
42
+
43
+ # TODO: Write general description for UNKNOWN_ERROR
44
+ UNKNOWN_ERROR = 'UNKNOWN_ERROR'.freeze
45
+ ].freeze
46
+
47
+ def self.validate(value)
48
+ return false if value.nil?
49
+
50
+ PLACES_DETAILS_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 'zero_results' then ZERO_RESULTS
61
+ when 'invalid_request' then INVALID_REQUEST
62
+ when 'not_found' then NOT_FOUND
63
+ when 'over_query_limit' then OVER_QUERY_LIMIT
64
+ when 'request_denied' then REQUEST_DENIED
65
+ when 'unknown_error' then UNKNOWN_ERROR
66
+ else
67
+ default_value
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,145 @@
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
+ # PlacesFindPlaceFromTextResponse Model.
8
+ class PlacesFindPlaceFromTextResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Contains an array of Place candidates.
13
+ # <div class="caution">Place Search requests return a subset of the fields
14
+ # that are returned by Place Details requests. If the field you want is not
15
+ # returned by Place Search, you can use Place Search to get a place_id, then
16
+ # use that Place ID to make a Place Details request.</div>
17
+ # @return [Array[Place]]
18
+ attr_accessor :candidates
19
+
20
+ # Status codes returned by service.
21
+ # - `OK` indicating the API request was successful.
22
+ # - `ZERO_RESULTS` indicating that the search was successful but returned no
23
+ # results. This may occur if the search was passed a `latlng` in a remote
24
+ # location.
25
+ # - `INVALID_REQUEST` indicating the API request was malformed, generally
26
+ # due to missing required query parameter (`location` or `radius`).
27
+ # - `OVER_QUERY_LIMIT` indicating any of the following:
28
+ # - You have exceeded the QPS limits.
29
+ # - Billing has not been enabled on your account.
30
+ # - The monthly $200 credit, or a self-imposed usage cap, has been
31
+ # exceeded.
32
+ # - The provided method of payment is no longer valid (for example, a
33
+ # credit card has expired).
34
+ # See the [Maps
35
+ # FAQ](https://developers.google.com/maps/faq#over-limit-key-error) for more
36
+ # information about how to resolve this error.
37
+ # - `REQUEST_DENIED` indicating that your request was denied, generally
38
+ # because:
39
+ # - The request is missing an API key.
40
+ # - The `key` parameter is invalid.
41
+ # - `UNKNOWN_ERROR` indicating an unknown error.
42
+ # @return [PlacesSearchStatus]
43
+ attr_accessor :status
44
+
45
+ # When the service returns a status code other than `OK<`, there may be an
46
+ # additional `error_message` field within the response object. This field
47
+ # contains more detailed information about thereasons behind the given
48
+ # status code. This field is not always returned, and its content is subject
49
+ # to change.
50
+ # @return [String]
51
+ attr_accessor :error_message
52
+
53
+ # When the service returns additional information about the request
54
+ # specification, there may be an additional `info_messages` field within the
55
+ # response object. This field is only returned for successful requests. It
56
+ # may not always be returned, and its content is subject to change.
57
+ # @return [Array[String]]
58
+ attr_accessor :info_messages
59
+
60
+ # A mapping from model property names to API property names.
61
+ def self.names
62
+ @_hash = {} if @_hash.nil?
63
+ @_hash['candidates'] = 'candidates'
64
+ @_hash['status'] = 'status'
65
+ @_hash['error_message'] = 'error_message'
66
+ @_hash['info_messages'] = 'info_messages'
67
+ @_hash
68
+ end
69
+
70
+ # An array for optional fields
71
+ def self.optionals
72
+ %w[
73
+ error_message
74
+ info_messages
75
+ ]
76
+ end
77
+
78
+ # An array for nullable fields
79
+ def self.nullables
80
+ []
81
+ end
82
+
83
+ def initialize(candidates:, status:, error_message: SKIP,
84
+ info_messages: SKIP, additional_properties: nil)
85
+ # Add additional model properties to the instance
86
+ additional_properties = {} if additional_properties.nil?
87
+
88
+ @candidates = candidates
89
+ @status = status
90
+ @error_message = error_message unless error_message == SKIP
91
+ @info_messages = info_messages unless info_messages == 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
+ # Parameter is an array, so we need to iterate through it
101
+ candidates = nil
102
+ unless hash['candidates'].nil?
103
+ candidates = []
104
+ hash['candidates'].each do |structure|
105
+ candidates << (Place.from_hash(structure) if structure)
106
+ end
107
+ end
108
+
109
+ candidates = nil unless hash.key?('candidates')
110
+ status = hash.key?('status') ? hash['status'] : nil
111
+ error_message = hash.key?('error_message') ? hash['error_message'] : SKIP
112
+ info_messages = hash.key?('info_messages') ? hash['info_messages'] : SKIP
113
+
114
+ # Create a new hash for additional properties, removing known properties.
115
+ new_hash = hash.reject { |k, _| names.value?(k) }
116
+
117
+ additional_properties = APIHelper.get_additional_properties(
118
+ new_hash, proc { |value| value }
119
+ )
120
+
121
+ # Create object from extracted values.
122
+ PlacesFindPlaceFromTextResponse.new(candidates: candidates,
123
+ status: status,
124
+ error_message: error_message,
125
+ info_messages: info_messages,
126
+ additional_properties: additional_properties)
127
+ end
128
+
129
+ # Provides a human-readable string representation of the object.
130
+ def to_s
131
+ class_name = self.class.name.split('::').last
132
+ "<#{class_name} candidates: #{@candidates}, status: #{@status}, error_message:"\
133
+ " #{@error_message}, info_messages: #{@info_messages}, additional_properties:"\
134
+ " #{@additional_properties}>"
135
+ end
136
+
137
+ # Provides a debugging-friendly string with detailed object information.
138
+ def inspect
139
+ class_name = self.class.name.split('::').last
140
+ "<#{class_name} candidates: #{@candidates.inspect}, status: #{@status.inspect},"\
141
+ " error_message: #{@error_message.inspect}, info_messages: #{@info_messages.inspect},"\
142
+ " additional_properties: #{@additional_properties}>"
143
+ end
144
+ end
145
+ end