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,427 @@
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 DstResponse
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 :dst_active
41
+
42
+ attr_accessor :next_transition
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
+ :'dst_active' => :'dst_active',
59
+ :'next_transition' => :'next_transition'
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
+ :'dst_active' => :'Boolean',
83
+ :'next_transition' => :'Time'
84
+ }
85
+ end
86
+
87
+ # List of attributes with nullable: true
88
+ def self.openapi_nullable
89
+ Set.new([
90
+ :'iso_local',
91
+ :'timezone',
92
+ :'next_transition'
93
+ ])
94
+ end
95
+
96
+ # List of class defined in allOf (OpenAPI v3)
97
+ def self.openapi_all_of
98
+ [
99
+ :'TimePayload'
100
+ ]
101
+ end
102
+
103
+ # Initializes the object
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ def initialize(attributes = {})
106
+ if (!attributes.is_a?(Hash))
107
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TimeLogic::Api::DstResponse` initialize method"
108
+ end
109
+
110
+ # check to see if the attribute exists and convert string to symbol for hash key
111
+ attributes = attributes.each_with_object({}) { |(k, v), h|
112
+ if (!self.class.attribute_map.key?(k.to_sym))
113
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TimeLogic::Api::DstResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
114
+ end
115
+ h[k.to_sym] = v
116
+ }
117
+
118
+ if attributes.key?(:'unix')
119
+ self.unix = attributes[:'unix']
120
+ else
121
+ self.unix = nil
122
+ end
123
+
124
+ if attributes.key?(:'unix_ms')
125
+ self.unix_ms = attributes[:'unix_ms']
126
+ else
127
+ self.unix_ms = nil
128
+ end
129
+
130
+ if attributes.key?(:'utc')
131
+ self.utc = attributes[:'utc']
132
+ else
133
+ self.utc = nil
134
+ end
135
+
136
+ if attributes.key?(:'iso_local')
137
+ self.iso_local = attributes[:'iso_local']
138
+ else
139
+ self.iso_local = nil
140
+ end
141
+
142
+ if attributes.key?(:'rfc2822')
143
+ self.rfc2822 = attributes[:'rfc2822']
144
+ else
145
+ self.rfc2822 = nil
146
+ end
147
+
148
+ if attributes.key?(:'human')
149
+ self.human = attributes[:'human']
150
+ else
151
+ self.human = nil
152
+ end
153
+
154
+ if attributes.key?(:'day_number')
155
+ self.day_number = attributes[:'day_number']
156
+ else
157
+ self.day_number = nil
158
+ end
159
+
160
+ if attributes.key?(:'day_short')
161
+ self.day_short = attributes[:'day_short']
162
+ else
163
+ self.day_short = nil
164
+ end
165
+
166
+ if attributes.key?(:'day_full')
167
+ self.day_full = attributes[:'day_full']
168
+ else
169
+ self.day_full = nil
170
+ end
171
+
172
+ if attributes.key?(:'timezone')
173
+ self.timezone = attributes[:'timezone']
174
+ else
175
+ self.timezone = nil
176
+ end
177
+
178
+ if attributes.key?(:'formatted')
179
+ self.formatted = attributes[:'formatted']
180
+ end
181
+
182
+ if attributes.key?(:'dst_active')
183
+ self.dst_active = attributes[:'dst_active']
184
+ else
185
+ self.dst_active = nil
186
+ end
187
+
188
+ if attributes.key?(:'next_transition')
189
+ self.next_transition = attributes[:'next_transition']
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 @dst_active.nil?
239
+ invalid_properties.push('invalid value for "dst_active", dst_active cannot be nil.')
240
+ end
241
+
242
+ invalid_properties
243
+ end
244
+
245
+ # Check to see if the all the properties in the model are valid
246
+ # @return true if the model is valid
247
+ def valid?
248
+ warn '[DEPRECATED] the `valid?` method is obsolete'
249
+ return false if @unix.nil?
250
+ return false if @unix_ms.nil?
251
+ return false if @utc.nil?
252
+ return false if @rfc2822.nil?
253
+ return false if @human.nil?
254
+ return false if @day_number.nil?
255
+ return false if @day_number > 7
256
+ return false if @day_number < 1
257
+ return false if @day_short.nil?
258
+ return false if @day_full.nil?
259
+ return false if @dst_active.nil?
260
+ true
261
+ end
262
+
263
+ # Custom attribute writer method with validation
264
+ # @param [Object] day_number Value to be assigned
265
+ def day_number=(day_number)
266
+ if day_number.nil?
267
+ fail ArgumentError, 'day_number cannot be nil'
268
+ end
269
+
270
+ if day_number > 7
271
+ fail ArgumentError, 'invalid value for "day_number", must be smaller than or equal to 7.'
272
+ end
273
+
274
+ if day_number < 1
275
+ fail ArgumentError, 'invalid value for "day_number", must be greater than or equal to 1.'
276
+ end
277
+
278
+ @day_number = day_number
279
+ end
280
+
281
+ # Checks equality by comparing each attribute.
282
+ # @param [Object] Object to be compared
283
+ def ==(o)
284
+ return true if self.equal?(o)
285
+ self.class == o.class &&
286
+ unix == o.unix &&
287
+ unix_ms == o.unix_ms &&
288
+ utc == o.utc &&
289
+ iso_local == o.iso_local &&
290
+ rfc2822 == o.rfc2822 &&
291
+ human == o.human &&
292
+ day_number == o.day_number &&
293
+ day_short == o.day_short &&
294
+ day_full == o.day_full &&
295
+ timezone == o.timezone &&
296
+ formatted == o.formatted &&
297
+ dst_active == o.dst_active &&
298
+ next_transition == o.next_transition
299
+ end
300
+
301
+ # @see the `==` method
302
+ # @param [Object] Object to be compared
303
+ def eql?(o)
304
+ self == o
305
+ end
306
+
307
+ # Calculates hash code according to all attributes.
308
+ # @return [Integer] Hash code
309
+ def hash
310
+ [unix, unix_ms, utc, iso_local, rfc2822, human, day_number, day_short, day_full, timezone, formatted, dst_active, next_transition].hash
311
+ end
312
+
313
+ # Builds the object from hash
314
+ # @param [Hash] attributes Model attributes in the form of hash
315
+ # @return [Object] Returns the model itself
316
+ def self.build_from_hash(attributes)
317
+ return nil unless attributes.is_a?(Hash)
318
+ attributes = attributes.transform_keys(&:to_sym)
319
+ transformed_hash = {}
320
+ openapi_types.each_pair do |key, type|
321
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
322
+ transformed_hash["#{key}"] = nil
323
+ elsif type =~ /\AArray<(.*)>/i
324
+ # check to ensure the input is an array given that the attribute
325
+ # is documented as an array but the input is not
326
+ if attributes[attribute_map[key]].is_a?(Array)
327
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
328
+ end
329
+ elsif !attributes[attribute_map[key]].nil?
330
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
331
+ end
332
+ end
333
+ new(transformed_hash)
334
+ end
335
+
336
+ # Deserializes the data based on type
337
+ # @param string type Data type
338
+ # @param string value Value to be deserialized
339
+ # @return [Object] Deserialized data
340
+ def self._deserialize(type, value)
341
+ case type.to_sym
342
+ when :Time
343
+ Time.parse(value)
344
+ when :Date
345
+ Date.parse(value)
346
+ when :String
347
+ value.to_s
348
+ when :Integer
349
+ value.to_i
350
+ when :Float
351
+ value.to_f
352
+ when :Boolean
353
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
354
+ true
355
+ else
356
+ false
357
+ end
358
+ when :Object
359
+ # generic object (usually a Hash), return directly
360
+ value
361
+ when /\AArray<(?<inner_type>.+)>\z/
362
+ inner_type = Regexp.last_match[:inner_type]
363
+ value.map { |v| _deserialize(inner_type, v) }
364
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
365
+ k_type = Regexp.last_match[:k_type]
366
+ v_type = Regexp.last_match[:v_type]
367
+ {}.tap do |hash|
368
+ value.each do |k, v|
369
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
370
+ end
371
+ end
372
+ else # model
373
+ # models (e.g. Pet) or oneOf
374
+ klass = TimeLogic::Api.const_get(type)
375
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
376
+ end
377
+ end
378
+
379
+ # Returns the string representation of the object
380
+ # @return [String] String presentation of the object
381
+ def to_s
382
+ to_hash.to_s
383
+ end
384
+
385
+ # to_body is an alias to to_hash (backward compatibility)
386
+ # @return [Hash] Returns the object in the form of hash
387
+ def to_body
388
+ to_hash
389
+ end
390
+
391
+ # Returns the object in the form of hash
392
+ # @return [Hash] Returns the object in the form of hash
393
+ def to_hash
394
+ hash = {}
395
+ self.class.attribute_map.each_pair do |attr, param|
396
+ value = self.send(attr)
397
+ if value.nil?
398
+ is_nullable = self.class.openapi_nullable.include?(attr)
399
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
400
+ end
401
+
402
+ hash[param] = _to_hash(value)
403
+ end
404
+ hash
405
+ end
406
+
407
+ # Outputs non-array value in the form of hash
408
+ # For object, use to_hash. Otherwise, just return the value
409
+ # @param [Object] value Any valid value
410
+ # @return [Hash] Returns the value in the form of hash
411
+ def _to_hash(value)
412
+ if value.is_a?(Array)
413
+ value.compact.map { |v| _to_hash(v) }
414
+ elsif value.is_a?(Hash)
415
+ {}.tap do |hash|
416
+ value.each { |k, v| hash[k] = _to_hash(v) }
417
+ end
418
+ elsif value.respond_to? :to_hash
419
+ value.to_hash
420
+ else
421
+ value
422
+ end
423
+ end
424
+
425
+ end
426
+
427
+ end