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