dropbox-sign 1.1.2 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/README.md +9 -4
  4. data/VERSION +1 -1
  5. data/docs/OAuthApi.md +0 -16
  6. data/docs/SignatureRequestApi.md +1 -1
  7. data/docs/SignatureRequestSendRequest.md +1 -0
  8. data/docs/SignatureRequestSendWithTemplateRequest.md +1 -0
  9. data/docs/SignatureRequestUpdateRequest.md +1 -1
  10. data/docs/SubFormFieldsPerDocumentBase.md +1 -1
  11. data/docs/SubFormFieldsPerDocumentDateSigned.md +2 -0
  12. data/docs/SubFormFieldsPerDocumentDropdown.md +2 -0
  13. data/docs/SubFormFieldsPerDocumentFontEnum.md +9 -0
  14. data/docs/SubFormFieldsPerDocumentHyperlink.md +2 -0
  15. data/docs/SubFormFieldsPerDocumentText.md +3 -0
  16. data/docs/SubFormFieldsPerDocumentTextMerge.md +2 -0
  17. data/docs/SubWhiteLabelingOptions.md +1 -1
  18. data/docs/TemplateApi.md +102 -0
  19. data/docs/TemplateCreateRequest.md +27 -0
  20. data/docs/TemplateCreateResponse.md +11 -0
  21. data/docs/TemplateCreateResponseTemplate.md +10 -0
  22. data/examples/OauthTokenGenerate.rb +0 -8
  23. data/examples/OauthTokenRefresh.rb +0 -8
  24. data/examples/TemplateCreate.rb +49 -0
  25. data/lib/dropbox-sign/api/signature_request_api.rb +2 -2
  26. data/lib/dropbox-sign/api/template_api.rb +109 -0
  27. data/lib/dropbox-sign/models/signature_request_send_request.rb +14 -1
  28. data/lib/dropbox-sign/models/signature_request_send_with_template_request.rb +14 -1
  29. data/lib/dropbox-sign/models/signature_request_update_request.rb +1 -1
  30. data/lib/dropbox-sign/models/sub_form_fields_per_document_base.rb +1 -1
  31. data/lib/dropbox-sign/models/sub_form_fields_per_document_date_signed.rb +60 -4
  32. data/lib/dropbox-sign/models/sub_form_fields_per_document_dropdown.rb +60 -4
  33. data/lib/dropbox-sign/models/sub_form_fields_per_document_font_enum.rb +54 -0
  34. data/lib/dropbox-sign/models/sub_form_fields_per_document_hyperlink.rb +60 -4
  35. data/lib/dropbox-sign/models/sub_form_fields_per_document_text.rb +49 -4
  36. data/lib/dropbox-sign/models/sub_form_fields_per_document_text_merge.rb +60 -4
  37. data/lib/dropbox-sign/models/sub_white_labeling_options.rb +1 -1
  38. data/lib/dropbox-sign/models/template_create_request.rb +509 -0
  39. data/lib/dropbox-sign/models/template_create_response.rb +263 -0
  40. data/lib/dropbox-sign/models/template_create_response_template.rb +252 -0
  41. data/lib/dropbox-sign/version.rb +1 -1
  42. data/lib/dropbox-sign.rb +4 -0
  43. data/openapi-config.yaml +1 -1
  44. data/openapi-sdk.yaml +701 -241
  45. data/test_fixtures/SignatureRequestCreateEmbeddedRequest.json +6 -2
  46. data/test_fixtures/SignatureRequestSendRequest.json +8 -2
  47. data/test_fixtures/SignatureRequestSendWithTemplateRequest.json +1 -0
  48. data/test_fixtures/TemplateCreateEmbeddedDraftRequest.json +3 -1
  49. data/test_fixtures/TemplateCreateRequest.json +120 -0
  50. data/test_fixtures/TemplateCreateResponse.json +7 -0
  51. data/test_fixtures/UnclaimedDraftCreateEmbeddedRequest.json +3 -1
  52. data/test_fixtures/UnclaimedDraftCreateRequest.json +3 -1
  53. metadata +21 -10
@@ -23,10 +23,42 @@ module Dropbox::Sign
23
23
  # @return [String]
24
24
  attr_accessor :type
25
25
 
26
+ # Font family for the field.
27
+ # @return [String]
28
+ attr_accessor :font_family
29
+
30
+ # The initial px font size for the field contents. Can be any integer value between `7` and `49`. **NOTE**: Font size may be reduced during processing in order to fit the contents within the dimensions of the field.
31
+ # @return [Integer]
32
+ attr_accessor :font_size
33
+
34
+ class EnumAttributeValidator
35
+ attr_reader :datatype
36
+ attr_reader :allowable_values
37
+
38
+ def initialize(datatype, allowable_values)
39
+ @allowable_values = allowable_values.map do |value|
40
+ case datatype.to_s
41
+ when /Integer/i
42
+ value.to_i
43
+ when /Float/i
44
+ value.to_f
45
+ else
46
+ value
47
+ end
48
+ end
49
+ end
50
+
51
+ def valid?(value)
52
+ !value || allowable_values.include?(value)
53
+ end
54
+ end
55
+
26
56
  # Attribute mapping from ruby-style variable name to JSON key.
27
57
  def self.attribute_map
28
58
  {
29
- :'type' => :'type'
59
+ :'type' => :'type',
60
+ :'font_family' => :'font_family',
61
+ :'font_size' => :'font_size'
30
62
  }
31
63
  end
32
64
 
@@ -43,7 +75,9 @@ module Dropbox::Sign
43
75
  # Attribute type mapping.
44
76
  def self.openapi_types
45
77
  {
46
- :'type' => :'String'
78
+ :'type' => :'String',
79
+ :'font_family' => :'String',
80
+ :'font_size' => :'Integer'
47
81
  }
48
82
  end
49
83
 
@@ -96,6 +130,14 @@ module Dropbox::Sign
96
130
  else
97
131
  self.type = 'text-merge'
98
132
  end
133
+
134
+ if attributes.key?(:'font_family')
135
+ self.font_family = attributes[:'font_family']
136
+ end
137
+
138
+ if attributes.key?(:'font_size')
139
+ self.font_size = attributes[:'font_size']
140
+ end
99
141
  end
100
142
 
101
143
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -113,15 +155,29 @@ module Dropbox::Sign
113
155
  # @return true if the model is valid
114
156
  def valid?
115
157
  return false if @type.nil?
158
+ font_family_validator = EnumAttributeValidator.new('String', ["helvetica", "arial", "courier", "calibri", "cambria", "georgia", "times", "trebuchet", "verdana", "roboto", "robotoMono", "notoSans", "notoSerif", "notoCJK-JP-Regular", "notoHebrew-Regular", "notoSanThaiMerged"])
159
+ return false unless font_family_validator.valid?(@font_family)
116
160
  true && super
117
161
  end
118
162
 
163
+ # Custom attribute writer method checking allowed values (enum).
164
+ # @param [Object] font_family Object to be assigned
165
+ def font_family=(font_family)
166
+ validator = EnumAttributeValidator.new('String', ["helvetica", "arial", "courier", "calibri", "cambria", "georgia", "times", "trebuchet", "verdana", "roboto", "robotoMono", "notoSans", "notoSerif", "notoCJK-JP-Regular", "notoHebrew-Regular", "notoSanThaiMerged"])
167
+ unless validator.valid?(font_family)
168
+ fail ArgumentError, "invalid value for \"font_family\", must be one of #{validator.allowable_values}."
169
+ end
170
+ @font_family = font_family
171
+ end
172
+
119
173
  # Checks equality by comparing each attribute.
120
174
  # @param [Object] Object to be compared
121
175
  def ==(o)
122
176
  return true if self.equal?(o)
123
177
  self.class == o.class &&
124
- type == o.type && super(o)
178
+ type == o.type &&
179
+ font_family == o.font_family &&
180
+ font_size == o.font_size && super(o)
125
181
  end
126
182
 
127
183
  # @see the `==` method
@@ -133,7 +189,7 @@ module Dropbox::Sign
133
189
  # Calculates hash code according to all attributes.
134
190
  # @return [Integer] Hash code
135
191
  def hash
136
- [type].hash
192
+ [type, font_family, font_size].hash
137
193
  end
138
194
 
139
195
  # Builds the object from hash
@@ -17,7 +17,7 @@ module Dropbox
17
17
  end
18
18
 
19
19
  module Dropbox::Sign
20
- # An array of elements and values serialized to a string, to be used to customize the app's signer page. (Only applies to some API plans) Take a look at our [white labeling guide](/api/reference/white-labeling/) to learn more.
20
+ # An array of elements and values serialized to a string, to be used to customize the app's signer page. (Only applies to some API plans) Take a look at our [white labeling guide](https://developers.hellosign.com/api/reference/premium-branding/) to learn more.
21
21
  class SubWhiteLabelingOptions
22
22
  # @return [String]
23
23
  attr_accessor :header_background_color
@@ -0,0 +1,509 @@
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 TemplateCreateRequest
21
+ # The fields that should appear on the document, expressed as an array of objects. (For more details you can read about it here: [Using Form Fields per Document](/docs/openapi/form-fields-per-document).) **NOTE**: Fields like **text**, **dropdown**, **checkbox**, **radio**, and **hyperlink** have additional required and optional parameters. Check out the list of [additional parameters](/api/reference/constants/#form-fields-per-document) for these field types. * Text Field use `SubFormFieldsPerDocumentText` * Dropdown Field use `SubFormFieldsPerDocumentDropdown` * Hyperlink Field use `SubFormFieldsPerDocumentHyperlink` * Checkbox Field use `SubFormFieldsPerDocumentCheckbox` * Radio Field use `SubFormFieldsPerDocumentRadio` * Signature Field use `SubFormFieldsPerDocumentSignature` * Date Signed Field use `SubFormFieldsPerDocumentDateSigned` * Initials Field use `SubFormFieldsPerDocumentInitials` * Text Merge Field use `SubFormFieldsPerDocumentTextMerge` * Checkbox Merge Field use `SubFormFieldsPerDocumentCheckboxMerge`
22
+ # @return [Array<SubFormFieldsPerDocumentBase>]
23
+ attr_accessor :form_fields_per_document
24
+
25
+ # An array of the designated signer roles that must be specified when sending a SignatureRequest using this Template.
26
+ # @return [Array<SubTemplateRole>]
27
+ attr_accessor :signer_roles
28
+
29
+ # Use `files[]` to indicate the uploaded file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both.
30
+ # @return [Array<File>]
31
+ attr_accessor :files
32
+
33
+ # 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.
34
+ # @return [Array<String>]
35
+ attr_accessor :file_urls
36
+
37
+ # Allows signers to reassign their signature requests to other signers if set to `true`. Defaults to `false`. **Note**: Only available for Premium plan and higher.
38
+ # @return [Boolean]
39
+ attr_accessor :allow_reassign
40
+
41
+ # A list describing the attachments
42
+ # @return [Array<SubAttachment>]
43
+ attr_accessor :attachments
44
+
45
+ # The CC roles that must be assigned when using the template to send a signature request
46
+ # @return [Array<String>]
47
+ attr_accessor :cc_roles
48
+
49
+ # Client id of the app you're using to create this draft. Used to apply the branding and callback url defined for the app.
50
+ # @return [String]
51
+ attr_accessor :client_id
52
+
53
+ # @return [SubFieldOptions]
54
+ attr_accessor :field_options
55
+
56
+ # Group information for fields defined in `form_fields_per_document`. String-indexed JSON array with `group_label` and `requirement` keys. `form_fields_per_document` must contain fields referencing a group defined in `form_field_groups`.
57
+ # @return [Array<SubFormFieldGroup>]
58
+ attr_accessor :form_field_groups
59
+
60
+ # Conditional Logic rules for fields defined in `form_fields_per_document`.
61
+ # @return [Array<SubFormFieldRule>]
62
+ attr_accessor :form_field_rules
63
+
64
+ # Add merge fields to the template. Merge fields are placed by the user creating the template and used to pre-fill data by passing values into signature requests with the `custom_fields` parameter. If the signature request using that template *does not* pass a value into a merge field, then an empty field remains in the document.
65
+ # @return [Array<SubMergeField>]
66
+ attr_accessor :merge_fields
67
+
68
+ # The default template email message.
69
+ # @return [String]
70
+ attr_accessor :message
71
+
72
+ # 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.
73
+ # @return [Hash<String, Object>]
74
+ attr_accessor :metadata
75
+
76
+ # The template title (alias).
77
+ # @return [String]
78
+ attr_accessor :subject
79
+
80
+ # Whether this is a test, the signature request created from this draft will not be legally binding if set to `true`. Defaults to `false`.
81
+ # @return [Boolean]
82
+ attr_accessor :test_mode
83
+
84
+ # The title you want to assign to the SignatureRequest.
85
+ # @return [String]
86
+ attr_accessor :title
87
+
88
+ # Enable the detection of predefined PDF fields by setting the `use_preexisting_fields` to `true` (defaults to disabled, or `false`).
89
+ # @return [Boolean]
90
+ attr_accessor :use_preexisting_fields
91
+
92
+ # Attribute mapping from ruby-style variable name to JSON key.
93
+ def self.attribute_map
94
+ {
95
+ :'form_fields_per_document' => :'form_fields_per_document',
96
+ :'signer_roles' => :'signer_roles',
97
+ :'files' => :'files',
98
+ :'file_urls' => :'file_urls',
99
+ :'allow_reassign' => :'allow_reassign',
100
+ :'attachments' => :'attachments',
101
+ :'cc_roles' => :'cc_roles',
102
+ :'client_id' => :'client_id',
103
+ :'field_options' => :'field_options',
104
+ :'form_field_groups' => :'form_field_groups',
105
+ :'form_field_rules' => :'form_field_rules',
106
+ :'merge_fields' => :'merge_fields',
107
+ :'message' => :'message',
108
+ :'metadata' => :'metadata',
109
+ :'subject' => :'subject',
110
+ :'test_mode' => :'test_mode',
111
+ :'title' => :'title',
112
+ :'use_preexisting_fields' => :'use_preexisting_fields'
113
+ }
114
+ end
115
+
116
+ # Returns all the JSON keys this model knows about
117
+ def self.acceptable_attributes
118
+ attribute_map.values
119
+ end
120
+
121
+ # Returns attribute map of this model + parent
122
+ def self.merged_attributes
123
+ self.attribute_map
124
+ end
125
+
126
+ # Attribute type mapping.
127
+ def self.openapi_types
128
+ {
129
+ :'form_fields_per_document' => :'Array<SubFormFieldsPerDocumentBase>',
130
+ :'signer_roles' => :'Array<SubTemplateRole>',
131
+ :'files' => :'Array<File>',
132
+ :'file_urls' => :'Array<String>',
133
+ :'allow_reassign' => :'Boolean',
134
+ :'attachments' => :'Array<SubAttachment>',
135
+ :'cc_roles' => :'Array<String>',
136
+ :'client_id' => :'String',
137
+ :'field_options' => :'SubFieldOptions',
138
+ :'form_field_groups' => :'Array<SubFormFieldGroup>',
139
+ :'form_field_rules' => :'Array<SubFormFieldRule>',
140
+ :'merge_fields' => :'Array<SubMergeField>',
141
+ :'message' => :'String',
142
+ :'metadata' => :'Hash<String, Object>',
143
+ :'subject' => :'String',
144
+ :'test_mode' => :'Boolean',
145
+ :'title' => :'String',
146
+ :'use_preexisting_fields' => :'Boolean'
147
+ }
148
+ end
149
+
150
+ # Attribute type mapping of this model + parent
151
+ def self.merged_types
152
+ self.openapi_types
153
+ end
154
+
155
+ # List of attributes with nullable: true
156
+ def self.openapi_nullable
157
+ Set.new([
158
+ ])
159
+ end
160
+
161
+ # Returns list of attributes with nullable: true of this model + parent
162
+ def self.merged_nullable
163
+ self.openapi_nullable
164
+ end
165
+
166
+ # Attempt to instantiate and hydrate a new instance of this class
167
+ # @param [Object] data Data to be converted
168
+ # @return [TemplateCreateRequest]
169
+ def self.init(data)
170
+ return ApiClient.default.convert_to_type(
171
+ data,
172
+ "TemplateCreateRequest"
173
+ ) || TemplateCreateRequest.new
174
+ end
175
+
176
+ # Initializes the object
177
+ # @param [Hash] attributes Model attributes in the form of hash
178
+ def initialize(attributes = {})
179
+ if (!attributes.is_a?(Hash))
180
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Dropbox::Sign::TemplateCreateRequest` initialize method"
181
+ end
182
+
183
+ # check to see if the attribute exists and convert string to symbol for hash key
184
+ attributes = attributes.each_with_object({}) { |(k, v), h|
185
+ if (!self.class.merged_attributes.key?(k.to_sym))
186
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Dropbox::Sign::TemplateCreateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
187
+ end
188
+ h[k.to_sym] = v
189
+ }
190
+
191
+ if attributes.key?(:'form_fields_per_document')
192
+ if (value = attributes[:'form_fields_per_document']).is_a?(Array)
193
+ self.form_fields_per_document = value
194
+ end
195
+ end
196
+
197
+ if attributes.key?(:'signer_roles')
198
+ if (value = attributes[:'signer_roles']).is_a?(Array)
199
+ self.signer_roles = value
200
+ end
201
+ end
202
+
203
+ if attributes.key?(:'files')
204
+ if (value = attributes[:'files']).is_a?(Array)
205
+ self.files = value
206
+ end
207
+ end
208
+
209
+ if attributes.key?(:'file_urls')
210
+ if (value = attributes[:'file_urls']).is_a?(Array)
211
+ self.file_urls = value
212
+ end
213
+ end
214
+
215
+ if attributes.key?(:'allow_reassign')
216
+ self.allow_reassign = attributes[:'allow_reassign']
217
+ else
218
+ self.allow_reassign = false
219
+ end
220
+
221
+ if attributes.key?(:'attachments')
222
+ if (value = attributes[:'attachments']).is_a?(Array)
223
+ self.attachments = value
224
+ end
225
+ end
226
+
227
+ if attributes.key?(:'cc_roles')
228
+ if (value = attributes[:'cc_roles']).is_a?(Array)
229
+ self.cc_roles = value
230
+ end
231
+ end
232
+
233
+ if attributes.key?(:'client_id')
234
+ self.client_id = attributes[:'client_id']
235
+ end
236
+
237
+ if attributes.key?(:'field_options')
238
+ self.field_options = attributes[:'field_options']
239
+ end
240
+
241
+ if attributes.key?(:'form_field_groups')
242
+ if (value = attributes[:'form_field_groups']).is_a?(Array)
243
+ self.form_field_groups = value
244
+ end
245
+ end
246
+
247
+ if attributes.key?(:'form_field_rules')
248
+ if (value = attributes[:'form_field_rules']).is_a?(Array)
249
+ self.form_field_rules = value
250
+ end
251
+ end
252
+
253
+ if attributes.key?(:'merge_fields')
254
+ if (value = attributes[:'merge_fields']).is_a?(Array)
255
+ self.merge_fields = value
256
+ end
257
+ end
258
+
259
+ if attributes.key?(:'message')
260
+ self.message = attributes[:'message']
261
+ end
262
+
263
+ if attributes.key?(:'metadata')
264
+ if (value = attributes[:'metadata']).is_a?(Hash)
265
+ self.metadata = value
266
+ end
267
+ end
268
+
269
+ if attributes.key?(:'subject')
270
+ self.subject = attributes[:'subject']
271
+ end
272
+
273
+ if attributes.key?(:'test_mode')
274
+ self.test_mode = attributes[:'test_mode']
275
+ else
276
+ self.test_mode = false
277
+ end
278
+
279
+ if attributes.key?(:'title')
280
+ self.title = attributes[:'title']
281
+ end
282
+
283
+ if attributes.key?(:'use_preexisting_fields')
284
+ self.use_preexisting_fields = attributes[:'use_preexisting_fields']
285
+ else
286
+ self.use_preexisting_fields = false
287
+ end
288
+ end
289
+
290
+ # Show invalid properties with the reasons. Usually used together with valid?
291
+ # @return Array for valid properties with the reasons
292
+ def list_invalid_properties
293
+ invalid_properties = Array.new
294
+ if @form_fields_per_document.nil?
295
+ invalid_properties.push('invalid value for "form_fields_per_document", form_fields_per_document cannot be nil.')
296
+ end
297
+
298
+ if @signer_roles.nil?
299
+ invalid_properties.push('invalid value for "signer_roles", signer_roles cannot be nil.')
300
+ end
301
+
302
+ if !@message.nil? && @message.to_s.length > 5000
303
+ invalid_properties.push('invalid value for "message", the character length must be smaller than or equal to 5000.')
304
+ end
305
+
306
+ if !@subject.nil? && @subject.to_s.length > 200
307
+ invalid_properties.push('invalid value for "subject", the character length must be smaller than or equal to 200.')
308
+ end
309
+
310
+ invalid_properties
311
+ end
312
+
313
+ # Check to see if the all the properties in the model are valid
314
+ # @return true if the model is valid
315
+ def valid?
316
+ return false if @form_fields_per_document.nil?
317
+ return false if @signer_roles.nil?
318
+ return false if !@message.nil? && @message.to_s.length > 5000
319
+ return false if !@subject.nil? && @subject.to_s.length > 200
320
+ true
321
+ end
322
+
323
+ # Custom attribute writer method with validation
324
+ # @param [Object] message Value to be assigned
325
+ def message=(message)
326
+ if !message.nil? && message.to_s.length > 5000
327
+ fail ArgumentError, 'invalid value for "message", the character length must be smaller than or equal to 5000.'
328
+ end
329
+
330
+ @message = message
331
+ end
332
+
333
+ # Custom attribute writer method with validation
334
+ # @param [Object] metadata Value to be assigned
335
+ def metadata=(metadata)
336
+ @metadata = metadata
337
+ end
338
+
339
+ # Custom attribute writer method with validation
340
+ # @param [Object] subject Value to be assigned
341
+ def subject=(subject)
342
+ if !subject.nil? && subject.to_s.length > 200
343
+ fail ArgumentError, 'invalid value for "subject", the character length must be smaller than or equal to 200.'
344
+ end
345
+
346
+ @subject = subject
347
+ end
348
+
349
+ # Checks equality by comparing each attribute.
350
+ # @param [Object] Object to be compared
351
+ def ==(o)
352
+ return true if self.equal?(o)
353
+ self.class == o.class &&
354
+ form_fields_per_document == o.form_fields_per_document &&
355
+ signer_roles == o.signer_roles &&
356
+ files == o.files &&
357
+ file_urls == o.file_urls &&
358
+ allow_reassign == o.allow_reassign &&
359
+ attachments == o.attachments &&
360
+ cc_roles == o.cc_roles &&
361
+ client_id == o.client_id &&
362
+ field_options == o.field_options &&
363
+ form_field_groups == o.form_field_groups &&
364
+ form_field_rules == o.form_field_rules &&
365
+ merge_fields == o.merge_fields &&
366
+ message == o.message &&
367
+ metadata == o.metadata &&
368
+ subject == o.subject &&
369
+ test_mode == o.test_mode &&
370
+ title == o.title &&
371
+ use_preexisting_fields == o.use_preexisting_fields
372
+ end
373
+
374
+ # @see the `==` method
375
+ # @param [Object] Object to be compared
376
+ def eql?(o)
377
+ self == o
378
+ end
379
+
380
+ # Calculates hash code according to all attributes.
381
+ # @return [Integer] Hash code
382
+ def hash
383
+ [form_fields_per_document, signer_roles, files, file_urls, allow_reassign, attachments, cc_roles, client_id, field_options, form_field_groups, form_field_rules, merge_fields, message, metadata, subject, test_mode, title, use_preexisting_fields].hash
384
+ end
385
+
386
+ # Builds the object from hash
387
+ # @param [Hash] attributes Model attributes in the form of hash
388
+ # @return [Object] Returns the model itself
389
+ def self.build_from_hash(attributes)
390
+ new.build_from_hash(attributes)
391
+ end
392
+
393
+ # Builds the object from hash
394
+ # @param [Hash] attributes Model attributes in the form of hash
395
+ # @return [Object] Returns the model itself
396
+ def build_from_hash(attributes)
397
+ return nil unless attributes.is_a?(Hash)
398
+ attribute_map = self.class.merged_attributes
399
+
400
+ self.class.merged_types.each_pair do |key, type|
401
+ if type =~ /\AArray<(.*)>/i
402
+ # check to ensure the input is an array given that the attribute
403
+ # is documented as an array but the input is not
404
+ if attributes[attribute_map[key]].is_a?(Array)
405
+ self.send("#{key}=", attributes[attribute_map[key]].map { |v| _deserialize($1, v) })
406
+ end
407
+ elsif !attributes[attribute_map[key]].nil?
408
+ self.send("#{key}=", _deserialize(type, attributes[attribute_map[key]]))
409
+ end
410
+ end
411
+
412
+ self
413
+ end
414
+
415
+ # Deserializes the data based on type
416
+ # @param string type Data type
417
+ # @param string value Value to be deserialized
418
+ # @return [Object] Deserialized data
419
+ def _deserialize(type, value)
420
+ case type.to_sym
421
+ when :Time
422
+ Time.parse(value)
423
+ when :Date
424
+ Date.parse(value)
425
+ when :String
426
+ value.to_s
427
+ when :Integer
428
+ value.to_i
429
+ when :Float
430
+ value.to_f
431
+ when :Boolean
432
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
433
+ true
434
+ else
435
+ false
436
+ end
437
+ when :File
438
+ value
439
+ when :Object
440
+ # generic object (usually a Hash), return directly
441
+ value
442
+ when /\AArray<(?<inner_type>.+)>\z/
443
+ inner_type = Regexp.last_match[:inner_type]
444
+ value.map { |v| _deserialize(inner_type, v) }
445
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
446
+ k_type = Regexp.last_match[:k_type]
447
+ v_type = Regexp.last_match[:v_type]
448
+ {}.tap do |hash|
449
+ value.each do |k, v|
450
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
451
+ end
452
+ end
453
+ else # model
454
+ # models (e.g. Pet)
455
+ klass = Dropbox::Sign.const_get(type)
456
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
457
+ end
458
+ end
459
+
460
+ # Returns the string representation of the object
461
+ # @return [String] String presentation of the object
462
+ def to_s
463
+ to_hash.to_s
464
+ end
465
+
466
+ # to_body is an alias to to_hash (backward compatibility)
467
+ # @return [Hash] Returns the object in the form of hash
468
+ def to_body
469
+ to_hash
470
+ end
471
+
472
+ # Returns the object in the form of hash
473
+ # @return [Hash] Returns the object in the form of hash
474
+ def to_hash(include_nil = true)
475
+ hash = {}
476
+ self.class.merged_attributes.each_pair do |attr, param|
477
+ value = self.send(attr)
478
+ if value.nil?
479
+ next unless include_nil
480
+ is_nullable = self.class.merged_nullable.include?(attr)
481
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
482
+ end
483
+
484
+ hash[param] = _to_hash(value, include_nil)
485
+ end
486
+ hash
487
+ end
488
+
489
+ # Outputs non-array value in the form of hash
490
+ # For object, use to_hash. Otherwise, just return the value
491
+ # @param [Object] value Any valid value
492
+ # @return [Hash] Returns the value in the form of hash
493
+ def _to_hash(value, include_nil = true)
494
+ if value.is_a?(Array)
495
+ value.compact.map { |v| _to_hash(v, include_nil) }
496
+ elsif value.is_a?(Hash)
497
+ {}.tap do |hash|
498
+ value.each { |k, v| hash[k] = _to_hash(v, include_nil) }
499
+ end
500
+ elsif value.respond_to? :to_hash
501
+ value.to_hash(include_nil)
502
+ else
503
+ value
504
+ end
505
+ end
506
+
507
+ end
508
+
509
+ end