ultracart_api 4.1.202 → 4.1.204

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 (35) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +32 -2
  3. data/docs/SfvbApi.md +897 -39
  4. data/docs/SfvbApprovalParams.md +4 -0
  5. data/docs/SfvbCommsDnsRecord.md +24 -0
  6. data/docs/SfvbCommsSendingDomain.md +38 -0
  7. data/docs/SfvbCommsSendingDomainsResponse.md +18 -0
  8. data/docs/SfvbCommsTwilioAccount.md +38 -0
  9. data/docs/SfvbCommsTwilioAccountResponse.md +20 -0
  10. data/docs/SfvbEvent.md +2 -2
  11. data/docs/SfvbSecretHandle.md +32 -0
  12. data/docs/SfvbSecretKind.md +30 -0
  13. data/docs/SfvbSecretKindsResponse.md +20 -0
  14. data/docs/SfvbSecretRequest.md +54 -0
  15. data/docs/SfvbSecretRequestCreate.md +30 -0
  16. data/docs/SfvbSecretRequestsResponse.md +18 -0
  17. data/docs/SfvbSecretSink.md +24 -0
  18. data/lib/ultracart_api/api/sfvb_api.rb +1059 -28
  19. data/lib/ultracart_api/models/sfvb_approval_params.rb +21 -1
  20. data/lib/ultracart_api/models/sfvb_comms_dns_record.rb +296 -0
  21. data/lib/ultracart_api/models/sfvb_comms_sending_domain.rb +356 -0
  22. data/lib/ultracart_api/models/sfvb_comms_sending_domains_response.rb +222 -0
  23. data/lib/ultracart_api/models/sfvb_comms_twilio_account.rb +322 -0
  24. data/lib/ultracart_api/models/sfvb_comms_twilio_account_response.rb +231 -0
  25. data/lib/ultracart_api/models/sfvb_event.rb +2 -2
  26. data/lib/ultracart_api/models/sfvb_secret_handle.rb +324 -0
  27. data/lib/ultracart_api/models/sfvb_secret_kind.rb +280 -0
  28. data/lib/ultracart_api/models/sfvb_secret_kinds_response.rb +234 -0
  29. data/lib/ultracart_api/models/sfvb_secret_request.rb +440 -0
  30. data/lib/ultracart_api/models/sfvb_secret_request_create.rb +284 -0
  31. data/lib/ultracart_api/models/sfvb_secret_requests_response.rb +222 -0
  32. data/lib/ultracart_api/models/sfvb_secret_sink.rb +250 -0
  33. data/lib/ultracart_api/version.rb +1 -1
  34. data/lib/ultracart_api.rb +12 -0
  35. metadata +26 -2
@@ -0,0 +1,234 @@
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 SfvbSecretKindsResponse
18
+ # Every kind of secret this server collects.
19
+ attr_accessor :kinds
20
+
21
+ # Every secret field a handle can be written to.
22
+ attr_accessor :sinks
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'kinds' => :'kinds',
28
+ :'sinks' => :'sinks'
29
+ }
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'kinds' => :'Array<SfvbSecretKind>',
41
+ :'sinks' => :'Array<SfvbSecretSink>'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbSecretKindsResponse` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbSecretKindsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'kinds')
67
+ if (value = attributes[:'kinds']).is_a?(Array)
68
+ self.kinds = value
69
+ end
70
+ end
71
+
72
+ if attributes.key?(:'sinks')
73
+ if (value = attributes[:'sinks']).is_a?(Array)
74
+ self.sinks = value
75
+ end
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ invalid_properties = Array.new
83
+ invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ true
90
+ end
91
+
92
+ # Checks equality by comparing each attribute.
93
+ # @param [Object] Object to be compared
94
+ def ==(o)
95
+ return true if self.equal?(o)
96
+ self.class == o.class &&
97
+ kinds == o.kinds &&
98
+ sinks == o.sinks
99
+ end
100
+
101
+ # @see the `==` method
102
+ # @param [Object] Object to be compared
103
+ def eql?(o)
104
+ self == o
105
+ end
106
+
107
+ # Calculates hash code according to all attributes.
108
+ # @return [Integer] Hash code
109
+ def hash
110
+ [kinds, sinks].hash
111
+ end
112
+
113
+ # Builds the object from hash
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ # @return [Object] Returns the model itself
116
+ def self.build_from_hash(attributes)
117
+ new.build_from_hash(attributes)
118
+ end
119
+
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def build_from_hash(attributes)
124
+ return nil unless attributes.is_a?(Hash)
125
+ attributes = attributes.transform_keys(&:to_sym)
126
+ self.class.openapi_types.each_pair do |key, type|
127
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
128
+ self.send("#{key}=", nil)
129
+ elsif type =~ /\AArray<(.*)>/i
130
+ # check to ensure the input is an array given that the attribute
131
+ # is documented as an array but the input is not
132
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
133
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
134
+ end
135
+ elsif !attributes[self.class.attribute_map[key]].nil?
136
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
137
+ end
138
+ end
139
+
140
+ self
141
+ end
142
+
143
+ # Deserializes the data based on type
144
+ # @param string type Data type
145
+ # @param string value Value to be deserialized
146
+ # @return [Object] Deserialized data
147
+ def _deserialize(type, value)
148
+ case type.to_sym
149
+ when :Time
150
+ Time.parse(value)
151
+ when :Date
152
+ Date.parse(value)
153
+ when :String
154
+ value.to_s
155
+ when :Integer
156
+ value.to_i
157
+ when :Float
158
+ value.to_f
159
+ when :Boolean
160
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
161
+ true
162
+ else
163
+ false
164
+ end
165
+ when :Object
166
+ # generic object (usually a Hash), return directly
167
+ value
168
+ when /\AArray<(?<inner_type>.+)>\z/
169
+ inner_type = Regexp.last_match[:inner_type]
170
+ value.map { |v| _deserialize(inner_type, v) }
171
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
172
+ k_type = Regexp.last_match[:k_type]
173
+ v_type = Regexp.last_match[:v_type]
174
+ {}.tap do |hash|
175
+ value.each do |k, v|
176
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
177
+ end
178
+ end
179
+ else # model
180
+ # models (e.g. Pet) or oneOf
181
+ klass = UltracartClient.const_get(type)
182
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
183
+ end
184
+ end
185
+
186
+ # Returns the string representation of the object
187
+ # @return [String] String presentation of the object
188
+ def to_s
189
+ to_hash.to_s
190
+ end
191
+
192
+ # to_body is an alias to to_hash (backward compatibility)
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_body
195
+ to_hash
196
+ end
197
+
198
+ # Returns the object in the form of hash
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_hash
201
+ hash = {}
202
+ self.class.attribute_map.each_pair do |attr, param|
203
+ value = self.send(attr)
204
+ if value.nil?
205
+ is_nullable = self.class.openapi_nullable.include?(attr)
206
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
207
+ end
208
+
209
+ hash[param] = _to_hash(value)
210
+ end
211
+ hash
212
+ end
213
+
214
+ # Outputs non-array value in the form of hash
215
+ # For object, use to_hash. Otherwise, just return the value
216
+ # @param [Object] value Any valid value
217
+ # @return [Hash] Returns the value in the form of hash
218
+ def _to_hash(value)
219
+ if value.is_a?(Array)
220
+ value.compact.map { |v| _to_hash(v) }
221
+ elsif value.is_a?(Hash)
222
+ {}.tap do |hash|
223
+ value.each { |k, v| hash[k] = _to_hash(v) }
224
+ end
225
+ elsif value.respond_to? :to_hash
226
+ value.to_hash
227
+ else
228
+ value
229
+ end
230
+ end
231
+
232
+ end
233
+
234
+ end
@@ -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