dropbox-sign 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +12 -4
- data/VERSION +1 -1
- data/docs/BulkSendJobGetResponseSignatureRequests.md +1 -0
- data/docs/EventCallbackRequestEvent.md +1 -1
- data/docs/SignatureRequestApi.md +415 -0
- data/docs/SignatureRequestBulkCreateEmbeddedWithTemplateRequest.md +1 -1
- data/docs/SignatureRequestBulkSendWithTemplateRequest.md +1 -1
- data/docs/SignatureRequestEditEmbeddedRequest.md +33 -0
- data/docs/SignatureRequestEditEmbeddedWithTemplateRequest.md +24 -0
- data/docs/SignatureRequestEditRequest.md +35 -0
- data/docs/SignatureRequestEditWithTemplateRequest.md +26 -0
- data/docs/SignatureRequestResponse.md +2 -0
- data/docs/SubFormFieldsPerDocumentDateSigned.md +1 -1
- data/docs/SubFormFieldsPerDocumentDropdown.md +1 -1
- data/docs/SubFormFieldsPerDocumentHyperlink.md +1 -1
- data/docs/SubFormFieldsPerDocumentText.md +1 -1
- data/docs/SubFormFieldsPerDocumentTextMerge.md +1 -1
- data/docs/SubSignatureRequestSigner.md +1 -1
- data/docs/SubSignatureRequestTemplateSigner.md +1 -1
- data/examples/SignatureRequestEdit.rb +58 -0
- data/examples/SignatureRequestEditEmbedded.rb +48 -0
- data/examples/SignatureRequestEditEmbeddedWithTemplate.rb +41 -0
- data/examples/SignatureRequestEditWithTemplate.rb +52 -0
- data/lib/dropbox-sign/api/api_app_api.rb +1 -1
- data/lib/dropbox-sign/api/signature_request_api.rb +460 -0
- data/lib/dropbox-sign/api/team_api.rb +1 -1
- data/lib/dropbox-sign/event_callback_helper.rb +1 -1
- data/lib/dropbox-sign/models/bulk_send_job_get_response_signature_requests.rb +13 -1
- data/lib/dropbox-sign/models/event_callback_request_event.rb +2 -7
- data/lib/dropbox-sign/models/signature_request_bulk_create_embedded_with_template_request.rb +1 -1
- data/lib/dropbox-sign/models/signature_request_bulk_send_with_template_request.rb +1 -1
- data/lib/dropbox-sign/models/signature_request_edit_embedded_request.rb +593 -0
- data/lib/dropbox-sign/models/signature_request_edit_embedded_with_template_request.rb +490 -0
- data/lib/dropbox-sign/models/signature_request_edit_request.rb +612 -0
- data/lib/dropbox-sign/models/signature_request_edit_with_template_request.rb +509 -0
- data/lib/dropbox-sign/models/signature_request_response.rb +28 -4
- data/lib/dropbox-sign/models/sub_form_fields_per_document_date_signed.rb +2 -0
- data/lib/dropbox-sign/models/sub_form_fields_per_document_dropdown.rb +2 -0
- data/lib/dropbox-sign/models/sub_form_fields_per_document_hyperlink.rb +2 -0
- data/lib/dropbox-sign/models/sub_form_fields_per_document_text.rb +2 -0
- data/lib/dropbox-sign/models/sub_form_fields_per_document_text_merge.rb +2 -0
- data/lib/dropbox-sign/models/sub_signature_request_signer.rb +1 -1
- data/lib/dropbox-sign/models/sub_signature_request_template_signer.rb +1 -1
- data/lib/dropbox-sign/version.rb +1 -1
- data/lib/dropbox-sign.rb +4 -0
- data/openapi-config.yaml +1 -1
- data/openapi-sdk.yaml +2321 -1264
- data/spec/event_callback_helper_spec.rb +17 -3
- data/templates/event_callback_helper.mustache +1 -1
- data/test_fixtures/EventCallbackHelper_AccountCallbacks.json +82 -0
- data/test_fixtures/{EventCallbackHelper.json → EventCallbackHelper_AppCallbacks.json} +8 -4
- data/test_fixtures/SignatureRequestSendRequest.json +12 -6
- data/test_fixtures/SubFormFieldsPerDocument.json +8 -4
- metadata +23 -10
@@ -0,0 +1,490 @@
|
|
1
|
+
=begin
|
2
|
+
#Dropbox Sign API
|
3
|
+
|
4
|
+
#Dropbox Sign v3 API
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 3.0.0
|
7
|
+
Contact: apisupport@hellosign.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.3.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Dropbox
|
17
|
+
end
|
18
|
+
|
19
|
+
module Dropbox::Sign
|
20
|
+
class SignatureRequestEditEmbeddedWithTemplateRequest
|
21
|
+
# Use `template_ids` to create a SignatureRequest from one or more templates, in the order in which the template will be used.
|
22
|
+
# @return [Array<String>]
|
23
|
+
attr_accessor :template_ids
|
24
|
+
|
25
|
+
# Client id of the app you're using to create this embedded signature request. Used for security purposes.
|
26
|
+
# @return [String]
|
27
|
+
attr_accessor :client_id
|
28
|
+
|
29
|
+
# Add Signers to your Templated-based Signature Request.
|
30
|
+
# @return [Array<SubSignatureRequestTemplateSigner>]
|
31
|
+
attr_accessor :signers
|
32
|
+
|
33
|
+
# Allows signers to decline to sign a document if `true`. Defaults to `false`.
|
34
|
+
# @return [Boolean]
|
35
|
+
attr_accessor :allow_decline
|
36
|
+
|
37
|
+
# Add CC email recipients. Required when a CC role exists for the Template.
|
38
|
+
# @return [Array<SubCC>]
|
39
|
+
attr_accessor :ccs
|
40
|
+
|
41
|
+
# An array defining values and options for custom fields. Required when a custom field exists in the Template.
|
42
|
+
# @return [Array<SubCustomField>]
|
43
|
+
attr_accessor :custom_fields
|
44
|
+
|
45
|
+
# Use `files[]` to indicate the uploaded file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both.
|
46
|
+
# @return [Array<File>]
|
47
|
+
attr_accessor :files
|
48
|
+
|
49
|
+
# Use `file_urls[]` to have Dropbox Sign download the file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both.
|
50
|
+
# @return [Array<String>]
|
51
|
+
attr_accessor :file_urls
|
52
|
+
|
53
|
+
# The custom message in the email that will be sent to the signers.
|
54
|
+
# @return [String]
|
55
|
+
attr_accessor :message
|
56
|
+
|
57
|
+
# Key-value data that should be attached to the signature request. This metadata is included in all API responses and events involving the signature request. For example, use the metadata field to store a signer's order number for look up when receiving events for the signature request. Each request can include up to 10 metadata keys (or 50 nested metadata keys), with key names up to 40 characters long and values up to 1000 characters long.
|
58
|
+
# @return [Hash<String, Object>]
|
59
|
+
attr_accessor :metadata
|
60
|
+
|
61
|
+
# @return [SubSigningOptions]
|
62
|
+
attr_accessor :signing_options
|
63
|
+
|
64
|
+
# The subject in the email that will be sent to the signers.
|
65
|
+
# @return [String]
|
66
|
+
attr_accessor :subject
|
67
|
+
|
68
|
+
# Whether this is a test, the signature request will not be legally binding if set to `true`. Defaults to `false`.
|
69
|
+
# @return [Boolean]
|
70
|
+
attr_accessor :test_mode
|
71
|
+
|
72
|
+
# The title you want to assign to the SignatureRequest.
|
73
|
+
# @return [String]
|
74
|
+
attr_accessor :title
|
75
|
+
|
76
|
+
# Controls whether [auto fill fields](https://faq.hellosign.com/hc/en-us/articles/360051467511-Auto-Fill-Fields) can automatically populate a signer's information during signing. ⚠️ **Note** ⚠️: Keep your signer's information safe by ensuring that the _signer on your signature request is the intended party_ before using this feature.
|
77
|
+
# @return [Boolean]
|
78
|
+
attr_accessor :populate_auto_fill_fields
|
79
|
+
|
80
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
81
|
+
def self.attribute_map
|
82
|
+
{
|
83
|
+
:'template_ids' => :'template_ids',
|
84
|
+
:'client_id' => :'client_id',
|
85
|
+
:'signers' => :'signers',
|
86
|
+
:'allow_decline' => :'allow_decline',
|
87
|
+
:'ccs' => :'ccs',
|
88
|
+
:'custom_fields' => :'custom_fields',
|
89
|
+
:'files' => :'files',
|
90
|
+
:'file_urls' => :'file_urls',
|
91
|
+
:'message' => :'message',
|
92
|
+
:'metadata' => :'metadata',
|
93
|
+
:'signing_options' => :'signing_options',
|
94
|
+
:'subject' => :'subject',
|
95
|
+
:'test_mode' => :'test_mode',
|
96
|
+
:'title' => :'title',
|
97
|
+
:'populate_auto_fill_fields' => :'populate_auto_fill_fields'
|
98
|
+
}
|
99
|
+
end
|
100
|
+
|
101
|
+
# Returns all the JSON keys this model knows about
|
102
|
+
def self.acceptable_attributes
|
103
|
+
attribute_map.values
|
104
|
+
end
|
105
|
+
|
106
|
+
# Returns attribute map of this model + parent
|
107
|
+
def self.merged_attributes
|
108
|
+
self.attribute_map
|
109
|
+
end
|
110
|
+
|
111
|
+
# Attribute type mapping.
|
112
|
+
def self.openapi_types
|
113
|
+
{
|
114
|
+
:'template_ids' => :'Array<String>',
|
115
|
+
:'client_id' => :'String',
|
116
|
+
:'signers' => :'Array<SubSignatureRequestTemplateSigner>',
|
117
|
+
:'allow_decline' => :'Boolean',
|
118
|
+
:'ccs' => :'Array<SubCC>',
|
119
|
+
:'custom_fields' => :'Array<SubCustomField>',
|
120
|
+
:'files' => :'Array<File>',
|
121
|
+
:'file_urls' => :'Array<String>',
|
122
|
+
:'message' => :'String',
|
123
|
+
:'metadata' => :'Hash<String, Object>',
|
124
|
+
:'signing_options' => :'SubSigningOptions',
|
125
|
+
:'subject' => :'String',
|
126
|
+
:'test_mode' => :'Boolean',
|
127
|
+
:'title' => :'String',
|
128
|
+
:'populate_auto_fill_fields' => :'Boolean'
|
129
|
+
}
|
130
|
+
end
|
131
|
+
|
132
|
+
# Attribute type mapping of this model + parent
|
133
|
+
def self.merged_types
|
134
|
+
self.openapi_types
|
135
|
+
end
|
136
|
+
|
137
|
+
# List of attributes with nullable: true
|
138
|
+
def self.openapi_nullable
|
139
|
+
Set.new([
|
140
|
+
])
|
141
|
+
end
|
142
|
+
|
143
|
+
# Returns list of attributes with nullable: true of this model + parent
|
144
|
+
def self.merged_nullable
|
145
|
+
self.openapi_nullable
|
146
|
+
end
|
147
|
+
|
148
|
+
# Attempt to instantiate and hydrate a new instance of this class
|
149
|
+
# @param [Object] data Data to be converted
|
150
|
+
# @return [SignatureRequestEditEmbeddedWithTemplateRequest]
|
151
|
+
def self.init(data)
|
152
|
+
return ApiClient.default.convert_to_type(
|
153
|
+
data,
|
154
|
+
"SignatureRequestEditEmbeddedWithTemplateRequest"
|
155
|
+
) || SignatureRequestEditEmbeddedWithTemplateRequest.new
|
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 `Dropbox::Sign::SignatureRequestEditEmbeddedWithTemplateRequest` 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.merged_attributes.key?(k.to_sym))
|
168
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Dropbox::Sign::SignatureRequestEditEmbeddedWithTemplateRequest`. 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?(:'template_ids')
|
174
|
+
if (value = attributes[:'template_ids']).is_a?(Array)
|
175
|
+
self.template_ids = value
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
if attributes.key?(:'client_id')
|
180
|
+
self.client_id = attributes[:'client_id']
|
181
|
+
end
|
182
|
+
|
183
|
+
if attributes.key?(:'signers')
|
184
|
+
if (value = attributes[:'signers']).is_a?(Array)
|
185
|
+
self.signers = value
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
if attributes.key?(:'allow_decline')
|
190
|
+
self.allow_decline = attributes[:'allow_decline']
|
191
|
+
else
|
192
|
+
self.allow_decline = false
|
193
|
+
end
|
194
|
+
|
195
|
+
if attributes.key?(:'ccs')
|
196
|
+
if (value = attributes[:'ccs']).is_a?(Array)
|
197
|
+
self.ccs = value
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
if attributes.key?(:'custom_fields')
|
202
|
+
if (value = attributes[:'custom_fields']).is_a?(Array)
|
203
|
+
self.custom_fields = value
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
if attributes.key?(:'files')
|
208
|
+
if (value = attributes[:'files']).is_a?(Array)
|
209
|
+
self.files = value
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
if attributes.key?(:'file_urls')
|
214
|
+
if (value = attributes[:'file_urls']).is_a?(Array)
|
215
|
+
self.file_urls = value
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
if attributes.key?(:'message')
|
220
|
+
self.message = attributes[:'message']
|
221
|
+
end
|
222
|
+
|
223
|
+
if attributes.key?(:'metadata')
|
224
|
+
if (value = attributes[:'metadata']).is_a?(Hash)
|
225
|
+
self.metadata = value
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
if attributes.key?(:'signing_options')
|
230
|
+
self.signing_options = attributes[:'signing_options']
|
231
|
+
end
|
232
|
+
|
233
|
+
if attributes.key?(:'subject')
|
234
|
+
self.subject = attributes[:'subject']
|
235
|
+
end
|
236
|
+
|
237
|
+
if attributes.key?(:'test_mode')
|
238
|
+
self.test_mode = attributes[:'test_mode']
|
239
|
+
else
|
240
|
+
self.test_mode = false
|
241
|
+
end
|
242
|
+
|
243
|
+
if attributes.key?(:'title')
|
244
|
+
self.title = attributes[:'title']
|
245
|
+
end
|
246
|
+
|
247
|
+
if attributes.key?(:'populate_auto_fill_fields')
|
248
|
+
self.populate_auto_fill_fields = attributes[:'populate_auto_fill_fields']
|
249
|
+
else
|
250
|
+
self.populate_auto_fill_fields = false
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
255
|
+
# @return Array for valid properties with the reasons
|
256
|
+
def list_invalid_properties
|
257
|
+
invalid_properties = Array.new
|
258
|
+
if @template_ids.nil?
|
259
|
+
invalid_properties.push('invalid value for "template_ids", template_ids cannot be nil.')
|
260
|
+
end
|
261
|
+
|
262
|
+
if @client_id.nil?
|
263
|
+
invalid_properties.push('invalid value for "client_id", client_id cannot be nil.')
|
264
|
+
end
|
265
|
+
|
266
|
+
if @signers.nil?
|
267
|
+
invalid_properties.push('invalid value for "signers", signers cannot be nil.')
|
268
|
+
end
|
269
|
+
|
270
|
+
if !@message.nil? && @message.to_s.length > 5000
|
271
|
+
invalid_properties.push('invalid value for "message", the character length must be smaller than or equal to 5000.')
|
272
|
+
end
|
273
|
+
|
274
|
+
if !@subject.nil? && @subject.to_s.length > 255
|
275
|
+
invalid_properties.push('invalid value for "subject", the character length must be smaller than or equal to 255.')
|
276
|
+
end
|
277
|
+
|
278
|
+
if !@title.nil? && @title.to_s.length > 255
|
279
|
+
invalid_properties.push('invalid value for "title", the character length must be smaller than or equal to 255.')
|
280
|
+
end
|
281
|
+
|
282
|
+
invalid_properties
|
283
|
+
end
|
284
|
+
|
285
|
+
# Check to see if the all the properties in the model are valid
|
286
|
+
# @return true if the model is valid
|
287
|
+
def valid?
|
288
|
+
return false if @template_ids.nil?
|
289
|
+
return false if @client_id.nil?
|
290
|
+
return false if @signers.nil?
|
291
|
+
return false if !@message.nil? && @message.to_s.length > 5000
|
292
|
+
return false if !@subject.nil? && @subject.to_s.length > 255
|
293
|
+
return false if !@title.nil? && @title.to_s.length > 255
|
294
|
+
true
|
295
|
+
end
|
296
|
+
|
297
|
+
# Custom attribute writer method with validation
|
298
|
+
# @param [Object] message Value to be assigned
|
299
|
+
def message=(message)
|
300
|
+
if !message.nil? && message.to_s.length > 5000
|
301
|
+
fail ArgumentError, 'invalid value for "message", the character length must be smaller than or equal to 5000.'
|
302
|
+
end
|
303
|
+
|
304
|
+
@message = message
|
305
|
+
end
|
306
|
+
|
307
|
+
# Custom attribute writer method with validation
|
308
|
+
# @param [Object] metadata Value to be assigned
|
309
|
+
def metadata=(metadata)
|
310
|
+
@metadata = metadata
|
311
|
+
end
|
312
|
+
|
313
|
+
# Custom attribute writer method with validation
|
314
|
+
# @param [Object] subject Value to be assigned
|
315
|
+
def subject=(subject)
|
316
|
+
if !subject.nil? && subject.to_s.length > 255
|
317
|
+
fail ArgumentError, 'invalid value for "subject", the character length must be smaller than or equal to 255.'
|
318
|
+
end
|
319
|
+
|
320
|
+
@subject = subject
|
321
|
+
end
|
322
|
+
|
323
|
+
# Custom attribute writer method with validation
|
324
|
+
# @param [Object] title Value to be assigned
|
325
|
+
def title=(title)
|
326
|
+
if !title.nil? && title.to_s.length > 255
|
327
|
+
fail ArgumentError, 'invalid value for "title", the character length must be smaller than or equal to 255.'
|
328
|
+
end
|
329
|
+
|
330
|
+
@title = title
|
331
|
+
end
|
332
|
+
|
333
|
+
# Checks equality by comparing each attribute.
|
334
|
+
# @param [Object] Object to be compared
|
335
|
+
def ==(o)
|
336
|
+
return true if self.equal?(o)
|
337
|
+
self.class == o.class &&
|
338
|
+
template_ids == o.template_ids &&
|
339
|
+
client_id == o.client_id &&
|
340
|
+
signers == o.signers &&
|
341
|
+
allow_decline == o.allow_decline &&
|
342
|
+
ccs == o.ccs &&
|
343
|
+
custom_fields == o.custom_fields &&
|
344
|
+
files == o.files &&
|
345
|
+
file_urls == o.file_urls &&
|
346
|
+
message == o.message &&
|
347
|
+
metadata == o.metadata &&
|
348
|
+
signing_options == o.signing_options &&
|
349
|
+
subject == o.subject &&
|
350
|
+
test_mode == o.test_mode &&
|
351
|
+
title == o.title &&
|
352
|
+
populate_auto_fill_fields == o.populate_auto_fill_fields
|
353
|
+
end
|
354
|
+
|
355
|
+
# @see the `==` method
|
356
|
+
# @param [Object] Object to be compared
|
357
|
+
def eql?(o)
|
358
|
+
self == o
|
359
|
+
end
|
360
|
+
|
361
|
+
# Calculates hash code according to all attributes.
|
362
|
+
# @return [Integer] Hash code
|
363
|
+
def hash
|
364
|
+
[template_ids, client_id, signers, allow_decline, ccs, custom_fields, files, file_urls, message, metadata, signing_options, subject, test_mode, title, populate_auto_fill_fields].hash
|
365
|
+
end
|
366
|
+
|
367
|
+
# Builds the object from hash
|
368
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
369
|
+
# @return [Object] Returns the model itself
|
370
|
+
def self.build_from_hash(attributes)
|
371
|
+
new.build_from_hash(attributes)
|
372
|
+
end
|
373
|
+
|
374
|
+
# Builds the object from hash
|
375
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
376
|
+
# @return [Object] Returns the model itself
|
377
|
+
def build_from_hash(attributes)
|
378
|
+
return nil unless attributes.is_a?(Hash)
|
379
|
+
attribute_map = self.class.merged_attributes
|
380
|
+
|
381
|
+
self.class.merged_types.each_pair do |key, type|
|
382
|
+
if type =~ /\AArray<(.*)>/i
|
383
|
+
# check to ensure the input is an array given that the attribute
|
384
|
+
# is documented as an array but the input is not
|
385
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
386
|
+
self.send("#{key}=", attributes[attribute_map[key]].map { |v| _deserialize($1, v) })
|
387
|
+
end
|
388
|
+
elsif !attributes[attribute_map[key]].nil?
|
389
|
+
self.send("#{key}=", _deserialize(type, attributes[attribute_map[key]]))
|
390
|
+
end
|
391
|
+
end
|
392
|
+
|
393
|
+
self
|
394
|
+
end
|
395
|
+
|
396
|
+
# Deserializes the data based on type
|
397
|
+
# @param string type Data type
|
398
|
+
# @param string value Value to be deserialized
|
399
|
+
# @return [Object] Deserialized data
|
400
|
+
def _deserialize(type, value)
|
401
|
+
case type.to_sym
|
402
|
+
when :Time
|
403
|
+
Time.parse(value)
|
404
|
+
when :Date
|
405
|
+
Date.parse(value)
|
406
|
+
when :String
|
407
|
+
value.to_s
|
408
|
+
when :Integer
|
409
|
+
value.to_i
|
410
|
+
when :Float
|
411
|
+
value.to_f
|
412
|
+
when :Boolean
|
413
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
414
|
+
true
|
415
|
+
else
|
416
|
+
false
|
417
|
+
end
|
418
|
+
when :File
|
419
|
+
value
|
420
|
+
when :Object
|
421
|
+
# generic object (usually a Hash), return directly
|
422
|
+
value
|
423
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
424
|
+
inner_type = Regexp.last_match[:inner_type]
|
425
|
+
value.map { |v| _deserialize(inner_type, v) }
|
426
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
427
|
+
k_type = Regexp.last_match[:k_type]
|
428
|
+
v_type = Regexp.last_match[:v_type]
|
429
|
+
{}.tap do |hash|
|
430
|
+
value.each do |k, v|
|
431
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
432
|
+
end
|
433
|
+
end
|
434
|
+
else # model
|
435
|
+
# models (e.g. Pet)
|
436
|
+
klass = Dropbox::Sign.const_get(type)
|
437
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
438
|
+
end
|
439
|
+
end
|
440
|
+
|
441
|
+
# Returns the string representation of the object
|
442
|
+
# @return [String] String presentation of the object
|
443
|
+
def to_s
|
444
|
+
to_hash.to_s
|
445
|
+
end
|
446
|
+
|
447
|
+
# to_body is an alias to to_hash (backward compatibility)
|
448
|
+
# @return [Hash] Returns the object in the form of hash
|
449
|
+
def to_body
|
450
|
+
to_hash
|
451
|
+
end
|
452
|
+
|
453
|
+
# Returns the object in the form of hash
|
454
|
+
# @return [Hash] Returns the object in the form of hash
|
455
|
+
def to_hash(include_nil = true)
|
456
|
+
hash = {}
|
457
|
+
self.class.merged_attributes.each_pair do |attr, param|
|
458
|
+
value = self.send(attr)
|
459
|
+
if value.nil?
|
460
|
+
next unless include_nil
|
461
|
+
is_nullable = self.class.merged_nullable.include?(attr)
|
462
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
463
|
+
end
|
464
|
+
|
465
|
+
hash[param] = _to_hash(value, include_nil)
|
466
|
+
end
|
467
|
+
hash
|
468
|
+
end
|
469
|
+
|
470
|
+
# Outputs non-array value in the form of hash
|
471
|
+
# For object, use to_hash. Otherwise, just return the value
|
472
|
+
# @param [Object] value Any valid value
|
473
|
+
# @return [Hash] Returns the value in the form of hash
|
474
|
+
def _to_hash(value, include_nil = true)
|
475
|
+
if value.is_a?(Array)
|
476
|
+
value.compact.map { |v| _to_hash(v, include_nil) }
|
477
|
+
elsif value.is_a?(Hash)
|
478
|
+
{}.tap do |hash|
|
479
|
+
value.each { |k, v| hash[k] = _to_hash(v, include_nil) }
|
480
|
+
end
|
481
|
+
elsif value.respond_to? :to_hash
|
482
|
+
value.to_hash(include_nil)
|
483
|
+
else
|
484
|
+
value
|
485
|
+
end
|
486
|
+
end
|
487
|
+
|
488
|
+
end
|
489
|
+
|
490
|
+
end
|