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