timelogic-api 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 (49) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +188 -0
  3. data/docs/ApiError.md +22 -0
  4. data/docs/BulkError.md +24 -0
  5. data/docs/CalendarResponse.md +48 -0
  6. data/docs/DiffEndpointRef.md +18 -0
  7. data/docs/DiffResponse.md +36 -0
  8. data/docs/DstResponse.md +42 -0
  9. data/docs/ElapsedResponse.md +32 -0
  10. data/docs/ErrorResponse.md +22 -0
  11. data/docs/GetCurrentTime200Response.md +49 -0
  12. data/docs/GetTimezone200Response.md +49 -0
  13. data/docs/JwkKey.md +28 -0
  14. data/docs/JwksResponse.md +18 -0
  15. data/docs/TimeApi.md +1093 -0
  16. data/docs/TimePayload.md +38 -0
  17. data/docs/TimePayloadBulkItem.md +49 -0
  18. data/docs/TimePayloadBulkResponse.md +15 -0
  19. data/docs/TimezoneMatch.md +42 -0
  20. data/docs/TimezoneOffsetResponse.md +44 -0
  21. data/docs/TimezoneResolvedResponse.md +42 -0
  22. data/docs/UtilityApi.md +74 -0
  23. data/lib/timelogic-api/api/time_api.rb +1344 -0
  24. data/lib/timelogic-api/api/utility_api.rb +82 -0
  25. data/lib/timelogic-api/api_client.rb +394 -0
  26. data/lib/timelogic-api/api_error.rb +58 -0
  27. data/lib/timelogic-api/configuration.rb +353 -0
  28. data/lib/timelogic-api/models/api_error.rb +282 -0
  29. data/lib/timelogic-api/models/bulk_error.rb +271 -0
  30. data/lib/timelogic-api/models/calendar_response.rb +474 -0
  31. data/lib/timelogic-api/models/diff_endpoint_ref.rb +222 -0
  32. data/lib/timelogic-api/models/diff_response.rb +386 -0
  33. data/lib/timelogic-api/models/dst_response.rb +427 -0
  34. data/lib/timelogic-api/models/elapsed_response.rb +354 -0
  35. data/lib/timelogic-api/models/error_response.rb +247 -0
  36. data/lib/timelogic-api/models/get_current_time200_response.rb +105 -0
  37. data/lib/timelogic-api/models/get_timezone200_response.rb +105 -0
  38. data/lib/timelogic-api/models/jwk_key.rb +371 -0
  39. data/lib/timelogic-api/models/jwks_response.rb +223 -0
  40. data/lib/timelogic-api/models/time_payload.rb +395 -0
  41. data/lib/timelogic-api/models/time_payload_bulk_item.rb +106 -0
  42. data/lib/timelogic-api/models/time_payload_bulk_response.rb +210 -0
  43. data/lib/timelogic-api/models/timezone_match.rb +437 -0
  44. data/lib/timelogic-api/models/timezone_offset_response.rb +452 -0
  45. data/lib/timelogic-api/models/timezone_resolved_response.rb +434 -0
  46. data/lib/timelogic-api/transport_configuration.rb +34 -0
  47. data/lib/timelogic-api/version.rb +7 -0
  48. data/lib/timelogic-api.rb +63 -0
  49. metadata +134 -0
@@ -0,0 +1,271 @@
1
+ =begin
2
+ #TimeLogic API | A World Time API
3
+
4
+ # Official public API contract for TimeLogic API.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.10.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TimeLogic::Api
17
+ # Per-item error wrapper used inside bulk arrays returned by bulk-capable routes.
18
+ class BulkError
19
+ attr_accessor :error
20
+
21
+ attr_accessor :request_id
22
+
23
+ # Intentionally omitted from public API error responses to avoid exposing request timing; use request_id for support correlation.
24
+ attr_accessor :timestamp
25
+
26
+ attr_accessor :item
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'error' => :'error',
32
+ :'request_id' => :'request_id',
33
+ :'timestamp' => :'timestamp',
34
+ :'item' => :'item'
35
+ }
36
+ end
37
+
38
+ # Returns all the JSON keys this model knows about
39
+ def self.acceptable_attributes
40
+ attribute_map.values
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'error' => :'ApiError',
47
+ :'request_id' => :'String',
48
+ :'timestamp' => :'Time',
49
+ :'item' => :'String'
50
+ }
51
+ end
52
+
53
+ # List of attributes with nullable: true
54
+ def self.openapi_nullable
55
+ Set.new([
56
+ ])
57
+ end
58
+
59
+ # List of class defined in allOf (OpenAPI v3)
60
+ def self.openapi_all_of
61
+ [
62
+ :'ErrorResponse'
63
+ ]
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TimeLogic::Api::BulkError` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ attributes = attributes.each_with_object({}) { |(k, v), h|
75
+ if (!self.class.attribute_map.key?(k.to_sym))
76
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TimeLogic::Api::BulkError`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
77
+ end
78
+ h[k.to_sym] = v
79
+ }
80
+
81
+ if attributes.key?(:'error')
82
+ self.error = attributes[:'error']
83
+ else
84
+ self.error = nil
85
+ end
86
+
87
+ if attributes.key?(:'request_id')
88
+ self.request_id = attributes[:'request_id']
89
+ else
90
+ self.request_id = nil
91
+ end
92
+
93
+ if attributes.key?(:'timestamp')
94
+ self.timestamp = attributes[:'timestamp']
95
+ end
96
+
97
+ if attributes.key?(:'item')
98
+ self.item = attributes[:'item']
99
+ else
100
+ self.item = nil
101
+ end
102
+ end
103
+
104
+ # Show invalid properties with the reasons. Usually used together with valid?
105
+ # @return Array for valid properties with the reasons
106
+ def list_invalid_properties
107
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
108
+ invalid_properties = Array.new
109
+ if @error.nil?
110
+ invalid_properties.push('invalid value for "error", error cannot be nil.')
111
+ end
112
+
113
+ if @request_id.nil?
114
+ invalid_properties.push('invalid value for "request_id", request_id cannot be nil.')
115
+ end
116
+
117
+ if @item.nil?
118
+ invalid_properties.push('invalid value for "item", item cannot be nil.')
119
+ end
120
+
121
+ invalid_properties
122
+ end
123
+
124
+ # Check to see if the all the properties in the model are valid
125
+ # @return true if the model is valid
126
+ def valid?
127
+ warn '[DEPRECATED] the `valid?` method is obsolete'
128
+ return false if @error.nil?
129
+ return false if @request_id.nil?
130
+ return false if @item.nil?
131
+ true
132
+ end
133
+
134
+ # Checks equality by comparing each attribute.
135
+ # @param [Object] Object to be compared
136
+ def ==(o)
137
+ return true if self.equal?(o)
138
+ self.class == o.class &&
139
+ error == o.error &&
140
+ request_id == o.request_id &&
141
+ timestamp == o.timestamp &&
142
+ item == o.item
143
+ end
144
+
145
+ # @see the `==` method
146
+ # @param [Object] Object to be compared
147
+ def eql?(o)
148
+ self == o
149
+ end
150
+
151
+ # Calculates hash code according to all attributes.
152
+ # @return [Integer] Hash code
153
+ def hash
154
+ [error, request_id, timestamp, item].hash
155
+ end
156
+
157
+ # Builds the object from hash
158
+ # @param [Hash] attributes Model attributes in the form of hash
159
+ # @return [Object] Returns the model itself
160
+ def self.build_from_hash(attributes)
161
+ return nil unless attributes.is_a?(Hash)
162
+ attributes = attributes.transform_keys(&:to_sym)
163
+ transformed_hash = {}
164
+ openapi_types.each_pair do |key, type|
165
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
166
+ transformed_hash["#{key}"] = nil
167
+ elsif type =~ /\AArray<(.*)>/i
168
+ # check to ensure the input is an array given that the attribute
169
+ # is documented as an array but the input is not
170
+ if attributes[attribute_map[key]].is_a?(Array)
171
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
172
+ end
173
+ elsif !attributes[attribute_map[key]].nil?
174
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
175
+ end
176
+ end
177
+ new(transformed_hash)
178
+ end
179
+
180
+ # Deserializes the data based on type
181
+ # @param string type Data type
182
+ # @param string value Value to be deserialized
183
+ # @return [Object] Deserialized data
184
+ def self._deserialize(type, value)
185
+ case type.to_sym
186
+ when :Time
187
+ Time.parse(value)
188
+ when :Date
189
+ Date.parse(value)
190
+ when :String
191
+ value.to_s
192
+ when :Integer
193
+ value.to_i
194
+ when :Float
195
+ value.to_f
196
+ when :Boolean
197
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
198
+ true
199
+ else
200
+ false
201
+ end
202
+ when :Object
203
+ # generic object (usually a Hash), return directly
204
+ value
205
+ when /\AArray<(?<inner_type>.+)>\z/
206
+ inner_type = Regexp.last_match[:inner_type]
207
+ value.map { |v| _deserialize(inner_type, v) }
208
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
209
+ k_type = Regexp.last_match[:k_type]
210
+ v_type = Regexp.last_match[:v_type]
211
+ {}.tap do |hash|
212
+ value.each do |k, v|
213
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
214
+ end
215
+ end
216
+ else # model
217
+ # models (e.g. Pet) or oneOf
218
+ klass = TimeLogic::Api.const_get(type)
219
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
220
+ end
221
+ end
222
+
223
+ # Returns the string representation of the object
224
+ # @return [String] String presentation of the object
225
+ def to_s
226
+ to_hash.to_s
227
+ end
228
+
229
+ # to_body is an alias to to_hash (backward compatibility)
230
+ # @return [Hash] Returns the object in the form of hash
231
+ def to_body
232
+ to_hash
233
+ end
234
+
235
+ # Returns the object in the form of hash
236
+ # @return [Hash] Returns the object in the form of hash
237
+ def to_hash
238
+ hash = {}
239
+ self.class.attribute_map.each_pair do |attr, param|
240
+ value = self.send(attr)
241
+ if value.nil?
242
+ is_nullable = self.class.openapi_nullable.include?(attr)
243
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
244
+ end
245
+
246
+ hash[param] = _to_hash(value)
247
+ end
248
+ hash
249
+ end
250
+
251
+ # Outputs non-array value in the form of hash
252
+ # For object, use to_hash. Otherwise, just return the value
253
+ # @param [Object] value Any valid value
254
+ # @return [Hash] Returns the value in the form of hash
255
+ def _to_hash(value)
256
+ if value.is_a?(Array)
257
+ value.compact.map { |v| _to_hash(v) }
258
+ elsif value.is_a?(Hash)
259
+ {}.tap do |hash|
260
+ value.each { |k, v| hash[k] = _to_hash(v) }
261
+ end
262
+ elsif value.respond_to? :to_hash
263
+ value.to_hash
264
+ else
265
+ value
266
+ end
267
+ end
268
+
269
+ end
270
+
271
+ end