Class: SignRequestClient::Document

Inherits:
Object
  • Object
show all
Defined in:
lib/signrequest_client/models/document.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Document

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
# File 'lib/signrequest_client/models/document.rb', line 193

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  if attributes.has_key?(:'url')
    self.url = attributes[:'url']
  end

  if attributes.has_key?(:'team')
    self.team = attributes[:'team']
  end

  if attributes.has_key?(:'uuid')
    self.uuid = attributes[:'uuid']
  end

  if attributes.has_key?(:'user')
    self.user = attributes[:'user']
  end

  if attributes.has_key?(:'file_as_pdf')
    self.file_as_pdf = attributes[:'file_as_pdf']
  end

  if attributes.has_key?(:'name')
    self.name = attributes[:'name']
  end

  if attributes.has_key?(:'external_id')
    self.external_id = attributes[:'external_id']
  end

  if attributes.has_key?(:'frontend_id')
    self.frontend_id = attributes[:'frontend_id']
  end

  if attributes.has_key?(:'file')
    self.file = attributes[:'file']
  end

  if attributes.has_key?(:'file_from_url')
    self.file_from_url = attributes[:'file_from_url']
  end

  if attributes.has_key?(:'events_callback_url')
    self.events_callback_url = attributes[:'events_callback_url']
  end

  if attributes.has_key?(:'file_from_content')
    self.file_from_content = attributes[:'file_from_content']
  end

  if attributes.has_key?(:'file_from_content_name')
    self.file_from_content_name = attributes[:'file_from_content_name']
  end

  if attributes.has_key?(:'template')
    self.template = attributes[:'template']
  end

  if attributes.has_key?(:'prefill_tags')
    if (value = attributes[:'prefill_tags']).is_a?(Array)
      self.prefill_tags = value
    end
  end

  if attributes.has_key?(:'integrations')
    if (value = attributes[:'integrations']).is_a?(Array)
      self.integrations = value
    end
  end

  if attributes.has_key?(:'file_from_sf')
    self.file_from_sf = attributes[:'file_from_sf']
  end

  if attributes.has_key?(:'auto_delete_days')
    self.auto_delete_days = attributes[:'auto_delete_days']
  end

  if attributes.has_key?(:'auto_expire_days')
    self.auto_expire_days = attributes[:'auto_expire_days']
  end

  if attributes.has_key?(:'pdf')
    self.pdf = attributes[:'pdf']
  end

  if attributes.has_key?(:'status')
    self.status = attributes[:'status']
  end

  if attributes.has_key?(:'signrequest')
    self.signrequest = attributes[:'signrequest']
  end

  if attributes.has_key?(:'api_used')
    self.api_used = attributes[:'api_used']
  end

  if attributes.has_key?(:'signing_log')
    self.signing_log = attributes[:'signing_log']
  end

  if attributes.has_key?(:'security_hash')
    self.security_hash = attributes[:'security_hash']
  end

  if attributes.has_key?(:'attachments')
    if (value = attributes[:'attachments']).is_a?(Array)
      self.attachments = value
    end
  end

  if attributes.has_key?(:'auto_delete_after')
    self.auto_delete_after = attributes[:'auto_delete_after']
  end

  if attributes.has_key?(:'sandbox')
    self.sandbox = attributes[:'sandbox']
  end

  if attributes.has_key?(:'auto_expire_after')
    self.auto_expire_after = attributes[:'auto_expire_after']
  end

  if attributes.has_key?(:'processing')
    self.processing = attributes[:'processing']
  end
end

Instance Attribute Details

#api_usedObject

Indicates whether document was created using the API



76
77
78
# File 'lib/signrequest_client/models/document.rb', line 76

def api_used
  @api_used
end

#attachmentsObject

Returns the value of attribute attachments.



83
84
85
# File 'lib/signrequest_client/models/document.rb', line 83

def attachments
  @attachments
end

#auto_delete_afterObject

Date and time calculated using auto_delete_days after which a finished document (signed/cancelled/declined) will be automatically deleted



86
87
88
# File 'lib/signrequest_client/models/document.rb', line 86

def auto_delete_after
  @auto_delete_after
end

#auto_delete_daysObject

Number of days after which a finished document (signed/cancelled/declined) will be automatically deleted



62
63
64
# File 'lib/signrequest_client/models/document.rb', line 62

def auto_delete_days
  @auto_delete_days
end

#auto_expire_afterObject

Date and time calculated using auto_expire_days after which a non finished document will be automatically expired



92
93
94
# File 'lib/signrequest_client/models/document.rb', line 92

def auto_expire_after
  @auto_expire_after
end

#auto_expire_daysObject

Number of days after which a non finished document will be automatically expired



65
66
67
# File 'lib/signrequest_client/models/document.rb', line 65

def auto_expire_days
  @auto_expire_days
end

#events_callback_urlObject

URL at which to receive [event callbacks](#section/Events/Events-callback) for this document



44
45
46
# File 'lib/signrequest_client/models/document.rb', line 44

def events_callback_url
  @events_callback_url
end

#external_idObject

ID used to reference document in external system



32
33
34
# File 'lib/signrequest_client/models/document.rb', line 32

def external_id
  @external_id
end

#fileObject

Temporary URL to original file, expires in five minutes



38
39
40
# File 'lib/signrequest_client/models/document.rb', line 38

def file
  @file
end

#file_as_pdfObject

Temporary URL to original file as PDF, expires in five minutes



26
27
28
# File 'lib/signrequest_client/models/document.rb', line 26

def file_as_pdf
  @file_as_pdf
end

#file_from_contentObject

Base64 encoded document content



47
48
49
# File 'lib/signrequest_client/models/document.rb', line 47

def file_from_content
  @file_from_content
end

#file_from_content_nameObject

Filename, including extension. Required when using file_from_content.



50
51
52
# File 'lib/signrequest_client/models/document.rb', line 50

def file_from_content_name
  @file_from_content_name
end

#file_from_sfObject

Returns the value of attribute file_from_sf.



59
60
61
# File 'lib/signrequest_client/models/document.rb', line 59

def file_from_sf
  @file_from_sf
end

#file_from_urlObject

Publicly accessible URL of document to be downloaded by SignRequest



41
42
43
# File 'lib/signrequest_client/models/document.rb', line 41

def file_from_url
  @file_from_url
end

#frontend_idObject

Shared secret used in conjunction with <a href="#section/Frontend-API/SignRequest-js-client-(beta)">SignRequest-js client</a> to grant user access to a document that’s not a member of the document’s team



35
36
37
# File 'lib/signrequest_client/models/document.rb', line 35

def frontend_id
  @frontend_id
end

#integrationsObject

Returns the value of attribute integrations.



57
58
59
# File 'lib/signrequest_client/models/document.rb', line 57

def integrations
  @integrations
end

#nameObject

Defaults to filename, including extension



29
30
31
# File 'lib/signrequest_client/models/document.rb', line 29

def name
  @name
end

#pdfObject

Temporary URL to signed document as PDF, expires in five minutes



68
69
70
# File 'lib/signrequest_client/models/document.rb', line 68

def pdf
  @pdf
end

#prefill_tagsObject

Prefill signer input data, see [prefill tags](#section/Preparing-a-document/Prefill-tags-templates)



55
56
57
# File 'lib/signrequest_client/models/document.rb', line 55

def prefill_tags
  @prefill_tags
end

#processingObject

Indicates whether a change to the document is processing and the PDF may be out of date. It is recommended to wait until processing has finished before downloading the PDF. Webhooks are not sent until processing has been completed.



95
96
97
# File 'lib/signrequest_client/models/document.rb', line 95

def processing
  @processing
end

#sandboxObject

Indicates whether document was created as part of a sandbox team



89
90
91
# File 'lib/signrequest_client/models/document.rb', line 89

def sandbox
  @sandbox
end

#security_hashObject

SHA256 hash of PDF contents



81
82
83
# File 'lib/signrequest_client/models/document.rb', line 81

def security_hash
  @security_hash
end

#signing_logObject

Returns the value of attribute signing_log.



78
79
80
# File 'lib/signrequest_client/models/document.rb', line 78

def signing_log
  @signing_log
end

#signrequestObject

Returns the value of attribute signrequest.



73
74
75
# File 'lib/signrequest_client/models/document.rb', line 73

def signrequest
  @signrequest
end

#statusObject

co: converting, ne: new, se: sent, vi: viewed, si: signed, do: downloaded, sd: signed and downloaded, ca: cancelled, de: declined, ec: error converting, es: error sending, xp: expired



71
72
73
# File 'lib/signrequest_client/models/document.rb', line 71

def status
  @status
end

#teamObject

Returns the value of attribute team.



19
20
21
# File 'lib/signrequest_client/models/document.rb', line 19

def team
  @team
end

#templateObject

Returns the value of attribute template.



52
53
54
# File 'lib/signrequest_client/models/document.rb', line 52

def template
  @template
end

#urlObject

Returns the value of attribute url.



17
18
19
# File 'lib/signrequest_client/models/document.rb', line 17

def url
  @url
end

#userObject

Returns the value of attribute user.



23
24
25
# File 'lib/signrequest_client/models/document.rb', line 23

def user
  @user
end

#uuidObject

Returns the value of attribute uuid.



21
22
23
# File 'lib/signrequest_client/models/document.rb', line 21

def uuid
  @uuid
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/signrequest_client/models/document.rb', line 120

def self.attribute_map
  {
    :'url' => :'url',
    :'team' => :'team',
    :'uuid' => :'uuid',
    :'user' => :'user',
    :'file_as_pdf' => :'file_as_pdf',
    :'name' => :'name',
    :'external_id' => :'external_id',
    :'frontend_id' => :'frontend_id',
    :'file' => :'file',
    :'file_from_url' => :'file_from_url',
    :'events_callback_url' => :'events_callback_url',
    :'file_from_content' => :'file_from_content',
    :'file_from_content_name' => :'file_from_content_name',
    :'template' => :'template',
    :'prefill_tags' => :'prefill_tags',
    :'integrations' => :'integrations',
    :'file_from_sf' => :'file_from_sf',
    :'auto_delete_days' => :'auto_delete_days',
    :'auto_expire_days' => :'auto_expire_days',
    :'pdf' => :'pdf',
    :'status' => :'status',
    :'signrequest' => :'signrequest',
    :'api_used' => :'api_used',
    :'signing_log' => :'signing_log',
    :'security_hash' => :'security_hash',
    :'attachments' => :'attachments',
    :'auto_delete_after' => :'auto_delete_after',
    :'sandbox' => :'sandbox',
    :'auto_expire_after' => :'auto_expire_after',
    :'processing' => :'processing'
  }
end

.swagger_typesObject

Attribute type mapping.



156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/signrequest_client/models/document.rb', line 156

def self.swagger_types
  {
    :'url' => :'String',
    :'team' => :'DocumentTeam',
    :'uuid' => :'String',
    :'user' => :'User',
    :'file_as_pdf' => :'String',
    :'name' => :'String',
    :'external_id' => :'String',
    :'frontend_id' => :'String',
    :'file' => :'String',
    :'file_from_url' => :'String',
    :'events_callback_url' => :'String',
    :'file_from_content' => :'String',
    :'file_from_content_name' => :'String',
    :'template' => :'String',
    :'prefill_tags' => :'Array<InlinePrefillTags>',
    :'integrations' => :'Array<InlineIntegrationData>',
    :'file_from_sf' => :'FileFromSf',
    :'auto_delete_days' => :'Integer',
    :'auto_expire_days' => :'Integer',
    :'pdf' => :'String',
    :'status' => :'String',
    :'signrequest' => :'DocumentSignrequest',
    :'api_used' => :'BOOLEAN',
    :'signing_log' => :'DocumentSigningLog',
    :'security_hash' => :'String',
    :'attachments' => :'Array<DocumentAttachment>',
    :'auto_delete_after' => :'DateTime',
    :'sandbox' => :'BOOLEAN',
    :'auto_expire_after' => :'DateTime',
    :'processing' => :'BOOLEAN'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
# File 'lib/signrequest_client/models/document.rb', line 521

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      url == o.url &&
      team == o.team &&
      uuid == o.uuid &&
      user == o.user &&
      file_as_pdf == o.file_as_pdf &&
      name == o.name &&
      external_id == o.external_id &&
      frontend_id == o.frontend_id &&
      file == o.file &&
      file_from_url == o.file_from_url &&
      events_callback_url == o.events_callback_url &&
      file_from_content == o.file_from_content &&
      file_from_content_name == o.file_from_content_name &&
      template == o.template &&
      prefill_tags == o.prefill_tags &&
      integrations == o.integrations &&
      file_from_sf == o.file_from_sf &&
      auto_delete_days == o.auto_delete_days &&
      auto_expire_days == o.auto_expire_days &&
      pdf == o.pdf &&
      status == o.status &&
      signrequest == o.signrequest &&
      api_used == o.api_used &&
      signing_log == o.signing_log &&
      security_hash == o.security_hash &&
      attachments == o.attachments &&
      auto_delete_after == o.auto_delete_after &&
      sandbox == o.sandbox &&
      auto_expire_after == o.auto_expire_after &&
      processing == o.processing
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
# File 'lib/signrequest_client/models/document.rb', line 592

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    temp_model = SignRequestClient.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



658
659
660
661
662
663
664
665
666
667
668
669
670
# File 'lib/signrequest_client/models/document.rb', line 658

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
# File 'lib/signrequest_client/models/document.rb', line 571

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


558
559
560
# File 'lib/signrequest_client/models/document.rb', line 558

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



564
565
566
# File 'lib/signrequest_client/models/document.rb', line 564

def hash
  [url, team, uuid, user, file_as_pdf, name, external_id, frontend_id, file, file_from_url, events_callback_url, file_from_content, file_from_content_name, template, prefill_tags, integrations, file_from_sf, auto_delete_days, auto_expire_days, pdf, status, signrequest, api_used, signing_log, security_hash, attachments, auto_delete_after, sandbox, auto_expire_after, processing].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
# File 'lib/signrequest_client/models/document.rb', line 328

def list_invalid_properties
  invalid_properties = Array.new
  if !@uuid.nil? && @uuid.to_s.length < 1
    invalid_properties.push('invalid value for "uuid", the character length must be great than or equal to 1.')
  end

  if !@file_as_pdf.nil? && @file_as_pdf.to_s.length < 1
    invalid_properties.push('invalid value for "file_as_pdf", the character length must be great than or equal to 1.')
  end

  if !@name.nil? && @name.to_s.length > 255
    invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 255.')
  end

  if !@external_id.nil? && @external_id.to_s.length > 255
    invalid_properties.push('invalid value for "external_id", the character length must be smaller than or equal to 255.')
  end

  if !@frontend_id.nil? && @frontend_id.to_s.length > 255
    invalid_properties.push('invalid value for "frontend_id", the character length must be smaller than or equal to 255.')
  end

  if !@file_from_url.nil? && @file_from_url.to_s.length > 2100
    invalid_properties.push('invalid value for "file_from_url", the character length must be smaller than or equal to 2100.')
  end

  if !@events_callback_url.nil? && @events_callback_url.to_s.length > 2100
    invalid_properties.push('invalid value for "events_callback_url", the character length must be smaller than or equal to 2100.')
  end

  if !@auto_delete_days.nil? && @auto_delete_days > 730
    invalid_properties.push('invalid value for "auto_delete_days", must be smaller than or equal to 730.')
  end

  if !@auto_delete_days.nil? && @auto_delete_days < 1
    invalid_properties.push('invalid value for "auto_delete_days", must be greater than or equal to 1.')
  end

  if !@auto_expire_days.nil? && @auto_expire_days > 730
    invalid_properties.push('invalid value for "auto_expire_days", must be smaller than or equal to 730.')
  end

  if !@auto_expire_days.nil? && @auto_expire_days < 1
    invalid_properties.push('invalid value for "auto_expire_days", must be greater than or equal to 1.')
  end

  if !@security_hash.nil? && @security_hash.to_s.length < 1
    invalid_properties.push('invalid value for "security_hash", the character length must be great than or equal to 1.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



638
639
640
# File 'lib/signrequest_client/models/document.rb', line 638

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



644
645
646
647
648
649
650
651
652
# File 'lib/signrequest_client/models/document.rb', line 644

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



632
633
634
# File 'lib/signrequest_client/models/document.rb', line 632

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
# File 'lib/signrequest_client/models/document.rb', line 383

def valid?
  return false if !@uuid.nil? && @uuid.to_s.length < 1
  return false if !@file_as_pdf.nil? && @file_as_pdf.to_s.length < 1
  return false if !@name.nil? && @name.to_s.length > 255
  return false if !@external_id.nil? && @external_id.to_s.length > 255
  return false if !@frontend_id.nil? && @frontend_id.to_s.length > 255
  return false if !@file_from_url.nil? && @file_from_url.to_s.length > 2100
  return false if !@events_callback_url.nil? && @events_callback_url.to_s.length > 2100
  return false if !@auto_delete_days.nil? && @auto_delete_days > 730
  return false if !@auto_delete_days.nil? && @auto_delete_days < 1
  return false if !@auto_expire_days.nil? && @auto_expire_days > 730
  return false if !@auto_expire_days.nil? && @auto_expire_days < 1
  status_validator = EnumAttributeValidator.new('String', ['co', 'ne', 'se', 'vi', 'si', 'do', 'sd', 'ca', 'de', 'ec', 'es', 'xp'])
  return false unless status_validator.valid?(@status)
  return false if !@security_hash.nil? && @security_hash.to_s.length < 1
  true
end