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
+ # An object containing a numeric value and its formatted text representation.
8
+ class TextValueObject < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # String value.
13
+ # @return [String]
14
+ attr_accessor :text
15
+
16
+ # Numeric value.
17
+ # @return [Float]
18
+ attr_accessor :value
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['text'] = 'text'
24
+ @_hash['value'] = 'value'
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(text:, value:, additional_properties: nil)
39
+ # Add additional model properties to the instance
40
+ additional_properties = {} if additional_properties.nil?
41
+
42
+ @text = text
43
+ @value = value
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
+ text = hash.key?('text') ? hash['text'] : nil
53
+ value = hash.key?('value') ? hash['value'] : 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
+ TextValueObject.new(text: text,
64
+ value: value,
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} text: #{@text}, value: #{@value}, 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} text: #{@text.inspect}, value: #{@value.inspect}, additional_properties:"\
79
+ " #{@additional_properties}>"
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,154 @@
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
+ # TimeZoneResponse Model.
8
+ class TimeZoneResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The offset for daylight-savings time in seconds. This will be zero if the
13
+ # time zone is not in Daylight Savings Time during the specified
14
+ # `timestamp`.
15
+ # @return [Float]
16
+ attr_accessor :dst_offset
17
+
18
+ # The offset from UTC (in seconds) for the given location. This does not
19
+ # take into effect daylight savings.
20
+ # @return [Float]
21
+ attr_accessor :raw_offset
22
+
23
+ # a string containing the ID of the time zone, such as "America/Los_Angeles"
24
+ # or "Australia/Sydney". These IDs are defined by [Unicode Common Locale
25
+ # Data Repository (CLDR) project](http://cldr.unicode.org/), and currently
26
+ # available in file timezone.xml. When a timezone has several IDs, the
27
+ # canonical one is returned. In xml responses, this is the first alias of
28
+ # each timezone. For example, "Asia/Calcutta" is returned, not
29
+ # "Asia/Kolkata".
30
+ # @return [String]
31
+ attr_accessor :time_zone_id
32
+
33
+ # The long form name of the time zone. This field will be localized if the
34
+ # language parameter is set. eg. `Pacific Daylight Time` or `Australian
35
+ # Eastern Daylight Time`.
36
+ # @return [String]
37
+ attr_accessor :time_zone_name
38
+
39
+ # The `status` field within the Time Zone response object contains the
40
+ # status of the request. The `status` field may contain the following
41
+ # values:
42
+ # - `OK` indicates that the request was successful.
43
+ # - `INVALID_REQUEST` indicates that the request was malformed.
44
+ # - `OVER_DAILY_LIMIT` indicates any of the following:
45
+ # - The API key is missing or invalid.
46
+ # - Billing has not been enabled on your account.
47
+ # - A self-imposed usage cap has been exceeded.
48
+ # - The provided method of payment is no longer valid (for example, a
49
+ # credit card has expired).
50
+ # - `OVER_QUERY_LIMIT` indicates the requestor has exceeded quota.
51
+ # - `REQUEST_DENIED` indicates that the API did not complete the request.
52
+ # Confirm that the request was sent over HTTPS instead of HTTP.
53
+ # - `UNKNOWN_ERROR` indicates an unknown error.
54
+ # - `ZERO_RESULTS` indicates that no time zone data could be found for the
55
+ # specified position or time. Confirm that the request is for a location on
56
+ # land, and not over water.
57
+ # @return [TimeZoneStatus]
58
+ attr_accessor :status
59
+
60
+ # Detailed information about the reasons behind the given status code.
61
+ # Included if status other than `Ok`.
62
+ # @return [String]
63
+ attr_accessor :error_message
64
+
65
+ # A mapping from model property names to API property names.
66
+ def self.names
67
+ @_hash = {} if @_hash.nil?
68
+ @_hash['dst_offset'] = 'dstOffset'
69
+ @_hash['raw_offset'] = 'rawOffset'
70
+ @_hash['time_zone_id'] = 'timeZoneId'
71
+ @_hash['time_zone_name'] = 'timeZoneName'
72
+ @_hash['status'] = 'status'
73
+ @_hash['error_message'] = 'errorMessage'
74
+ @_hash
75
+ end
76
+
77
+ # An array for optional fields
78
+ def self.optionals
79
+ %w[
80
+ dst_offset
81
+ raw_offset
82
+ time_zone_id
83
+ time_zone_name
84
+ error_message
85
+ ]
86
+ end
87
+
88
+ # An array for nullable fields
89
+ def self.nullables
90
+ []
91
+ end
92
+
93
+ def initialize(status:, dst_offset: SKIP, raw_offset: SKIP,
94
+ time_zone_id: SKIP, time_zone_name: SKIP,
95
+ error_message: SKIP, additional_properties: nil)
96
+ # Add additional model properties to the instance
97
+ additional_properties = {} if additional_properties.nil?
98
+
99
+ @dst_offset = dst_offset unless dst_offset == SKIP
100
+ @raw_offset = raw_offset unless raw_offset == SKIP
101
+ @time_zone_id = time_zone_id unless time_zone_id == SKIP
102
+ @time_zone_name = time_zone_name unless time_zone_name == SKIP
103
+ @status = status
104
+ @error_message = error_message unless error_message == 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
+ status = hash.key?('status') ? hash['status'] : nil
114
+ dst_offset = hash.key?('dstOffset') ? hash['dstOffset'] : SKIP
115
+ raw_offset = hash.key?('rawOffset') ? hash['rawOffset'] : SKIP
116
+ time_zone_id = hash.key?('timeZoneId') ? hash['timeZoneId'] : SKIP
117
+ time_zone_name = hash.key?('timeZoneName') ? hash['timeZoneName'] : SKIP
118
+ error_message = hash.key?('errorMessage') ? hash['errorMessage'] : SKIP
119
+
120
+ # Create a new hash for additional properties, removing known properties.
121
+ new_hash = hash.reject { |k, _| names.value?(k) }
122
+
123
+ additional_properties = APIHelper.get_additional_properties(
124
+ new_hash, proc { |value| value }
125
+ )
126
+
127
+ # Create object from extracted values.
128
+ TimeZoneResponse.new(status: status,
129
+ dst_offset: dst_offset,
130
+ raw_offset: raw_offset,
131
+ time_zone_id: time_zone_id,
132
+ time_zone_name: time_zone_name,
133
+ error_message: error_message,
134
+ additional_properties: additional_properties)
135
+ end
136
+
137
+ # Provides a human-readable string representation of the object.
138
+ def to_s
139
+ class_name = self.class.name.split('::').last
140
+ "<#{class_name} dst_offset: #{@dst_offset}, raw_offset: #{@raw_offset}, time_zone_id:"\
141
+ " #{@time_zone_id}, time_zone_name: #{@time_zone_name}, status: #{@status}, error_message:"\
142
+ " #{@error_message}, additional_properties: #{@additional_properties}>"
143
+ end
144
+
145
+ # Provides a debugging-friendly string with detailed object information.
146
+ def inspect
147
+ class_name = self.class.name.split('::').last
148
+ "<#{class_name} dst_offset: #{@dst_offset.inspect}, raw_offset: #{@raw_offset.inspect},"\
149
+ " time_zone_id: #{@time_zone_id.inspect}, time_zone_name: #{@time_zone_name.inspect},"\
150
+ " status: #{@status.inspect}, error_message: #{@error_message.inspect},"\
151
+ " additional_properties: #{@additional_properties}>"
152
+ end
153
+ end
154
+ end
@@ -0,0 +1,68 @@
1
+ # google_maps_platform
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module GoogleMapsPlatform
7
+ # The `status` field within the Time Zone response object contains the status
8
+ # of the request. The `status` field may contain the following values: - `OK`
9
+ # indicates that the request was successful. - `INVALID_REQUEST` indicates
10
+ # that the request was malformed. - `OVER_DAILY_LIMIT` indicates any of the
11
+ # following: - The API key is missing or invalid. - Billing has not been
12
+ # enabled on your account. - A self-imposed usage cap has been exceeded. -
13
+ # The provided method of payment is no longer valid (for example, a credit
14
+ # card has expired). - `OVER_QUERY_LIMIT` indicates the requestor has exceeded
15
+ # quota. - `REQUEST_DENIED` indicates that the API did not complete the
16
+ # request. Confirm that the request was sent over HTTPS instead of HTTP. -
17
+ # `UNKNOWN_ERROR` indicates an unknown error. - `ZERO_RESULTS` indicates that
18
+ # no time zone data could be found for the specified position or time. Confirm
19
+ # that the request is for a location on land, and not over water.
20
+ class TimeZoneStatus
21
+ TIME_ZONE_STATUS = [
22
+ # TODO: Write general description for OK
23
+ OK = 'OK'.freeze,
24
+
25
+ # TODO: Write general description for INVALID_REQUEST
26
+ INVALID_REQUEST = 'INVALID_REQUEST'.freeze,
27
+
28
+ # TODO: Write general description for OVER_DAILY_LIMIT
29
+ OVER_DAILY_LIMIT = 'OVER_DAILY_LIMIT'.freeze,
30
+
31
+ # TODO: Write general description for OVER_QUERY_LIMIT
32
+ OVER_QUERY_LIMIT = 'OVER_QUERY_LIMIT'.freeze,
33
+
34
+ # TODO: Write general description for REQUEST_DENIED
35
+ REQUEST_DENIED = 'REQUEST_DENIED'.freeze,
36
+
37
+ # TODO: Write general description for UNKNOWN_ERROR
38
+ UNKNOWN_ERROR = 'UNKNOWN_ERROR'.freeze,
39
+
40
+ # TODO: Write general description for ZERO_RESULTS
41
+ ZERO_RESULTS = 'ZERO_RESULTS'.freeze
42
+ ].freeze
43
+
44
+ def self.validate(value)
45
+ return false if value.nil?
46
+
47
+ TIME_ZONE_STATUS.include?(value)
48
+ end
49
+
50
+ def self.from_value(value, default_value = OK)
51
+ return default_value if value.nil?
52
+
53
+ str = value.to_s.strip
54
+
55
+ case str.downcase
56
+ when 'ok' then OK
57
+ when 'invalid_request' then INVALID_REQUEST
58
+ when 'over_daily_limit' then OVER_DAILY_LIMIT
59
+ when 'over_query_limit' then OVER_QUERY_LIMIT
60
+ when 'request_denied' then REQUEST_DENIED
61
+ when 'unknown_error' then UNKNOWN_ERROR
62
+ when 'zero_results' then ZERO_RESULTS
63
+ else
64
+ default_value
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,94 @@
1
+ # google_maps_platform
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module GoogleMapsPlatform
7
+ # An object containing Unix time, a time zone, and its formatted text
8
+ # representation.
9
+ class TimeZoneTextValueObject < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # The time specified as a string in the time zone.
14
+ # @return [String]
15
+ attr_accessor :text
16
+
17
+ # The time specified as Unix time, or seconds since midnight, January 1,
18
+ # 1970 UTC.
19
+ # @return [Float]
20
+ attr_accessor :value
21
+
22
+ # Contains the time zone. The value is the name of the time zone as defined
23
+ # in the [IANA Time Zone Database](http://www.iana.org/time-zones), e.g.
24
+ # "America/New_York".
25
+ # @return [String]
26
+ attr_accessor :time_zone
27
+
28
+ # A mapping from model property names to API property names.
29
+ def self.names
30
+ @_hash = {} if @_hash.nil?
31
+ @_hash['text'] = 'text'
32
+ @_hash['value'] = 'value'
33
+ @_hash['time_zone'] = 'time_zone'
34
+ @_hash
35
+ end
36
+
37
+ # An array for optional fields
38
+ def self.optionals
39
+ []
40
+ end
41
+
42
+ # An array for nullable fields
43
+ def self.nullables
44
+ []
45
+ end
46
+
47
+ def initialize(text:, value:, time_zone:, additional_properties: nil)
48
+ # Add additional model properties to the instance
49
+ additional_properties = {} if additional_properties.nil?
50
+
51
+ @text = text
52
+ @value = value
53
+ @time_zone = time_zone
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
+ text = hash.key?('text') ? hash['text'] : nil
63
+ value = hash.key?('value') ? hash['value'] : nil
64
+ time_zone = hash.key?('time_zone') ? hash['time_zone'] : nil
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
+ TimeZoneTextValueObject.new(text: text,
75
+ value: value,
76
+ time_zone: time_zone,
77
+ additional_properties: additional_properties)
78
+ end
79
+
80
+ # Provides a human-readable string representation of the object.
81
+ def to_s
82
+ class_name = self.class.name.split('::').last
83
+ "<#{class_name} text: #{@text}, value: #{@value}, time_zone: #{@time_zone},"\
84
+ " additional_properties: #{@additional_properties}>"
85
+ end
86
+
87
+ # Provides a debugging-friendly string with detailed object information.
88
+ def inspect
89
+ class_name = self.class.name.split('::').last
90
+ "<#{class_name} text: #{@text.inspect}, value: #{@value.inspect}, time_zone:"\
91
+ " #{@time_zone.inspect}, additional_properties: #{@additional_properties}>"
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,40 @@
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
+ # traffic_model.
8
+ class TrafficModel
9
+ TRAFFIC_MODEL = [
10
+ # TODO: Write general description for BEST_GUESS
11
+ BEST_GUESS = 'best_guess'.freeze,
12
+
13
+ # TODO: Write general description for PESSIMISTIC
14
+ PESSIMISTIC = 'pessimistic'.freeze,
15
+
16
+ # TODO: Write general description for OPTIMISTIC
17
+ OPTIMISTIC = 'optimistic'.freeze
18
+ ].freeze
19
+
20
+ def self.validate(value)
21
+ return false if value.nil?
22
+
23
+ TRAFFIC_MODEL.include?(value)
24
+ end
25
+
26
+ def self.from_value(value, default_value = BEST_GUESS)
27
+ return default_value if value.nil?
28
+
29
+ str = value.to_s.strip
30
+
31
+ case str.downcase
32
+ when 'best_guess' then BEST_GUESS
33
+ when 'pessimistic' then PESSIMISTIC
34
+ when 'optimistic' then OPTIMISTIC
35
+ else
36
+ default_value
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,36 @@
1
+ # google_maps_platform
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module GoogleMapsPlatform
7
+ # transit_routing_preference.
8
+ class TransitRoutingPreference
9
+ TRANSIT_ROUTING_PREFERENCE = [
10
+ # TODO: Write general description for LESS_WALKING
11
+ LESS_WALKING = 'less_walking'.freeze,
12
+
13
+ # TODO: Write general description for FEWER_TRANSFERS
14
+ FEWER_TRANSFERS = 'fewer_transfers'.freeze
15
+ ].freeze
16
+
17
+ def self.validate(value)
18
+ return false if value.nil?
19
+
20
+ TRANSIT_ROUTING_PREFERENCE.include?(value)
21
+ end
22
+
23
+ def self.from_value(value, default_value = LESS_WALKING)
24
+ return default_value if value.nil?
25
+
26
+ str = value.to_s.strip
27
+
28
+ case str.downcase
29
+ when 'less_walking' then LESS_WALKING
30
+ when 'fewer_transfers' then FEWER_TRANSFERS
31
+ else
32
+ default_value
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,48 @@
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
+ # - `DRIVING` (default) indicates calculation using the road network. -
8
+ # `BICYCLING` requests calculation for bicycling via bicycle paths & preferred
9
+ # streets (where available). - `TRANSIT` requests calculation via public
10
+ # transit routes (where available). - `WALKING` requests calculation for
11
+ # walking via pedestrian paths & sidewalks (where available).
12
+ class TravelMode
13
+ TRAVEL_MODE = [
14
+ # TODO: Write general description for DRIVING
15
+ DRIVING = 'DRIVING'.freeze,
16
+
17
+ # TODO: Write general description for BICYCLING
18
+ BICYCLING = 'BICYCLING'.freeze,
19
+
20
+ # TODO: Write general description for TRANSIT
21
+ TRANSIT = 'TRANSIT'.freeze,
22
+
23
+ # TODO: Write general description for WALKING
24
+ WALKING = 'WALKING'.freeze
25
+ ].freeze
26
+
27
+ def self.validate(value)
28
+ return false if value.nil?
29
+
30
+ TRAVEL_MODE.include?(value)
31
+ end
32
+
33
+ def self.from_value(value, default_value = DRIVING)
34
+ return default_value if value.nil?
35
+
36
+ str = value.to_s.strip
37
+
38
+ case str.downcase
39
+ when 'driving' then DRIVING
40
+ when 'bicycling' then BICYCLING
41
+ when 'transit' then TRANSIT
42
+ when 'walking' then WALKING
43
+ else
44
+ default_value
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,140 @@
1
+ # google_maps_platform
2
+ #
3
+ # This file was automatically generated by APIMATIC
4
+ # v3.0 ( https://www.apimatic.io ).
5
+
6
+ module GoogleMapsPlatform
7
+ # Type.
8
+ class Type
9
+ TYPE = [
10
+ # TODO: Write general description for ADMINISTRATIVE_AREA_LEVEL_1
11
+ ADMINISTRATIVE_AREA_LEVEL_1 = 'administrative_area_level_1'.freeze,
12
+
13
+ # TODO: Write general description for ADMINISTRATIVE_AREA_LEVEL_2
14
+ ADMINISTRATIVE_AREA_LEVEL_2 = 'administrative_area_level_2'.freeze,
15
+
16
+ # TODO: Write general description for ADMINISTRATIVE_AREA_LEVEL_3
17
+ ADMINISTRATIVE_AREA_LEVEL_3 = 'administrative_area_level_3'.freeze,
18
+
19
+ # TODO: Write general description for ADMINISTRATIVE_AREA_LEVEL_4
20
+ ADMINISTRATIVE_AREA_LEVEL_4 = 'administrative_area_level_4'.freeze,
21
+
22
+ # TODO: Write general description for ADMINISTRATIVE_AREA_LEVEL_5
23
+ ADMINISTRATIVE_AREA_LEVEL_5 = 'administrative_area_level_5'.freeze,
24
+
25
+ # TODO: Write general description for AMUSEMENT_PARK
26
+ AMUSEMENT_PARK = 'amusement_park'.freeze,
27
+
28
+ # TODO: Write general description for AIRPORT
29
+ AIRPORT = 'airport'.freeze,
30
+
31
+ # TODO: Write general description for COLLOQUIAL_AREA
32
+ COLLOQUIAL_AREA = 'colloquial_area'.freeze,
33
+
34
+ # TODO: Write general description for COUNTRY
35
+ COUNTRY = 'country'.freeze,
36
+
37
+ # TODO: Write general description for ESTABLISHMENT
38
+ ESTABLISHMENT = 'establishment'.freeze,
39
+
40
+ # TODO: Write general description for INTERSECTION
41
+ INTERSECTION = 'intersection'.freeze,
42
+
43
+ # TODO: Write general description for LOCALITY
44
+ LOCALITY = 'locality'.freeze,
45
+
46
+ # TODO: Write general description for NATURAL_FEATURE
47
+ NATURAL_FEATURE = 'natural_feature'.freeze,
48
+
49
+ # TODO: Write general description for NEIGHBORHOOD
50
+ NEIGHBORHOOD = 'neighborhood'.freeze,
51
+
52
+ # TODO: Write general description for PARK
53
+ PARK = 'park'.freeze,
54
+
55
+ # TODO: Write general description for PLUS_CODE
56
+ PLUS_CODE = 'plus_code'.freeze,
57
+
58
+ # TODO: Write general description for POINT_OF_INTEREST
59
+ POINT_OF_INTEREST = 'point_of_interest'.freeze,
60
+
61
+ # TODO: Write general description for POLITICAL
62
+ POLITICAL = 'political'.freeze,
63
+
64
+ # TODO: Write general description for POSTAL_CODE
65
+ POSTAL_CODE = 'postal_code'.freeze,
66
+
67
+ # TODO: Write general description for PREMISE
68
+ PREMISE = 'premise'.freeze,
69
+
70
+ # TODO: Write general description for ROUTE
71
+ ROUTE = 'route'.freeze,
72
+
73
+ # TODO: Write general description for STREET_ADDRESS
74
+ STREET_ADDRESS = 'street_address'.freeze,
75
+
76
+ # TODO: Write general description for SUBLOCALITY
77
+ SUBLOCALITY = 'sublocality'.freeze,
78
+
79
+ # TODO: Write general description for SUBLOCALITY_LEVEL_1
80
+ SUBLOCALITY_LEVEL_1 = 'sublocality_level_1'.freeze,
81
+
82
+ # TODO: Write general description for SUBPREMISE
83
+ SUBPREMISE = 'subpremise'.freeze,
84
+
85
+ # TODO: Write general description for TOURIST_ATTRACTION
86
+ TOURIST_ATTRACTION = 'tourist_attraction'.freeze,
87
+
88
+ # TODO: Write general description for TRAIN_STATION
89
+ TRAIN_STATION = 'train_station'.freeze,
90
+
91
+ # TODO: Write general description for TRANSIT_STATION
92
+ TRANSIT_STATION = 'transit_station'.freeze
93
+ ].freeze
94
+
95
+ def self.validate(value)
96
+ return false if value.nil?
97
+
98
+ TYPE.include?(value)
99
+ end
100
+
101
+ def self.from_value(value, default_value = ADMINISTRATIVE_AREA_LEVEL_1)
102
+ return default_value if value.nil?
103
+
104
+ str = value.to_s.strip
105
+
106
+ case str.downcase
107
+ when 'administrative_area_level_1' then ADMINISTRATIVE_AREA_LEVEL_1
108
+ when 'administrative_area_level_2' then ADMINISTRATIVE_AREA_LEVEL_2
109
+ when 'administrative_area_level_3' then ADMINISTRATIVE_AREA_LEVEL_3
110
+ when 'administrative_area_level_4' then ADMINISTRATIVE_AREA_LEVEL_4
111
+ when 'administrative_area_level_5' then ADMINISTRATIVE_AREA_LEVEL_5
112
+ when 'amusement_park' then AMUSEMENT_PARK
113
+ when 'airport' then AIRPORT
114
+ when 'colloquial_area' then COLLOQUIAL_AREA
115
+ when 'country' then COUNTRY
116
+ when 'establishment' then ESTABLISHMENT
117
+ when 'intersection' then INTERSECTION
118
+ when 'locality' then LOCALITY
119
+ when 'natural_feature' then NATURAL_FEATURE
120
+ when 'neighborhood' then NEIGHBORHOOD
121
+ when 'park' then PARK
122
+ when 'plus_code' then PLUS_CODE
123
+ when 'point_of_interest' then POINT_OF_INTEREST
124
+ when 'political' then POLITICAL
125
+ when 'postal_code' then POSTAL_CODE
126
+ when 'premise' then PREMISE
127
+ when 'route' then ROUTE
128
+ when 'street_address' then STREET_ADDRESS
129
+ when 'sublocality' then SUBLOCALITY
130
+ when 'sublocality_level_1' then SUBLOCALITY_LEVEL_1
131
+ when 'subpremise' then SUBPREMISE
132
+ when 'tourist_attraction' then TOURIST_ATTRACTION
133
+ when 'train_station' then TRAIN_STATION
134
+ when 'transit_station' then TRANSIT_STATION
135
+ else
136
+ default_value
137
+ end
138
+ end
139
+ end
140
+ end