Class: DocSpring::Template1

Inherits:
Object
  • Object
show all
Defined in:
lib/docspring/models/template1.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Template1

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
325
326
327
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
# File 'lib/docspring/models/template1.rb', line 209

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?(:'document_processed')
    self.document_processed = attributes[:'document_processed']
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#allow_additional_propertiesObject

Returns the value of attribute allow_additional_properties.



63
64
65
# File 'lib/docspring/models/template1.rb', line 63

def allow_additional_properties
  @allow_additional_properties
end

#defaultsObject

Returns the value of attribute defaults.



75
76
77
# File 'lib/docspring/models/template1.rb', line 75

def defaults
  @defaults
end

#demoObject

Returns the value of attribute demo.



31
32
33
# File 'lib/docspring/models/template1.rb', line 31

def demo
  @demo
end

#descriptionObject

Returns the value of attribute description.



27
28
29
# File 'lib/docspring/models/template1.rb', line 27

def description
  @description
end

#document_filenameObject

Returns the value of attribute document_filename.



89
90
91
# File 'lib/docspring/models/template1.rb', line 89

def document_filename
  @document_filename
end

#document_md5Object

Returns the value of attribute document_md5.



71
72
73
# File 'lib/docspring/models/template1.rb', line 71

def document_md5
  @document_md5
end

#document_parse_errorObject

Returns the value of attribute document_parse_error.



85
86
87
# File 'lib/docspring/models/template1.rb', line 85

def document_parse_error
  @document_parse_error
end

#document_processedObject

Returns the value of attribute document_processed.



17
18
19
# File 'lib/docspring/models/template1.rb', line 17

def document_processed
  @document_processed
end

#document_stateObject

Returns the value of attribute document_state.



23
24
25
# File 'lib/docspring/models/template1.rb', line 23

def document_state
  @document_state
end

#document_urlObject

Returns the value of attribute document_url.



93
94
95
# File 'lib/docspring/models/template1.rb', line 93

def document_url
  @document_url
end

#editable_submissionsObject

Returns the value of attribute editable_submissions.



77
78
79
# File 'lib/docspring/models/template1.rb', line 77

def editable_submissions
  @editable_submissions
end

#embed_domainsObject

Returns the value of attribute embed_domains.



59
60
61
# File 'lib/docspring/models/template1.rb', line 59

def embed_domains
  @embed_domains
end

#encrypt_pdfsObject

Returns the value of attribute encrypt_pdfs.



55
56
57
# File 'lib/docspring/models/template1.rb', line 55

def encrypt_pdfs
  @encrypt_pdfs
end

#encrypt_pdfs_passwordObject

Returns the value of attribute encrypt_pdfs_password.



65
66
67
# File 'lib/docspring/models/template1.rb', line 65

def encrypt_pdfs_password
  @encrypt_pdfs_password
end

#expiration_intervalObject

Returns the value of attribute expiration_interval.



19
20
21
# File 'lib/docspring/models/template1.rb', line 19

def expiration_interval
  @expiration_interval
end

#expire_afterObject

Returns the value of attribute expire_after.



25
26
27
# File 'lib/docspring/models/template1.rb', line 25

def expire_after
  @expire_after
end

#expire_submissionsObject

Returns the value of attribute expire_submissions.



79
80
81
# File 'lib/docspring/models/template1.rb', line 79

def expire_submissions
  @expire_submissions
end

#field_orderObject

Returns the value of attribute field_order.



39
40
41
# File 'lib/docspring/models/template1.rb', line 39

def field_order
  @field_order
end

#fieldsObject

Returns the value of attribute fields.



87
88
89
# File 'lib/docspring/models/template1.rb', line 87

def fields
  @fields
end

#first_templateObject

Returns the value of attribute first_template.



73
74
75
# File 'lib/docspring/models/template1.rb', line 73

def first_template
  @first_template
end

Returns the value of attribute footer_html.



83
84
85
# File 'lib/docspring/models/template1.rb', line 83

def footer_html
  @footer_html
end

#header_htmlObject

Returns the value of attribute header_html.



35
36
37
# File 'lib/docspring/models/template1.rb', line 35

def header_html
  @header_html
end

#htmlObject

Returns the value of attribute html.



43
44
45
# File 'lib/docspring/models/template1.rb', line 43

def html
  @html
end

#idObject

Returns the value of attribute id.



47
48
49
# File 'lib/docspring/models/template1.rb', line 47

def id
  @id
end

#lockedObject

Returns the value of attribute locked.



51
52
53
# File 'lib/docspring/models/template1.rb', line 51

def locked
  @locked
end

#nameObject

Returns the value of attribute name.



81
82
83
# File 'lib/docspring/models/template1.rb', line 81

def name
  @name
end

#page_countObject

Returns the value of attribute page_count.



53
54
55
# File 'lib/docspring/models/template1.rb', line 53

def page_count
  @page_count
end

#page_dimensionsObject

Returns the value of attribute page_dimensions.



49
50
51
# File 'lib/docspring/models/template1.rb', line 49

def page_dimensions
  @page_dimensions
end

#parent_folder_idObject

Returns the value of attribute parent_folder_id.



61
62
63
# File 'lib/docspring/models/template1.rb', line 61

def parent_folder_id
  @parent_folder_id
end

#pathObject

Returns the value of attribute path.



33
34
35
# File 'lib/docspring/models/template1.rb', line 33

def path
  @path
end

#permanent_document_urlObject

Returns the value of attribute permanent_document_url.



41
42
43
# File 'lib/docspring/models/template1.rb', line 41

def permanent_document_url
  @permanent_document_url
end

#public_submissionsObject

Returns the value of attribute public_submissions.



67
68
69
# File 'lib/docspring/models/template1.rb', line 67

def public_submissions
  @public_submissions
end

#public_web_formObject

Returns the value of attribute public_web_form.



37
38
39
# File 'lib/docspring/models/template1.rb', line 37

def public_web_form
  @public_web_form
end

#redirect_urlObject

Returns the value of attribute redirect_url.



91
92
93
# File 'lib/docspring/models/template1.rb', line 91

def redirect_url
  @redirect_url
end

#scssObject

Returns the value of attribute scss.



21
22
23
# File 'lib/docspring/models/template1.rb', line 21

def scss
  @scss
end

#shared_field_dataObject

Returns the value of attribute shared_field_data.



69
70
71
# File 'lib/docspring/models/template1.rb', line 69

def shared_field_data
  @shared_field_data
end

#slack_webhook_urlObject

Returns the value of attribute slack_webhook_url.



29
30
31
# File 'lib/docspring/models/template1.rb', line 29

def slack_webhook_url
  @slack_webhook_url
end

#template_typeObject

Returns the value of attribute template_type.



45
46
47
# File 'lib/docspring/models/template1.rb', line 45

def template_type
  @template_type
end

#webhook_urlObject

Returns the value of attribute webhook_url.



57
58
59
# File 'lib/docspring/models/template1.rb', line 57

def webhook_url
  @webhook_url
end

Class Method Details

.attribute_mapObject

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



118
119
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
154
155
156
157
158
159
160
# File 'lib/docspring/models/template1.rb', line 118

def self.attribute_map
  {
    :'document_processed' => :'document_processed',
    :'expiration_interval' => :'expiration_interval',
    :'scss' => :'scss',
    :'document_state' => :'document_state',
    :'expire_after' => :'expire_after',
    :'description' => :'description',
    :'slack_webhook_url' => :'slack_webhook_url',
    :'demo' => :'demo',
    :'path' => :'path',
    :'header_html' => :'header_html',
    :'public_web_form' => :'public_web_form',
    :'field_order' => :'field_order',
    :'permanent_document_url' => :'permanent_document_url',
    :'html' => :'html',
    :'template_type' => :'template_type',
    :'id' => :'id',
    :'page_dimensions' => :'page_dimensions',
    :'locked' => :'locked',
    :'page_count' => :'page_count',
    :'encrypt_pdfs' => :'encrypt_pdfs',
    :'webhook_url' => :'webhook_url',
    :'embed_domains' => :'embed_domains',
    :'parent_folder_id' => :'parent_folder_id',
    :'allow_additional_properties' => :'allow_additional_properties',
    :'encrypt_pdfs_password' => :'encrypt_pdfs_password',
    :'public_submissions' => :'public_submissions',
    :'shared_field_data' => :'shared_field_data',
    :'document_md5' => :'document_md5',
    :'first_template' => :'first_template',
    :'defaults' => :'defaults',
    :'editable_submissions' => :'editable_submissions',
    :'expire_submissions' => :'expire_submissions',
    :'name' => :'name',
    :'footer_html' => :'footer_html',
    :'document_parse_error' => :'document_parse_error',
    :'fields' => :'fields',
    :'document_filename' => :'document_filename',
    :'redirect_url' => :'redirect_url',
    :'document_url' => :'document_url'
  }
end

.openapi_typesObject

Attribute type mapping.



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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/docspring/models/template1.rb', line 163

def self.openapi_types
  {
    :'document_processed' => :'BOOLEAN',
    :'expiration_interval' => :'String',
    :'scss' => :'String',
    :'document_state' => :'String',
    :'expire_after' => :'Float',
    :'description' => :'String',
    :'slack_webhook_url' => :'String',
    :'demo' => :'BOOLEAN',
    :'path' => :'String',
    :'header_html' => :'String',
    :'public_web_form' => :'BOOLEAN',
    :'field_order' => :'Array<Array<Float>>',
    :'permanent_document_url' => :'String',
    :'html' => :'String',
    :'template_type' => :'String',
    :'id' => :'String',
    :'page_dimensions' => :'Array<Array<Float>>',
    :'locked' => :'BOOLEAN',
    :'page_count' => :'Float',
    :'encrypt_pdfs' => :'BOOLEAN',
    :'webhook_url' => :'String',
    :'embed_domains' => :'Array<String>',
    :'parent_folder_id' => :'String',
    :'allow_additional_properties' => :'BOOLEAN',
    :'encrypt_pdfs_password' => :'String',
    :'public_submissions' => :'BOOLEAN',
    :'shared_field_data' => :'Object',
    :'document_md5' => :'String',
    :'first_template' => :'BOOLEAN',
    :'defaults' => :'Template1Defaults',
    :'editable_submissions' => :'BOOLEAN',
    :'expire_submissions' => :'BOOLEAN',
    :'name' => :'String',
    :'footer_html' => :'String',
    :'document_parse_error' => :'BOOLEAN',
    :'fields' => :'Object',
    :'document_filename' => :'String',
    :'redirect_url' => :'String',
    :'document_url' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
# File 'lib/docspring/models/template1.rb', line 405

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      document_processed == o.document_processed &&
      expiration_interval == o.expiration_interval &&
      scss == o.scss &&
      document_state == o.document_state &&
      expire_after == o.expire_after &&
      description == o.description &&
      slack_webhook_url == o.slack_webhook_url &&
      demo == o.demo &&
      path == o.path &&
      header_html == o.header_html &&
      public_web_form == o.public_web_form &&
      field_order == o.field_order &&
      permanent_document_url == o.permanent_document_url &&
      html == o.html &&
      template_type == o.template_type &&
      id == o.id &&
      page_dimensions == o.page_dimensions &&
      locked == o.locked &&
      page_count == o.page_count &&
      encrypt_pdfs == o.encrypt_pdfs &&
      webhook_url == o.webhook_url &&
      embed_domains == o.embed_domains &&
      parent_folder_id == o.parent_folder_id &&
      allow_additional_properties == o.allow_additional_properties &&
      encrypt_pdfs_password == o.encrypt_pdfs_password &&
      public_submissions == o.public_submissions &&
      shared_field_data == o.shared_field_data &&
      document_md5 == o.document_md5 &&
      first_template == o.first_template &&
      defaults == o.defaults &&
      editable_submissions == o.editable_submissions &&
      expire_submissions == o.expire_submissions &&
      name == o.name &&
      footer_html == o.footer_html &&
      document_parse_error == o.document_parse_error &&
      fields == o.fields &&
      document_filename == o.document_filename &&
      redirect_url == o.redirect_url &&
      document_url == o.document_url
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



485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
# File 'lib/docspring/models/template1.rb', line 485

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 = DocSpring.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



551
552
553
554
555
556
557
558
559
560
561
562
563
# File 'lib/docspring/models/template1.rb', line 551

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



464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
# File 'lib/docspring/models/template1.rb', line 464

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.openapi_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


451
452
453
# File 'lib/docspring/models/template1.rb', line 451

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



457
458
459
# File 'lib/docspring/models/template1.rb', line 457

def hash
  [document_processed, expiration_interval, scss, document_state, expire_after, description, slack_webhook_url, demo, path, header_html, public_web_form, field_order, permanent_document_url, html, template_type, id, page_dimensions, locked, page_count, encrypt_pdfs, webhook_url, embed_domains, parent_folder_id, allow_additional_properties, encrypt_pdfs_password, public_submissions, shared_field_data, document_md5, first_template, defaults, editable_submissions, expire_submissions, name, footer_html, document_parse_error, fields, document_filename, redirect_url, document_url].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



380
381
382
383
# File 'lib/docspring/models/template1.rb', line 380

def list_invalid_properties
  invalid_properties = Array.new
  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



531
532
533
# File 'lib/docspring/models/template1.rb', line 531

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



537
538
539
540
541
542
543
544
545
# File 'lib/docspring/models/template1.rb', line 537

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



525
526
527
# File 'lib/docspring/models/template1.rb', line 525

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



387
388
389
390
391
# File 'lib/docspring/models/template1.rb', line 387

def valid?
  expiration_interval_validator = EnumAttributeValidator.new('String', ['minutes', 'hours', 'days'])
  return false unless expiration_interval_validator.valid?(@expiration_interval)
  true
end