google-maps-platform-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/apis/base_api.rb +67 -0
  7. data/lib/google_maps_platform/apis/directions_api.rb +341 -0
  8. data/lib/google_maps_platform/apis/distance_matrix_api.rb +224 -0
  9. data/lib/google_maps_platform/apis/elevation_api.rb +71 -0
  10. data/lib/google_maps_platform/apis/geocoding_api.rb +214 -0
  11. data/lib/google_maps_platform/apis/geolocation_api.rb +46 -0
  12. data/lib/google_maps_platform/apis/places_api.rb +866 -0
  13. data/lib/google_maps_platform/apis/roads_api.rb +81 -0
  14. data/lib/google_maps_platform/apis/street_view_api.rb +198 -0
  15. data/lib/google_maps_platform/apis/time_zone_api.rb +65 -0
  16. data/lib/google_maps_platform/client.rb +123 -0
  17. data/lib/google_maps_platform/configuration.rb +181 -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 +153 -0
  127. metadata +211 -0
@@ -0,0 +1,216 @@
1
+ # google_maps_platform
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module GoogleMapsPlatform
7
+ # Each element in the steps array defines a single step of the calculated
8
+ # directions. A step is the most atomic unit of a direction's route,
9
+ # containing a single step describing a specific, single instruction on the
10
+ # journey. E.g. "Turn left at W. 4th St." The step not only describes the
11
+ # instruction but also contains distance and duration information relating to
12
+ # how this step relates to the following step. For example, a step denoted as
13
+ # "Merge onto I-80 West" may contain a duration of "37 miles" and "40
14
+ # minutes," indicating that the next step is 37 miles/40 minutes from this
15
+ # step. When using the Directions API to search for transit directions, the
16
+ # steps array will include additional transit details in the form of a
17
+ # transit_details array. If the directions include multiple modes of
18
+ # transportation, detailed directions will be provided for walking or driving
19
+ # steps in an inner steps array. For example, a walking step will include
20
+ # directions from the start and end locations: "Walk to Innes Ave & Fitch St".
21
+ # That step will include detailed walking directions for that route in the
22
+ # inner steps array, such as: "Head north-west", "Turn left onto Arelious
23
+ # Walker", and "Turn left onto Innes Ave".
24
+ class DirectionsStep < BaseModel
25
+ SKIP = Object.new
26
+ private_constant :SKIP
27
+
28
+ # An object containing a numeric value and its formatted text
29
+ # representation.
30
+ # @return [TextValueObject]
31
+ attr_accessor :distance
32
+
33
+ # An object containing a numeric value and its formatted text
34
+ # representation.
35
+ # @return [TextValueObject]
36
+ attr_accessor :duration
37
+
38
+ # An object describing a specific location with Latitude and Longitude in
39
+ # decimal degrees.
40
+ # @return [LatLngLiteral]
41
+ attr_accessor :end_location
42
+
43
+ # Contains formatted instructions for this step, presented as an HTML text
44
+ # string. This content is meant to be read as-is. Do not programmatically
45
+ # parse this display-only content.
46
+ # @return [String]
47
+ attr_accessor :html_instructions
48
+
49
+ # Contains the action to take for the current step (turn left, merge,
50
+ # straight, etc.). Values are subject to change, and new values may be
51
+ # introduced without prior notice.
52
+ # @return [Maneuver]
53
+ attr_accessor :maneuver
54
+
55
+ # [Polyline
56
+ # encoding](https://developers.google.com/maps/documentation/utilities/polyl
57
+ # inealgorithm) is a lossy compression algorithm that allows you to store a
58
+ # series of coordinates as a single string. Point coordinates are encoded
59
+ # using signed values. If you only have a few static points, you may also
60
+ # wish to use the interactive polyline encoding utility.
61
+ # The encoding process converts a binary value into a series of character
62
+ # codes for ASCII characters using the familiar base64 encoding scheme: to
63
+ # ensure proper display of these characters, encoded values are summed with
64
+ # 63 (the ASCII character '?') before converting them into ASCII. The
65
+ # algorithm also checks for additional character codes for a given point by
66
+ # checking the least significant bit of each byte group; if this bit is set
67
+ # to 1, the point is not yet fully formed and additional data must follow.
68
+ # Additionally, to conserve space, points only include the offset from the
69
+ # previous point (except of course for the first point). All points are
70
+ # encoded in Base64 as signed integers, as latitudes and longitudes are
71
+ # signed values. The encoding format within a polyline needs to represent
72
+ # two coordinates representing latitude and longitude to a reasonable
73
+ # precision. Given a maximum longitude of +/- 180 degrees to a precision of
74
+ # 5 decimal places (180.00000 to -180.00000), this results in the need for a
75
+ # 32 bit signed binary integer value.
76
+ # @return [DirectionsPolyline]
77
+ attr_accessor :polyline
78
+
79
+ # An object describing a specific location with Latitude and Longitude in
80
+ # decimal degrees.
81
+ # @return [LatLngLiteral]
82
+ attr_accessor :start_location
83
+
84
+ # Additional information that is not relevant for other modes of
85
+ # transportation.
86
+ # @return [DirectionsTransitDetails]
87
+ attr_accessor :transit_details
88
+
89
+ # - `DRIVING` (default) indicates calculation using the road network.
90
+ # - `BICYCLING` requests calculation for bicycling via bicycle paths &
91
+ # preferred streets (where available).
92
+ # - `TRANSIT` requests calculation via public transit routes (where
93
+ # available).
94
+ # - `WALKING` requests calculation for walking via pedestrian paths &
95
+ # sidewalks (where available).
96
+ # @return [TravelMode]
97
+ attr_accessor :travel_mode
98
+
99
+ # Contains detailed directions for walking or driving steps in transit
100
+ # directions. Substeps are only available when travel_mode is set to
101
+ # "transit". The inner steps array is of the same type as steps.
102
+ # @return [Object]
103
+ attr_accessor :steps
104
+
105
+ # A mapping from model property names to API property names.
106
+ def self.names
107
+ @_hash = {} if @_hash.nil?
108
+ @_hash['distance'] = 'distance'
109
+ @_hash['duration'] = 'duration'
110
+ @_hash['end_location'] = 'end_location'
111
+ @_hash['html_instructions'] = 'html_instructions'
112
+ @_hash['maneuver'] = 'maneuver'
113
+ @_hash['polyline'] = 'polyline'
114
+ @_hash['start_location'] = 'start_location'
115
+ @_hash['transit_details'] = 'transit_details'
116
+ @_hash['travel_mode'] = 'travel_mode'
117
+ @_hash['steps'] = 'steps'
118
+ @_hash
119
+ end
120
+
121
+ # An array for optional fields
122
+ def self.optionals
123
+ %w[
124
+ distance
125
+ maneuver
126
+ transit_details
127
+ steps
128
+ ]
129
+ end
130
+
131
+ # An array for nullable fields
132
+ def self.nullables
133
+ []
134
+ end
135
+
136
+ def initialize(duration:, end_location:, html_instructions:, polyline:,
137
+ start_location:, travel_mode:, distance: SKIP,
138
+ maneuver: SKIP, transit_details: SKIP, steps: SKIP,
139
+ additional_properties: nil)
140
+ # Add additional model properties to the instance
141
+ additional_properties = {} if additional_properties.nil?
142
+
143
+ @distance = distance unless distance == SKIP
144
+ @duration = duration
145
+ @end_location = end_location
146
+ @html_instructions = html_instructions
147
+ @maneuver = maneuver unless maneuver == SKIP
148
+ @polyline = polyline
149
+ @start_location = start_location
150
+ @transit_details = transit_details unless transit_details == SKIP
151
+ @travel_mode = travel_mode
152
+ @steps = steps unless steps == SKIP
153
+ @additional_properties = additional_properties
154
+ end
155
+
156
+ # Creates an instance of the object from a hash.
157
+ def self.from_hash(hash)
158
+ return nil unless hash
159
+
160
+ # Extract variables from the hash.
161
+ duration = TextValueObject.from_hash(hash['duration']) if hash['duration']
162
+ end_location = LatLngLiteral.from_hash(hash['end_location']) if hash['end_location']
163
+ html_instructions =
164
+ hash.key?('html_instructions') ? hash['html_instructions'] : nil
165
+ polyline = DirectionsPolyline.from_hash(hash['polyline']) if hash['polyline']
166
+ start_location = LatLngLiteral.from_hash(hash['start_location']) if hash['start_location']
167
+ travel_mode = hash.key?('travel_mode') ? hash['travel_mode'] : nil
168
+ distance = TextValueObject.from_hash(hash['distance']) if hash['distance']
169
+ maneuver = hash.key?('maneuver') ? hash['maneuver'] : SKIP
170
+ transit_details = DirectionsTransitDetails.from_hash(hash['transit_details']) if
171
+ hash['transit_details']
172
+ steps = hash.key?('steps') ? hash['steps'] : SKIP
173
+
174
+ # Create a new hash for additional properties, removing known properties.
175
+ new_hash = hash.reject { |k, _| names.value?(k) }
176
+
177
+ additional_properties = APIHelper.get_additional_properties(
178
+ new_hash, proc { |value| value }
179
+ )
180
+
181
+ # Create object from extracted values.
182
+ DirectionsStep.new(duration: duration,
183
+ end_location: end_location,
184
+ html_instructions: html_instructions,
185
+ polyline: polyline,
186
+ start_location: start_location,
187
+ travel_mode: travel_mode,
188
+ distance: distance,
189
+ maneuver: maneuver,
190
+ transit_details: transit_details,
191
+ steps: steps,
192
+ additional_properties: additional_properties)
193
+ end
194
+
195
+ # Provides a human-readable string representation of the object.
196
+ def to_s
197
+ class_name = self.class.name.split('::').last
198
+ "<#{class_name} distance: #{@distance}, duration: #{@duration}, end_location:"\
199
+ " #{@end_location}, html_instructions: #{@html_instructions}, maneuver: #{@maneuver},"\
200
+ " polyline: #{@polyline}, start_location: #{@start_location}, transit_details:"\
201
+ " #{@transit_details}, travel_mode: #{@travel_mode}, steps: #{@steps},"\
202
+ " additional_properties: #{@additional_properties}>"
203
+ end
204
+
205
+ # Provides a debugging-friendly string with detailed object information.
206
+ def inspect
207
+ class_name = self.class.name.split('::').last
208
+ "<#{class_name} distance: #{@distance.inspect}, duration: #{@duration.inspect},"\
209
+ " end_location: #{@end_location.inspect}, html_instructions: #{@html_instructions.inspect},"\
210
+ " maneuver: #{@maneuver.inspect}, polyline: #{@polyline.inspect}, start_location:"\
211
+ " #{@start_location.inspect}, transit_details: #{@transit_details.inspect}, travel_mode:"\
212
+ " #{@travel_mode.inspect}, steps: #{@steps.inspect}, additional_properties:"\
213
+ " #{@additional_properties}>"
214
+ end
215
+ end
216
+ end
@@ -0,0 +1,84 @@
1
+ # google_maps_platform
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module GoogleMapsPlatform
7
+ # DirectionsTrafficSpeedEntry Model.
8
+ class DirectionsTrafficSpeedEntry < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The current traffic/speed conditions on this portion of a path.
13
+ # @return [String]
14
+ attr_accessor :speed_category
15
+
16
+ # The offset along the path (in meters) up to which this speed category is
17
+ # valid.
18
+ # @return [Float]
19
+ attr_accessor :offset_meters
20
+
21
+ # A mapping from model property names to API property names.
22
+ def self.names
23
+ @_hash = {} if @_hash.nil?
24
+ @_hash['speed_category'] = 'speed_category'
25
+ @_hash['offset_meters'] = 'offset_meters'
26
+ @_hash
27
+ end
28
+
29
+ # An array for optional fields
30
+ def self.optionals
31
+ []
32
+ end
33
+
34
+ # An array for nullable fields
35
+ def self.nullables
36
+ []
37
+ end
38
+
39
+ def initialize(speed_category:, offset_meters:, additional_properties: nil)
40
+ # Add additional model properties to the instance
41
+ additional_properties = {} if additional_properties.nil?
42
+
43
+ @speed_category = speed_category
44
+ @offset_meters = offset_meters
45
+ @additional_properties = additional_properties
46
+ end
47
+
48
+ # Creates an instance of the object from a hash.
49
+ def self.from_hash(hash)
50
+ return nil unless hash
51
+
52
+ # Extract variables from the hash.
53
+ speed_category =
54
+ hash.key?('speed_category') ? hash['speed_category'] : nil
55
+ offset_meters = hash.key?('offset_meters') ? hash['offset_meters'] : nil
56
+
57
+ # Create a new hash for additional properties, removing known properties.
58
+ new_hash = hash.reject { |k, _| names.value?(k) }
59
+
60
+ additional_properties = APIHelper.get_additional_properties(
61
+ new_hash, proc { |value| value }
62
+ )
63
+
64
+ # Create object from extracted values.
65
+ DirectionsTrafficSpeedEntry.new(speed_category: speed_category,
66
+ offset_meters: offset_meters,
67
+ additional_properties: additional_properties)
68
+ end
69
+
70
+ # Provides a human-readable string representation of the object.
71
+ def to_s
72
+ class_name = self.class.name.split('::').last
73
+ "<#{class_name} speed_category: #{@speed_category}, offset_meters: #{@offset_meters},"\
74
+ " additional_properties: #{@additional_properties}>"
75
+ end
76
+
77
+ # Provides a debugging-friendly string with detailed object information.
78
+ def inspect
79
+ class_name = self.class.name.split('::').last
80
+ "<#{class_name} speed_category: #{@speed_category.inspect}, offset_meters:"\
81
+ " #{@offset_meters.inspect}, additional_properties: #{@additional_properties}>"
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,95 @@
1
+ # google_maps_platform
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module GoogleMapsPlatform
7
+ # DirectionsTransitAgency Model.
8
+ class DirectionsTransitAgency < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The name of this transit agency.
13
+ # @return [String]
14
+ attr_accessor :name
15
+
16
+ # The transit agency's phone number.
17
+ # @return [String]
18
+ attr_accessor :phone
19
+
20
+ # The transit agency's URL.
21
+ # @return [String]
22
+ attr_accessor :url
23
+
24
+ # A mapping from model property names to API property names.
25
+ def self.names
26
+ @_hash = {} if @_hash.nil?
27
+ @_hash['name'] = 'name'
28
+ @_hash['phone'] = 'phone'
29
+ @_hash['url'] = 'url'
30
+ @_hash
31
+ end
32
+
33
+ # An array for optional fields
34
+ def self.optionals
35
+ %w[
36
+ name
37
+ phone
38
+ url
39
+ ]
40
+ end
41
+
42
+ # An array for nullable fields
43
+ def self.nullables
44
+ []
45
+ end
46
+
47
+ def initialize(name: SKIP, phone: SKIP, url: SKIP,
48
+ additional_properties: nil)
49
+ # Add additional model properties to the instance
50
+ additional_properties = {} if additional_properties.nil?
51
+
52
+ @name = name unless name == SKIP
53
+ @phone = phone unless phone == SKIP
54
+ @url = url unless url == SKIP
55
+ @additional_properties = additional_properties
56
+ end
57
+
58
+ # Creates an instance of the object from a hash.
59
+ def self.from_hash(hash)
60
+ return nil unless hash
61
+
62
+ # Extract variables from the hash.
63
+ name = hash.key?('name') ? hash['name'] : SKIP
64
+ phone = hash.key?('phone') ? hash['phone'] : SKIP
65
+ url = hash.key?('url') ? hash['url'] : SKIP
66
+
67
+ # Create a new hash for additional properties, removing known properties.
68
+ new_hash = hash.reject { |k, _| names.value?(k) }
69
+
70
+ additional_properties = APIHelper.get_additional_properties(
71
+ new_hash, proc { |value| value }
72
+ )
73
+
74
+ # Create object from extracted values.
75
+ DirectionsTransitAgency.new(name: name,
76
+ phone: phone,
77
+ url: url,
78
+ additional_properties: additional_properties)
79
+ end
80
+
81
+ # Provides a human-readable string representation of the object.
82
+ def to_s
83
+ class_name = self.class.name.split('::').last
84
+ "<#{class_name} name: #{@name}, phone: #{@phone}, url: #{@url}, additional_properties:"\
85
+ " #{@additional_properties}>"
86
+ end
87
+
88
+ # Provides a debugging-friendly string with detailed object information.
89
+ def inspect
90
+ class_name = self.class.name.split('::').last
91
+ "<#{class_name} name: #{@name.inspect}, phone: #{@phone.inspect}, url: #{@url.inspect},"\
92
+ " additional_properties: #{@additional_properties}>"
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,176 @@
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
+ # Additional information that is not relevant for other modes of
8
+ # transportation.
9
+ class DirectionsTransitDetails < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [DirectionsTransitStop]
15
+ attr_accessor :arrival_stop
16
+
17
+ # An object containing Unix time, a time zone, and its formatted text
18
+ # representation.
19
+ # @return [TimeZoneTextValueObject]
20
+ attr_accessor :arrival_time
21
+
22
+ # An object containing Unix time, a time zone, and its formatted text
23
+ # representation.
24
+ # @return [DirectionsTransitStop]
25
+ attr_accessor :departure_stop
26
+
27
+ # An object containing Unix time, a time zone, and its formatted text
28
+ # representation.
29
+ # @return [TimeZoneTextValueObject]
30
+ attr_accessor :departure_time
31
+
32
+ # Specifies the direction in which to travel on this line, as it is marked
33
+ # on the vehicle or at the departure stop. This will often be the terminus
34
+ # station.
35
+ # @return [String]
36
+ attr_accessor :headsign
37
+
38
+ # Specifies the expected number of seconds between departures from the same
39
+ # stop at this time. For example, with a `headway` value of 600, you would
40
+ # expect a ten minute wait if you should miss your bus.
41
+ # @return [Integer]
42
+ attr_accessor :headway
43
+
44
+ # Specifies the expected number of seconds between departures from the same
45
+ # stop at this time. For example, with a `headway` value of 600, you would
46
+ # expect a ten minute wait if you should miss your bus.
47
+ # @return [DirectionsTransitLine]
48
+ attr_accessor :line
49
+
50
+ # The number of stops from the departure to the arrival stop. This includes
51
+ # the arrival stop, but not the departure stop. For example, if your
52
+ # directions involve leaving from Stop A, passing through stops B and C, and
53
+ # arriving at stop D, `num_stops` will return 3.
54
+ # @return [Integer]
55
+ attr_accessor :num_stops
56
+
57
+ # The text that appears in schedules and sign boards to identify a transit
58
+ # trip to passengers. The text should uniquely identify a trip within a
59
+ # service day. For example, "538" is the `trip_short_name` of the Amtrak
60
+ # train that leaves San Jose, CA at 15:10 on weekdays to Sacramento, CA.
61
+ # @return [String]
62
+ attr_accessor :trip_short_name
63
+
64
+ # A mapping from model property names to API property names.
65
+ def self.names
66
+ @_hash = {} if @_hash.nil?
67
+ @_hash['arrival_stop'] = 'arrival_stop'
68
+ @_hash['arrival_time'] = 'arrival_time'
69
+ @_hash['departure_stop'] = 'departure_stop'
70
+ @_hash['departure_time'] = 'departure_time'
71
+ @_hash['headsign'] = 'headsign'
72
+ @_hash['headway'] = 'headway'
73
+ @_hash['line'] = 'line'
74
+ @_hash['num_stops'] = 'num_stops'
75
+ @_hash['trip_short_name'] = 'trip_short_name'
76
+ @_hash
77
+ end
78
+
79
+ # An array for optional fields
80
+ def self.optionals
81
+ %w[
82
+ arrival_stop
83
+ arrival_time
84
+ departure_stop
85
+ departure_time
86
+ headsign
87
+ headway
88
+ line
89
+ num_stops
90
+ trip_short_name
91
+ ]
92
+ end
93
+
94
+ # An array for nullable fields
95
+ def self.nullables
96
+ []
97
+ end
98
+
99
+ def initialize(arrival_stop: SKIP, arrival_time: SKIP, departure_stop: SKIP,
100
+ departure_time: SKIP, headsign: SKIP, headway: SKIP,
101
+ line: SKIP, num_stops: SKIP, trip_short_name: SKIP,
102
+ additional_properties: nil)
103
+ # Add additional model properties to the instance
104
+ additional_properties = {} if additional_properties.nil?
105
+
106
+ @arrival_stop = arrival_stop unless arrival_stop == SKIP
107
+ @arrival_time = arrival_time unless arrival_time == SKIP
108
+ @departure_stop = departure_stop unless departure_stop == SKIP
109
+ @departure_time = departure_time unless departure_time == SKIP
110
+ @headsign = headsign unless headsign == SKIP
111
+ @headway = headway unless headway == SKIP
112
+ @line = line unless line == SKIP
113
+ @num_stops = num_stops unless num_stops == SKIP
114
+ @trip_short_name = trip_short_name unless trip_short_name == SKIP
115
+ @additional_properties = additional_properties
116
+ end
117
+
118
+ # Creates an instance of the object from a hash.
119
+ def self.from_hash(hash)
120
+ return nil unless hash
121
+
122
+ # Extract variables from the hash.
123
+ arrival_stop = DirectionsTransitStop.from_hash(hash['arrival_stop']) if hash['arrival_stop']
124
+ arrival_time = TimeZoneTextValueObject.from_hash(hash['arrival_time']) if
125
+ hash['arrival_time']
126
+ departure_stop = DirectionsTransitStop.from_hash(hash['departure_stop']) if
127
+ hash['departure_stop']
128
+ departure_time = TimeZoneTextValueObject.from_hash(hash['departure_time']) if
129
+ hash['departure_time']
130
+ headsign = hash.key?('headsign') ? hash['headsign'] : SKIP
131
+ headway = hash.key?('headway') ? hash['headway'] : SKIP
132
+ line = DirectionsTransitLine.from_hash(hash['line']) if hash['line']
133
+ num_stops = hash.key?('num_stops') ? hash['num_stops'] : SKIP
134
+ trip_short_name =
135
+ hash.key?('trip_short_name') ? hash['trip_short_name'] : 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
+ DirectionsTransitDetails.new(arrival_stop: arrival_stop,
146
+ arrival_time: arrival_time,
147
+ departure_stop: departure_stop,
148
+ departure_time: departure_time,
149
+ headsign: headsign,
150
+ headway: headway,
151
+ line: line,
152
+ num_stops: num_stops,
153
+ trip_short_name: trip_short_name,
154
+ additional_properties: additional_properties)
155
+ end
156
+
157
+ # Provides a human-readable string representation of the object.
158
+ def to_s
159
+ class_name = self.class.name.split('::').last
160
+ "<#{class_name} arrival_stop: #{@arrival_stop}, arrival_time: #{@arrival_time},"\
161
+ " departure_stop: #{@departure_stop}, departure_time: #{@departure_time}, headsign:"\
162
+ " #{@headsign}, headway: #{@headway}, line: #{@line}, num_stops: #{@num_stops},"\
163
+ " trip_short_name: #{@trip_short_name}, additional_properties: #{@additional_properties}>"
164
+ end
165
+
166
+ # Provides a debugging-friendly string with detailed object information.
167
+ def inspect
168
+ class_name = self.class.name.split('::').last
169
+ "<#{class_name} arrival_stop: #{@arrival_stop.inspect}, arrival_time:"\
170
+ " #{@arrival_time.inspect}, departure_stop: #{@departure_stop.inspect}, departure_time:"\
171
+ " #{@departure_time.inspect}, headsign: #{@headsign.inspect}, headway: #{@headway.inspect},"\
172
+ " line: #{@line.inspect}, num_stops: #{@num_stops.inspect}, trip_short_name:"\
173
+ " #{@trip_short_name.inspect}, additional_properties: #{@additional_properties}>"
174
+ end
175
+ end
176
+ end