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,82 @@
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
+ # PlaceAutocompleteMatchedSubstring Model.
8
+ class PlaceAutocompleteMatchedSubstring < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Length of the matched substring in the prediction result text.
13
+ # @return [Float]
14
+ attr_accessor :length
15
+
16
+ # Start location of the matched substring in the prediction result text.
17
+ # @return [Float]
18
+ attr_accessor :offset
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['length'] = 'length'
24
+ @_hash['offset'] = 'offset'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ []
31
+ end
32
+
33
+ # An array for nullable fields
34
+ def self.nullables
35
+ []
36
+ end
37
+
38
+ def initialize(length:, offset:, additional_properties: nil)
39
+ # Add additional model properties to the instance
40
+ additional_properties = {} if additional_properties.nil?
41
+
42
+ @length = length
43
+ @offset = offset
44
+ @additional_properties = additional_properties
45
+ end
46
+
47
+ # Creates an instance of the object from a hash.
48
+ def self.from_hash(hash)
49
+ return nil unless hash
50
+
51
+ # Extract variables from the hash.
52
+ length = hash.key?('length') ? hash['length'] : nil
53
+ offset = hash.key?('offset') ? hash['offset'] : nil
54
+
55
+ # Create a new hash for additional properties, removing known properties.
56
+ new_hash = hash.reject { |k, _| names.value?(k) }
57
+
58
+ additional_properties = APIHelper.get_additional_properties(
59
+ new_hash, proc { |value| value }
60
+ )
61
+
62
+ # Create object from extracted values.
63
+ PlaceAutocompleteMatchedSubstring.new(length: length,
64
+ offset: offset,
65
+ additional_properties: additional_properties)
66
+ end
67
+
68
+ # Provides a human-readable string representation of the object.
69
+ def to_s
70
+ class_name = self.class.name.split('::').last
71
+ "<#{class_name} length: #{@length}, offset: #{@offset}, additional_properties:"\
72
+ " #{@additional_properties}>"
73
+ end
74
+
75
+ # Provides a debugging-friendly string with detailed object information.
76
+ def inspect
77
+ class_name = self.class.name.split('::').last
78
+ "<#{class_name} length: #{@length.inspect}, offset: #{@offset.inspect},"\
79
+ " additional_properties: #{@additional_properties}>"
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,181 @@
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
+ # PlaceAutocompletePrediction Model.
8
+ class PlaceAutocompletePrediction < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Contains the human-readable name for the returned result. For
13
+ # `establishment` results, this is usually the business name. This content
14
+ # is meant to be read as-is. Do not programmatically parse the formatted
15
+ # address.
16
+ # @return [String]
17
+ attr_accessor :description
18
+
19
+ # A list of substrings that describe the location of the entered term in the
20
+ # prediction result text, so that the term can be highlighted if desired.
21
+ # @return [Array[PlaceAutocompleteMatchedSubstring]]
22
+ attr_accessor :matched_substrings
23
+
24
+ # A textual identifier that uniquely identifies a place. To retrieve
25
+ # information about the place, pass this identifier in the placeId field of
26
+ # a Places API request. For more information about place IDs, see the [Place
27
+ # IDs](https://developers.google.com/maps/documentation/places/web-service/p
28
+ # lace-id) overview.
29
+ # @return [String]
30
+ attr_accessor :place_id
31
+
32
+ # See place_id.
33
+ # @return [String]
34
+ attr_accessor :reference
35
+
36
+ # See place_id.
37
+ # @return [PlaceAutocompleteStructuredFormat]
38
+ attr_accessor :structured_formatting
39
+
40
+ # Contains an array of terms identifying each section of the returned
41
+ # description (a section of the description is generally terminated with a
42
+ # comma). Each entry in the array has a `value` field, containing the text
43
+ # of the term, and an `offset` field, defining the start position of this
44
+ # term in the description, measured in Unicode characters.
45
+ # @return [Array[PlaceAutocompleteTerm]]
46
+ attr_accessor :terms
47
+
48
+ # Contains an array of types that apply to this place. For example: `[
49
+ # "political", "locality" ]` or `[ "establishment", "geocode",
50
+ # "beauty_salon" ]`. The array can contain multiple values. Learn more about
51
+ # [Place
52
+ # types](https://developers.google.com/maps/documentation/places/web-service
53
+ # /supported_types).
54
+ # @return [Array[String]]
55
+ attr_accessor :types
56
+
57
+ # The straight-line distance in meters from the origin. This field is only
58
+ # returned for requests made with an `origin`.
59
+ # @return [Integer]
60
+ attr_accessor :distance_meters
61
+
62
+ # A mapping from model property names to API property names.
63
+ def self.names
64
+ @_hash = {} if @_hash.nil?
65
+ @_hash['description'] = 'description'
66
+ @_hash['matched_substrings'] = 'matched_substrings'
67
+ @_hash['place_id'] = 'place_id'
68
+ @_hash['reference'] = 'reference'
69
+ @_hash['structured_formatting'] = 'structured_formatting'
70
+ @_hash['terms'] = 'terms'
71
+ @_hash['types'] = 'types'
72
+ @_hash['distance_meters'] = 'distance_meters'
73
+ @_hash
74
+ end
75
+
76
+ # An array for optional fields
77
+ def self.optionals
78
+ %w[
79
+ place_id
80
+ reference
81
+ types
82
+ distance_meters
83
+ ]
84
+ end
85
+
86
+ # An array for nullable fields
87
+ def self.nullables
88
+ []
89
+ end
90
+
91
+ def initialize(description:, matched_substrings:, structured_formatting:,
92
+ terms:, place_id: SKIP, reference: SKIP, types: SKIP,
93
+ distance_meters: SKIP, additional_properties: nil)
94
+ # Add additional model properties to the instance
95
+ additional_properties = {} if additional_properties.nil?
96
+
97
+ @description = description
98
+ @matched_substrings = matched_substrings
99
+ @place_id = place_id unless place_id == SKIP
100
+ @reference = reference unless reference == SKIP
101
+ @structured_formatting = structured_formatting
102
+ @terms = terms
103
+ @types = types unless types == SKIP
104
+ @distance_meters = distance_meters unless distance_meters == SKIP
105
+ @additional_properties = additional_properties
106
+ end
107
+
108
+ # Creates an instance of the object from a hash.
109
+ def self.from_hash(hash)
110
+ return nil unless hash
111
+
112
+ # Extract variables from the hash.
113
+ description = hash.key?('description') ? hash['description'] : nil
114
+ # Parameter is an array, so we need to iterate through it
115
+ matched_substrings = nil
116
+ unless hash['matched_substrings'].nil?
117
+ matched_substrings = []
118
+ hash['matched_substrings'].each do |structure|
119
+ matched_substrings << (PlaceAutocompleteMatchedSubstring.from_hash(structure) if structure)
120
+ end
121
+ end
122
+
123
+ matched_substrings = nil unless hash.key?('matched_substrings')
124
+ if hash['structured_formatting']
125
+ structured_formatting = PlaceAutocompleteStructuredFormat.from_hash(hash['structured_formatting'])
126
+ end
127
+ # Parameter is an array, so we need to iterate through it
128
+ terms = nil
129
+ unless hash['terms'].nil?
130
+ terms = []
131
+ hash['terms'].each do |structure|
132
+ terms << (PlaceAutocompleteTerm.from_hash(structure) if structure)
133
+ end
134
+ end
135
+
136
+ terms = nil unless hash.key?('terms')
137
+ place_id = hash.key?('place_id') ? hash['place_id'] : SKIP
138
+ reference = hash.key?('reference') ? hash['reference'] : SKIP
139
+ types = hash.key?('types') ? hash['types'] : SKIP
140
+ distance_meters =
141
+ hash.key?('distance_meters') ? hash['distance_meters'] : SKIP
142
+
143
+ # Create a new hash for additional properties, removing known properties.
144
+ new_hash = hash.reject { |k, _| names.value?(k) }
145
+
146
+ additional_properties = APIHelper.get_additional_properties(
147
+ new_hash, proc { |value| value }
148
+ )
149
+
150
+ # Create object from extracted values.
151
+ PlaceAutocompletePrediction.new(description: description,
152
+ matched_substrings: matched_substrings,
153
+ structured_formatting: structured_formatting,
154
+ terms: terms,
155
+ place_id: place_id,
156
+ reference: reference,
157
+ types: types,
158
+ distance_meters: distance_meters,
159
+ additional_properties: additional_properties)
160
+ end
161
+
162
+ # Provides a human-readable string representation of the object.
163
+ def to_s
164
+ class_name = self.class.name.split('::').last
165
+ "<#{class_name} description: #{@description}, matched_substrings: #{@matched_substrings},"\
166
+ " place_id: #{@place_id}, reference: #{@reference}, structured_formatting:"\
167
+ " #{@structured_formatting}, terms: #{@terms}, types: #{@types}, distance_meters:"\
168
+ " #{@distance_meters}, additional_properties: #{@additional_properties}>"
169
+ end
170
+
171
+ # Provides a debugging-friendly string with detailed object information.
172
+ def inspect
173
+ class_name = self.class.name.split('::').last
174
+ "<#{class_name} description: #{@description.inspect}, matched_substrings:"\
175
+ " #{@matched_substrings.inspect}, place_id: #{@place_id.inspect}, reference:"\
176
+ " #{@reference.inspect}, structured_formatting: #{@structured_formatting.inspect}, terms:"\
177
+ " #{@terms.inspect}, types: #{@types.inspect}, distance_meters: #{@distance_meters.inspect},"\
178
+ " additional_properties: #{@additional_properties}>"
179
+ end
180
+ end
181
+ end
@@ -0,0 +1,136 @@
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
+ # PlaceAutocompleteStructuredFormat Model.
8
+ class PlaceAutocompleteStructuredFormat < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Contains the main text of a prediction, usually the name of the place.
13
+ # @return [String]
14
+ attr_accessor :main_text
15
+
16
+ # Contains an array with `offset` value and `length`. These describe the
17
+ # location of the entered term in the prediction result text, so that the
18
+ # term can be highlighted if desired.
19
+ # @return [Array[PlaceAutocompleteMatchedSubstring]]
20
+ attr_accessor :main_text_matched_substrings
21
+
22
+ # Contains the secondary text of a prediction, usually the location of the
23
+ # place.
24
+ # @return [String]
25
+ attr_accessor :secondary_text
26
+
27
+ # Contains an array with `offset` value and `length`. These describe the
28
+ # location of the entered term in the prediction result text, so that the
29
+ # term can be highlighted if desired.
30
+ # @return [Array[PlaceAutocompleteMatchedSubstring]]
31
+ attr_accessor :secondary_text_matched_substrings
32
+
33
+ # A mapping from model property names to API property names.
34
+ def self.names
35
+ @_hash = {} if @_hash.nil?
36
+ @_hash['main_text'] = 'main_text'
37
+ @_hash['main_text_matched_substrings'] = 'main_text_matched_substrings'
38
+ @_hash['secondary_text'] = 'secondary_text'
39
+ @_hash['secondary_text_matched_substrings'] =
40
+ 'secondary_text_matched_substrings'
41
+ @_hash
42
+ end
43
+
44
+ # An array for optional fields
45
+ def self.optionals
46
+ %w[
47
+ secondary_text
48
+ secondary_text_matched_substrings
49
+ ]
50
+ end
51
+
52
+ # An array for nullable fields
53
+ def self.nullables
54
+ []
55
+ end
56
+
57
+ def initialize(main_text:, main_text_matched_substrings:,
58
+ secondary_text: SKIP,
59
+ secondary_text_matched_substrings: SKIP,
60
+ additional_properties: nil)
61
+ # Add additional model properties to the instance
62
+ additional_properties = {} if additional_properties.nil?
63
+
64
+ @main_text = main_text
65
+ @main_text_matched_substrings = main_text_matched_substrings
66
+ @secondary_text = secondary_text unless secondary_text == SKIP
67
+ unless secondary_text_matched_substrings == SKIP
68
+ @secondary_text_matched_substrings =
69
+ secondary_text_matched_substrings
70
+ end
71
+ @additional_properties = additional_properties
72
+ end
73
+
74
+ # Creates an instance of the object from a hash.
75
+ def self.from_hash(hash)
76
+ return nil unless hash
77
+
78
+ # Extract variables from the hash.
79
+ main_text = hash.key?('main_text') ? hash['main_text'] : nil
80
+ # Parameter is an array, so we need to iterate through it
81
+ main_text_matched_substrings = nil
82
+ unless hash['main_text_matched_substrings'].nil?
83
+ main_text_matched_substrings = []
84
+ hash['main_text_matched_substrings'].each do |structure|
85
+ main_text_matched_substrings << (PlaceAutocompleteMatchedSubstring.from_hash(structure) if structure)
86
+ end
87
+ end
88
+
89
+ main_text_matched_substrings = nil unless hash.key?('main_text_matched_substrings')
90
+ secondary_text =
91
+ hash.key?('secondary_text') ? hash['secondary_text'] : SKIP
92
+ # Parameter is an array, so we need to iterate through it
93
+ secondary_text_matched_substrings = nil
94
+ unless hash['secondary_text_matched_substrings'].nil?
95
+ secondary_text_matched_substrings = []
96
+ hash['secondary_text_matched_substrings'].each do |structure|
97
+ secondary_text_matched_substrings << (PlaceAutocompleteMatchedSubstring.from_hash(structure) if structure)
98
+ end
99
+ end
100
+
101
+ secondary_text_matched_substrings = SKIP unless hash.key?('secondary_text_matched_substrings')
102
+
103
+ # Create a new hash for additional properties, removing known properties.
104
+ new_hash = hash.reject { |k, _| names.value?(k) }
105
+
106
+ additional_properties = APIHelper.get_additional_properties(
107
+ new_hash, proc { |value| value }
108
+ )
109
+
110
+ # Create object from extracted values.
111
+ PlaceAutocompleteStructuredFormat.new(main_text: main_text,
112
+ main_text_matched_substrings: main_text_matched_substrings,
113
+ secondary_text: secondary_text,
114
+ secondary_text_matched_substrings: secondary_text_matched_substrings,
115
+ additional_properties: additional_properties)
116
+ end
117
+
118
+ # Provides a human-readable string representation of the object.
119
+ def to_s
120
+ class_name = self.class.name.split('::').last
121
+ "<#{class_name} main_text: #{@main_text}, main_text_matched_substrings:"\
122
+ " #{@main_text_matched_substrings}, secondary_text: #{@secondary_text},"\
123
+ " secondary_text_matched_substrings: #{@secondary_text_matched_substrings},"\
124
+ " additional_properties: #{@additional_properties}>"
125
+ end
126
+
127
+ # Provides a debugging-friendly string with detailed object information.
128
+ def inspect
129
+ class_name = self.class.name.split('::').last
130
+ "<#{class_name} main_text: #{@main_text.inspect}, main_text_matched_substrings:"\
131
+ " #{@main_text_matched_substrings.inspect}, secondary_text: #{@secondary_text.inspect},"\
132
+ " secondary_text_matched_substrings: #{@secondary_text_matched_substrings.inspect},"\
133
+ " additional_properties: #{@additional_properties}>"
134
+ end
135
+ end
136
+ end
@@ -0,0 +1,83 @@
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
+ # PlaceAutocompleteTerm Model.
8
+ class PlaceAutocompleteTerm < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The text of the term.
13
+ # @return [String]
14
+ attr_accessor :value
15
+
16
+ # Defines the start position of this term in the description, measured in
17
+ # Unicode characters
18
+ # @return [Float]
19
+ attr_accessor :offset
20
+
21
+ # A mapping from model property names to API property names.
22
+ def self.names
23
+ @_hash = {} if @_hash.nil?
24
+ @_hash['value'] = 'value'
25
+ @_hash['offset'] = 'offset'
26
+ @_hash
27
+ end
28
+
29
+ # An array for optional fields
30
+ def self.optionals
31
+ []
32
+ end
33
+
34
+ # An array for nullable fields
35
+ def self.nullables
36
+ []
37
+ end
38
+
39
+ def initialize(value:, offset:, additional_properties: nil)
40
+ # Add additional model properties to the instance
41
+ additional_properties = {} if additional_properties.nil?
42
+
43
+ @value = value
44
+ @offset = offset
45
+ @additional_properties = additional_properties
46
+ end
47
+
48
+ # Creates an instance of the object from a hash.
49
+ def self.from_hash(hash)
50
+ return nil unless hash
51
+
52
+ # Extract variables from the hash.
53
+ value = hash.key?('value') ? hash['value'] : nil
54
+ offset = hash.key?('offset') ? hash['offset'] : nil
55
+
56
+ # Create a new hash for additional properties, removing known properties.
57
+ new_hash = hash.reject { |k, _| names.value?(k) }
58
+
59
+ additional_properties = APIHelper.get_additional_properties(
60
+ new_hash, proc { |value| value }
61
+ )
62
+
63
+ # Create object from extracted values.
64
+ PlaceAutocompleteTerm.new(value: value,
65
+ offset: offset,
66
+ additional_properties: additional_properties)
67
+ end
68
+
69
+ # Provides a human-readable string representation of the object.
70
+ def to_s
71
+ class_name = self.class.name.split('::').last
72
+ "<#{class_name} value: #{@value}, offset: #{@offset}, additional_properties:"\
73
+ " #{@additional_properties}>"
74
+ end
75
+
76
+ # Provides a debugging-friendly string with detailed object information.
77
+ def inspect
78
+ class_name = self.class.name.split('::').last
79
+ "<#{class_name} value: #{@value.inspect}, offset: #{@offset.inspect},"\
80
+ " additional_properties: #{@additional_properties}>"
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,87 @@
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
+ # Contains a summary of the place. A summary is comprised of a textual
8
+ # overview, and also includes the language code for these if applicable.
9
+ # Summary text must be presented as-is and can not be modified or altered.
10
+ class PlaceEditorialSummary < BaseModel
11
+ SKIP = Object.new
12
+ private_constant :SKIP
13
+
14
+ # A medium-length textual summary of the place.
15
+ # @return [String]
16
+ attr_accessor :overview
17
+
18
+ # The language of the previous fields. May not always be present.
19
+ # @return [String]
20
+ attr_accessor :language
21
+
22
+ # A mapping from model property names to API property names.
23
+ def self.names
24
+ @_hash = {} if @_hash.nil?
25
+ @_hash['overview'] = 'overview'
26
+ @_hash['language'] = 'language'
27
+ @_hash
28
+ end
29
+
30
+ # An array for optional fields
31
+ def self.optionals
32
+ %w[
33
+ overview
34
+ language
35
+ ]
36
+ end
37
+
38
+ # An array for nullable fields
39
+ def self.nullables
40
+ []
41
+ end
42
+
43
+ def initialize(overview: SKIP, language: SKIP, additional_properties: nil)
44
+ # Add additional model properties to the instance
45
+ additional_properties = {} if additional_properties.nil?
46
+
47
+ @overview = overview unless overview == SKIP
48
+ @language = language unless language == SKIP
49
+ @additional_properties = additional_properties
50
+ end
51
+
52
+ # Creates an instance of the object from a hash.
53
+ def self.from_hash(hash)
54
+ return nil unless hash
55
+
56
+ # Extract variables from the hash.
57
+ overview = hash.key?('overview') ? hash['overview'] : SKIP
58
+ language = hash.key?('language') ? hash['language'] : SKIP
59
+
60
+ # Create a new hash for additional properties, removing known properties.
61
+ new_hash = hash.reject { |k, _| names.value?(k) }
62
+
63
+ additional_properties = APIHelper.get_additional_properties(
64
+ new_hash, proc { |value| value }
65
+ )
66
+
67
+ # Create object from extracted values.
68
+ PlaceEditorialSummary.new(overview: overview,
69
+ language: language,
70
+ additional_properties: additional_properties)
71
+ end
72
+
73
+ # Provides a human-readable string representation of the object.
74
+ def to_s
75
+ class_name = self.class.name.split('::').last
76
+ "<#{class_name} overview: #{@overview}, language: #{@language}, additional_properties:"\
77
+ " #{@additional_properties}>"
78
+ end
79
+
80
+ # Provides a debugging-friendly string with detailed object information.
81
+ def inspect
82
+ class_name = self.class.name.split('::').last
83
+ "<#{class_name} overview: #{@overview.inspect}, language: #{@language.inspect},"\
84
+ " additional_properties: #{@additional_properties}>"
85
+ end
86
+ end
87
+ end