ultracart_api 4.1.201 → 4.1.203

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.
@@ -0,0 +1,440 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module UltracartClient
17
+ class SfvbSecretRequest
18
+ # When the request was made, ISO 8601 UTC.
19
+ attr_accessor :created_at
20
+
21
+ # True when the requester handed it to a colleague to fill in.
22
+ attr_accessor :delegated
23
+
24
+ # The sentence the person reads. Written by the server, not the agent.
25
+ attr_accessor :description
26
+
27
+ # When a pending request lapses, ISO 8601 UTC.
28
+ attr_accessor :expires_at
29
+
30
+ # Seconds until expires_at. Zero once passed.
31
+ attr_accessor :expires_in_seconds
32
+
33
+ # When the values were entered, ISO 8601 UTC.
34
+ attr_accessor :fulfilled_at
35
+
36
+ # How many handles the request made.
37
+ attr_accessor :handle_count
38
+
39
+ # Every handle with its status. Left out of the list endpoint; read one request for them.
40
+ attr_accessor :handles
41
+
42
+ # Poll no more often than this.
43
+ attr_accessor :interval_seconds
44
+
45
+ # The bulk keys, or empty.
46
+ attr_accessor :keys
47
+
48
+ # The label the agent sent, as stored and shown.
49
+ attr_accessor :label
50
+
51
+ # The reason the agent sent, as stored and shown.
52
+ attr_accessor :reason
53
+
54
+ # The request id.
55
+ attr_accessor :request_id
56
+
57
+ # The page where the person enters the values. Show it to them. Never open or fill it in yourself.
58
+ attr_accessor :request_url
59
+
60
+ # True when the person must enter a code from their authenticator app.
61
+ attr_accessor :requires_totp
62
+
63
+ # The secret fields being collected.
64
+ attr_accessor :sinks
65
+
66
+ # pending, fulfilled, cancelled or expired.
67
+ attr_accessor :status
68
+
69
+ # The object the values are for, or empty for a bulk request or an open one.
70
+ attr_accessor :target_id
71
+
72
+ # Short matching code. Print it next to request_url so the person can check the page shows the same code.
73
+ attr_accessor :user_code
74
+
75
+ class EnumAttributeValidator
76
+ attr_reader :datatype
77
+ attr_reader :allowable_values
78
+
79
+ def initialize(datatype, allowable_values)
80
+ @allowable_values = allowable_values.map do |value|
81
+ case datatype.to_s
82
+ when /Integer/i
83
+ value.to_i
84
+ when /Float/i
85
+ value.to_f
86
+ else
87
+ value
88
+ end
89
+ end
90
+ end
91
+
92
+ def valid?(value)
93
+ !value || allowable_values.include?(value)
94
+ end
95
+ end
96
+
97
+ # Attribute mapping from ruby-style variable name to JSON key.
98
+ def self.attribute_map
99
+ {
100
+ :'created_at' => :'created_at',
101
+ :'delegated' => :'delegated',
102
+ :'description' => :'description',
103
+ :'expires_at' => :'expires_at',
104
+ :'expires_in_seconds' => :'expires_in_seconds',
105
+ :'fulfilled_at' => :'fulfilled_at',
106
+ :'handle_count' => :'handle_count',
107
+ :'handles' => :'handles',
108
+ :'interval_seconds' => :'interval_seconds',
109
+ :'keys' => :'keys',
110
+ :'label' => :'label',
111
+ :'reason' => :'reason',
112
+ :'request_id' => :'request_id',
113
+ :'request_url' => :'request_url',
114
+ :'requires_totp' => :'requires_totp',
115
+ :'sinks' => :'sinks',
116
+ :'status' => :'status',
117
+ :'target_id' => :'target_id',
118
+ :'user_code' => :'user_code'
119
+ }
120
+ end
121
+
122
+ # Returns all the JSON keys this model knows about
123
+ def self.acceptable_attributes
124
+ attribute_map.values
125
+ end
126
+
127
+ # Attribute type mapping.
128
+ def self.openapi_types
129
+ {
130
+ :'created_at' => :'String',
131
+ :'delegated' => :'Boolean',
132
+ :'description' => :'String',
133
+ :'expires_at' => :'String',
134
+ :'expires_in_seconds' => :'Integer',
135
+ :'fulfilled_at' => :'String',
136
+ :'handle_count' => :'Integer',
137
+ :'handles' => :'Array<SfvbSecretHandle>',
138
+ :'interval_seconds' => :'Integer',
139
+ :'keys' => :'Array<String>',
140
+ :'label' => :'String',
141
+ :'reason' => :'String',
142
+ :'request_id' => :'String',
143
+ :'request_url' => :'String',
144
+ :'requires_totp' => :'Boolean',
145
+ :'sinks' => :'Array<String>',
146
+ :'status' => :'String',
147
+ :'target_id' => :'String',
148
+ :'user_code' => :'String'
149
+ }
150
+ end
151
+
152
+ # List of attributes with nullable: true
153
+ def self.openapi_nullable
154
+ Set.new([
155
+ ])
156
+ end
157
+
158
+ # Initializes the object
159
+ # @param [Hash] attributes Model attributes in the form of hash
160
+ def initialize(attributes = {})
161
+ if (!attributes.is_a?(Hash))
162
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbSecretRequest` initialize method"
163
+ end
164
+
165
+ # check to see if the attribute exists and convert string to symbol for hash key
166
+ attributes = attributes.each_with_object({}) { |(k, v), h|
167
+ if (!self.class.attribute_map.key?(k.to_sym))
168
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbSecretRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
169
+ end
170
+ h[k.to_sym] = v
171
+ }
172
+
173
+ if attributes.key?(:'created_at')
174
+ self.created_at = attributes[:'created_at']
175
+ end
176
+
177
+ if attributes.key?(:'delegated')
178
+ self.delegated = attributes[:'delegated']
179
+ end
180
+
181
+ if attributes.key?(:'description')
182
+ self.description = attributes[:'description']
183
+ end
184
+
185
+ if attributes.key?(:'expires_at')
186
+ self.expires_at = attributes[:'expires_at']
187
+ end
188
+
189
+ if attributes.key?(:'expires_in_seconds')
190
+ self.expires_in_seconds = attributes[:'expires_in_seconds']
191
+ end
192
+
193
+ if attributes.key?(:'fulfilled_at')
194
+ self.fulfilled_at = attributes[:'fulfilled_at']
195
+ end
196
+
197
+ if attributes.key?(:'handle_count')
198
+ self.handle_count = attributes[:'handle_count']
199
+ end
200
+
201
+ if attributes.key?(:'handles')
202
+ if (value = attributes[:'handles']).is_a?(Array)
203
+ self.handles = value
204
+ end
205
+ end
206
+
207
+ if attributes.key?(:'interval_seconds')
208
+ self.interval_seconds = attributes[:'interval_seconds']
209
+ end
210
+
211
+ if attributes.key?(:'keys')
212
+ if (value = attributes[:'keys']).is_a?(Array)
213
+ self.keys = value
214
+ end
215
+ end
216
+
217
+ if attributes.key?(:'label')
218
+ self.label = attributes[:'label']
219
+ end
220
+
221
+ if attributes.key?(:'reason')
222
+ self.reason = attributes[:'reason']
223
+ end
224
+
225
+ if attributes.key?(:'request_id')
226
+ self.request_id = attributes[:'request_id']
227
+ end
228
+
229
+ if attributes.key?(:'request_url')
230
+ self.request_url = attributes[:'request_url']
231
+ end
232
+
233
+ if attributes.key?(:'requires_totp')
234
+ self.requires_totp = attributes[:'requires_totp']
235
+ end
236
+
237
+ if attributes.key?(:'sinks')
238
+ if (value = attributes[:'sinks']).is_a?(Array)
239
+ self.sinks = value
240
+ end
241
+ end
242
+
243
+ if attributes.key?(:'status')
244
+ self.status = attributes[:'status']
245
+ end
246
+
247
+ if attributes.key?(:'target_id')
248
+ self.target_id = attributes[:'target_id']
249
+ end
250
+
251
+ if attributes.key?(:'user_code')
252
+ self.user_code = attributes[:'user_code']
253
+ end
254
+ end
255
+
256
+ # Show invalid properties with the reasons. Usually used together with valid?
257
+ # @return Array for valid properties with the reasons
258
+ def list_invalid_properties
259
+ invalid_properties = Array.new
260
+ invalid_properties
261
+ end
262
+
263
+ # Check to see if the all the properties in the model are valid
264
+ # @return true if the model is valid
265
+ def valid?
266
+ status_validator = EnumAttributeValidator.new('String', ["pending", "fulfilled", "cancelled", "expired"])
267
+ return false unless status_validator.valid?(@status)
268
+ true
269
+ end
270
+
271
+ # Custom attribute writer method checking allowed values (enum).
272
+ # @param [Object] status Object to be assigned
273
+ def status=(status)
274
+ validator = EnumAttributeValidator.new('String', ["pending", "fulfilled", "cancelled", "expired"])
275
+ unless validator.valid?(status)
276
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
277
+ end
278
+ @status = status
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
+ created_at == o.created_at &&
287
+ delegated == o.delegated &&
288
+ description == o.description &&
289
+ expires_at == o.expires_at &&
290
+ expires_in_seconds == o.expires_in_seconds &&
291
+ fulfilled_at == o.fulfilled_at &&
292
+ handle_count == o.handle_count &&
293
+ handles == o.handles &&
294
+ interval_seconds == o.interval_seconds &&
295
+ keys == o.keys &&
296
+ label == o.label &&
297
+ reason == o.reason &&
298
+ request_id == o.request_id &&
299
+ request_url == o.request_url &&
300
+ requires_totp == o.requires_totp &&
301
+ sinks == o.sinks &&
302
+ status == o.status &&
303
+ target_id == o.target_id &&
304
+ user_code == o.user_code
305
+ end
306
+
307
+ # @see the `==` method
308
+ # @param [Object] Object to be compared
309
+ def eql?(o)
310
+ self == o
311
+ end
312
+
313
+ # Calculates hash code according to all attributes.
314
+ # @return [Integer] Hash code
315
+ def hash
316
+ [created_at, delegated, description, expires_at, expires_in_seconds, fulfilled_at, handle_count, handles, interval_seconds, keys, label, reason, request_id, request_url, requires_totp, sinks, status, target_id, user_code].hash
317
+ end
318
+
319
+ # Builds the object from hash
320
+ # @param [Hash] attributes Model attributes in the form of hash
321
+ # @return [Object] Returns the model itself
322
+ def self.build_from_hash(attributes)
323
+ new.build_from_hash(attributes)
324
+ end
325
+
326
+ # Builds the object from hash
327
+ # @param [Hash] attributes Model attributes in the form of hash
328
+ # @return [Object] Returns the model itself
329
+ def build_from_hash(attributes)
330
+ return nil unless attributes.is_a?(Hash)
331
+ attributes = attributes.transform_keys(&:to_sym)
332
+ self.class.openapi_types.each_pair do |key, type|
333
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
334
+ self.send("#{key}=", nil)
335
+ elsif type =~ /\AArray<(.*)>/i
336
+ # check to ensure the input is an array given that the attribute
337
+ # is documented as an array but the input is not
338
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
339
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
340
+ end
341
+ elsif !attributes[self.class.attribute_map[key]].nil?
342
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
343
+ end
344
+ end
345
+
346
+ self
347
+ end
348
+
349
+ # Deserializes the data based on type
350
+ # @param string type Data type
351
+ # @param string value Value to be deserialized
352
+ # @return [Object] Deserialized data
353
+ def _deserialize(type, value)
354
+ case type.to_sym
355
+ when :Time
356
+ Time.parse(value)
357
+ when :Date
358
+ Date.parse(value)
359
+ when :String
360
+ value.to_s
361
+ when :Integer
362
+ value.to_i
363
+ when :Float
364
+ value.to_f
365
+ when :Boolean
366
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
367
+ true
368
+ else
369
+ false
370
+ end
371
+ when :Object
372
+ # generic object (usually a Hash), return directly
373
+ value
374
+ when /\AArray<(?<inner_type>.+)>\z/
375
+ inner_type = Regexp.last_match[:inner_type]
376
+ value.map { |v| _deserialize(inner_type, v) }
377
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
378
+ k_type = Regexp.last_match[:k_type]
379
+ v_type = Regexp.last_match[:v_type]
380
+ {}.tap do |hash|
381
+ value.each do |k, v|
382
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
383
+ end
384
+ end
385
+ else # model
386
+ # models (e.g. Pet) or oneOf
387
+ klass = UltracartClient.const_get(type)
388
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
389
+ end
390
+ end
391
+
392
+ # Returns the string representation of the object
393
+ # @return [String] String presentation of the object
394
+ def to_s
395
+ to_hash.to_s
396
+ end
397
+
398
+ # to_body is an alias to to_hash (backward compatibility)
399
+ # @return [Hash] Returns the object in the form of hash
400
+ def to_body
401
+ to_hash
402
+ end
403
+
404
+ # Returns the object in the form of hash
405
+ # @return [Hash] Returns the object in the form of hash
406
+ def to_hash
407
+ hash = {}
408
+ self.class.attribute_map.each_pair do |attr, param|
409
+ value = self.send(attr)
410
+ if value.nil?
411
+ is_nullable = self.class.openapi_nullable.include?(attr)
412
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
413
+ end
414
+
415
+ hash[param] = _to_hash(value)
416
+ end
417
+ hash
418
+ end
419
+
420
+ # Outputs non-array value in the form of hash
421
+ # For object, use to_hash. Otherwise, just return the value
422
+ # @param [Object] value Any valid value
423
+ # @return [Hash] Returns the value in the form of hash
424
+ def _to_hash(value)
425
+ if value.is_a?(Array)
426
+ value.compact.map { |v| _to_hash(v) }
427
+ elsif value.is_a?(Hash)
428
+ {}.tap do |hash|
429
+ value.each { |k, v| hash[k] = _to_hash(v) }
430
+ end
431
+ elsif value.respond_to? :to_hash
432
+ value.to_hash
433
+ else
434
+ value
435
+ end
436
+ end
437
+
438
+ end
439
+
440
+ end