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,437 @@
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
+ class TimezoneMatch
18
+ attr_accessor :unix
19
+
20
+ attr_accessor :unix_ms
21
+
22
+ attr_accessor :utc
23
+
24
+ attr_accessor :iso_local
25
+
26
+ attr_accessor :rfc2822
27
+
28
+ attr_accessor :human
29
+
30
+ attr_accessor :day_number
31
+
32
+ attr_accessor :day_short
33
+
34
+ attr_accessor :day_full
35
+
36
+ attr_accessor :timezone
37
+
38
+ attr_accessor :formatted
39
+
40
+ attr_accessor :offset
41
+
42
+ attr_accessor :dst
43
+
44
+ # Attribute mapping from ruby-style variable name to JSON key.
45
+ def self.attribute_map
46
+ {
47
+ :'unix' => :'unix',
48
+ :'unix_ms' => :'unix_ms',
49
+ :'utc' => :'utc',
50
+ :'iso_local' => :'iso_local',
51
+ :'rfc2822' => :'rfc2822',
52
+ :'human' => :'human',
53
+ :'day_number' => :'day_number',
54
+ :'day_short' => :'day_short',
55
+ :'day_full' => :'day_full',
56
+ :'timezone' => :'timezone',
57
+ :'formatted' => :'formatted',
58
+ :'offset' => :'offset',
59
+ :'dst' => :'dst'
60
+ }
61
+ end
62
+
63
+ # Returns all the JSON keys this model knows about
64
+ def self.acceptable_attributes
65
+ attribute_map.values
66
+ end
67
+
68
+ # Attribute type mapping.
69
+ def self.openapi_types
70
+ {
71
+ :'unix' => :'Integer',
72
+ :'unix_ms' => :'Integer',
73
+ :'utc' => :'Time',
74
+ :'iso_local' => :'String',
75
+ :'rfc2822' => :'String',
76
+ :'human' => :'String',
77
+ :'day_number' => :'Integer',
78
+ :'day_short' => :'String',
79
+ :'day_full' => :'String',
80
+ :'timezone' => :'String',
81
+ :'formatted' => :'String',
82
+ :'offset' => :'Integer',
83
+ :'dst' => :'Boolean'
84
+ }
85
+ end
86
+
87
+ # List of attributes with nullable: true
88
+ def self.openapi_nullable
89
+ Set.new([
90
+ :'iso_local',
91
+ ])
92
+ end
93
+
94
+ # List of class defined in allOf (OpenAPI v3)
95
+ def self.openapi_all_of
96
+ [
97
+ :'TimePayload'
98
+ ]
99
+ end
100
+
101
+ # Initializes the object
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ def initialize(attributes = {})
104
+ if (!attributes.is_a?(Hash))
105
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TimeLogic::Api::TimezoneMatch` initialize method"
106
+ end
107
+
108
+ # check to see if the attribute exists and convert string to symbol for hash key
109
+ attributes = attributes.each_with_object({}) { |(k, v), h|
110
+ if (!self.class.attribute_map.key?(k.to_sym))
111
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TimeLogic::Api::TimezoneMatch`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
112
+ end
113
+ h[k.to_sym] = v
114
+ }
115
+
116
+ if attributes.key?(:'unix')
117
+ self.unix = attributes[:'unix']
118
+ else
119
+ self.unix = nil
120
+ end
121
+
122
+ if attributes.key?(:'unix_ms')
123
+ self.unix_ms = attributes[:'unix_ms']
124
+ else
125
+ self.unix_ms = nil
126
+ end
127
+
128
+ if attributes.key?(:'utc')
129
+ self.utc = attributes[:'utc']
130
+ else
131
+ self.utc = nil
132
+ end
133
+
134
+ if attributes.key?(:'iso_local')
135
+ self.iso_local = attributes[:'iso_local']
136
+ else
137
+ self.iso_local = nil
138
+ end
139
+
140
+ if attributes.key?(:'rfc2822')
141
+ self.rfc2822 = attributes[:'rfc2822']
142
+ else
143
+ self.rfc2822 = nil
144
+ end
145
+
146
+ if attributes.key?(:'human')
147
+ self.human = attributes[:'human']
148
+ else
149
+ self.human = nil
150
+ end
151
+
152
+ if attributes.key?(:'day_number')
153
+ self.day_number = attributes[:'day_number']
154
+ else
155
+ self.day_number = nil
156
+ end
157
+
158
+ if attributes.key?(:'day_short')
159
+ self.day_short = attributes[:'day_short']
160
+ else
161
+ self.day_short = nil
162
+ end
163
+
164
+ if attributes.key?(:'day_full')
165
+ self.day_full = attributes[:'day_full']
166
+ else
167
+ self.day_full = nil
168
+ end
169
+
170
+ if attributes.key?(:'timezone')
171
+ self.timezone = attributes[:'timezone']
172
+ else
173
+ self.timezone = nil
174
+ end
175
+
176
+ if attributes.key?(:'formatted')
177
+ self.formatted = attributes[:'formatted']
178
+ end
179
+
180
+ if attributes.key?(:'offset')
181
+ self.offset = attributes[:'offset']
182
+ else
183
+ self.offset = nil
184
+ end
185
+
186
+ if attributes.key?(:'dst')
187
+ self.dst = attributes[:'dst']
188
+ else
189
+ self.dst = nil
190
+ end
191
+ end
192
+
193
+ # Show invalid properties with the reasons. Usually used together with valid?
194
+ # @return Array for valid properties with the reasons
195
+ def list_invalid_properties
196
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
197
+ invalid_properties = Array.new
198
+ if @unix.nil?
199
+ invalid_properties.push('invalid value for "unix", unix cannot be nil.')
200
+ end
201
+
202
+ if @unix_ms.nil?
203
+ invalid_properties.push('invalid value for "unix_ms", unix_ms cannot be nil.')
204
+ end
205
+
206
+ if @utc.nil?
207
+ invalid_properties.push('invalid value for "utc", utc cannot be nil.')
208
+ end
209
+
210
+ if @rfc2822.nil?
211
+ invalid_properties.push('invalid value for "rfc2822", rfc2822 cannot be nil.')
212
+ end
213
+
214
+ if @human.nil?
215
+ invalid_properties.push('invalid value for "human", human cannot be nil.')
216
+ end
217
+
218
+ if @day_number.nil?
219
+ invalid_properties.push('invalid value for "day_number", day_number cannot be nil.')
220
+ end
221
+
222
+ if @day_number > 7
223
+ invalid_properties.push('invalid value for "day_number", must be smaller than or equal to 7.')
224
+ end
225
+
226
+ if @day_number < 1
227
+ invalid_properties.push('invalid value for "day_number", must be greater than or equal to 1.')
228
+ end
229
+
230
+ if @day_short.nil?
231
+ invalid_properties.push('invalid value for "day_short", day_short cannot be nil.')
232
+ end
233
+
234
+ if @day_full.nil?
235
+ invalid_properties.push('invalid value for "day_full", day_full cannot be nil.')
236
+ end
237
+
238
+ if @timezone.nil?
239
+ invalid_properties.push('invalid value for "timezone", timezone cannot be nil.')
240
+ end
241
+
242
+ if @offset.nil?
243
+ invalid_properties.push('invalid value for "offset", offset cannot be nil.')
244
+ end
245
+
246
+ if @dst.nil?
247
+ invalid_properties.push('invalid value for "dst", dst cannot be nil.')
248
+ end
249
+
250
+ invalid_properties
251
+ end
252
+
253
+ # Check to see if the all the properties in the model are valid
254
+ # @return true if the model is valid
255
+ def valid?
256
+ warn '[DEPRECATED] the `valid?` method is obsolete'
257
+ return false if @unix.nil?
258
+ return false if @unix_ms.nil?
259
+ return false if @utc.nil?
260
+ return false if @rfc2822.nil?
261
+ return false if @human.nil?
262
+ return false if @day_number.nil?
263
+ return false if @day_number > 7
264
+ return false if @day_number < 1
265
+ return false if @day_short.nil?
266
+ return false if @day_full.nil?
267
+ return false if @timezone.nil?
268
+ return false if @offset.nil?
269
+ return false if @dst.nil?
270
+ true
271
+ end
272
+
273
+ # Custom attribute writer method with validation
274
+ # @param [Object] day_number Value to be assigned
275
+ def day_number=(day_number)
276
+ if day_number.nil?
277
+ fail ArgumentError, 'day_number cannot be nil'
278
+ end
279
+
280
+ if day_number > 7
281
+ fail ArgumentError, 'invalid value for "day_number", must be smaller than or equal to 7.'
282
+ end
283
+
284
+ if day_number < 1
285
+ fail ArgumentError, 'invalid value for "day_number", must be greater than or equal to 1.'
286
+ end
287
+
288
+ @day_number = day_number
289
+ end
290
+
291
+ # Checks equality by comparing each attribute.
292
+ # @param [Object] Object to be compared
293
+ def ==(o)
294
+ return true if self.equal?(o)
295
+ self.class == o.class &&
296
+ unix == o.unix &&
297
+ unix_ms == o.unix_ms &&
298
+ utc == o.utc &&
299
+ iso_local == o.iso_local &&
300
+ rfc2822 == o.rfc2822 &&
301
+ human == o.human &&
302
+ day_number == o.day_number &&
303
+ day_short == o.day_short &&
304
+ day_full == o.day_full &&
305
+ timezone == o.timezone &&
306
+ formatted == o.formatted &&
307
+ offset == o.offset &&
308
+ dst == o.dst
309
+ end
310
+
311
+ # @see the `==` method
312
+ # @param [Object] Object to be compared
313
+ def eql?(o)
314
+ self == o
315
+ end
316
+
317
+ # Calculates hash code according to all attributes.
318
+ # @return [Integer] Hash code
319
+ def hash
320
+ [unix, unix_ms, utc, iso_local, rfc2822, human, day_number, day_short, day_full, timezone, formatted, offset, dst].hash
321
+ end
322
+
323
+ # Builds the object from hash
324
+ # @param [Hash] attributes Model attributes in the form of hash
325
+ # @return [Object] Returns the model itself
326
+ def self.build_from_hash(attributes)
327
+ return nil unless attributes.is_a?(Hash)
328
+ attributes = attributes.transform_keys(&:to_sym)
329
+ transformed_hash = {}
330
+ openapi_types.each_pair do |key, type|
331
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
332
+ transformed_hash["#{key}"] = nil
333
+ elsif type =~ /\AArray<(.*)>/i
334
+ # check to ensure the input is an array given that the attribute
335
+ # is documented as an array but the input is not
336
+ if attributes[attribute_map[key]].is_a?(Array)
337
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
338
+ end
339
+ elsif !attributes[attribute_map[key]].nil?
340
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
341
+ end
342
+ end
343
+ new(transformed_hash)
344
+ end
345
+
346
+ # Deserializes the data based on type
347
+ # @param string type Data type
348
+ # @param string value Value to be deserialized
349
+ # @return [Object] Deserialized data
350
+ def self._deserialize(type, value)
351
+ case type.to_sym
352
+ when :Time
353
+ Time.parse(value)
354
+ when :Date
355
+ Date.parse(value)
356
+ when :String
357
+ value.to_s
358
+ when :Integer
359
+ value.to_i
360
+ when :Float
361
+ value.to_f
362
+ when :Boolean
363
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
364
+ true
365
+ else
366
+ false
367
+ end
368
+ when :Object
369
+ # generic object (usually a Hash), return directly
370
+ value
371
+ when /\AArray<(?<inner_type>.+)>\z/
372
+ inner_type = Regexp.last_match[:inner_type]
373
+ value.map { |v| _deserialize(inner_type, v) }
374
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
375
+ k_type = Regexp.last_match[:k_type]
376
+ v_type = Regexp.last_match[:v_type]
377
+ {}.tap do |hash|
378
+ value.each do |k, v|
379
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
380
+ end
381
+ end
382
+ else # model
383
+ # models (e.g. Pet) or oneOf
384
+ klass = TimeLogic::Api.const_get(type)
385
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
386
+ end
387
+ end
388
+
389
+ # Returns the string representation of the object
390
+ # @return [String] String presentation of the object
391
+ def to_s
392
+ to_hash.to_s
393
+ end
394
+
395
+ # to_body is an alias to to_hash (backward compatibility)
396
+ # @return [Hash] Returns the object in the form of hash
397
+ def to_body
398
+ to_hash
399
+ end
400
+
401
+ # Returns the object in the form of hash
402
+ # @return [Hash] Returns the object in the form of hash
403
+ def to_hash
404
+ hash = {}
405
+ self.class.attribute_map.each_pair do |attr, param|
406
+ value = self.send(attr)
407
+ if value.nil?
408
+ is_nullable = self.class.openapi_nullable.include?(attr)
409
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
410
+ end
411
+
412
+ hash[param] = _to_hash(value)
413
+ end
414
+ hash
415
+ end
416
+
417
+ # Outputs non-array value in the form of hash
418
+ # For object, use to_hash. Otherwise, just return the value
419
+ # @param [Object] value Any valid value
420
+ # @return [Hash] Returns the value in the form of hash
421
+ def _to_hash(value)
422
+ if value.is_a?(Array)
423
+ value.compact.map { |v| _to_hash(v) }
424
+ elsif value.is_a?(Hash)
425
+ {}.tap do |hash|
426
+ value.each { |k, v| hash[k] = _to_hash(v) }
427
+ end
428
+ elsif value.respond_to? :to_hash
429
+ value.to_hash
430
+ else
431
+ value
432
+ end
433
+ end
434
+
435
+ end
436
+
437
+ end