docspring 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/Gemfile.lock +1 -1
  4. data/README.md +20 -15
  5. data/docs/AddFieldsData.md +8 -0
  6. data/docs/AddFieldsTemplateResponse.md +10 -0
  7. data/docs/CreateHtmlTemplateData.md +8 -0
  8. data/docs/CreateTemplateFromUploadData.md +8 -0
  9. data/docs/{TemplatesdesccachedUploadTemplate.md → HtmlTemplateData.md} +1 -2
  10. data/docs/PDFApi.md +60 -8
  11. data/docs/PendingTemplate.md +1 -0
  12. data/docs/Submission.md +1 -0
  13. data/docs/Template.md +1 -0
  14. data/docs/{TemplatestemplateIdTemplate.md → TemplateData.md} +1 -1
  15. data/docs/TemplatestemplateIdaddFieldsFields.md +92 -0
  16. data/docs/UpdateTemplateData.md +1 -1
  17. data/docs/UploadTemplateData.md +25 -0
  18. data/docs/UploadTemplateDataDocument.md +10 -0
  19. data/docs/{TemplatesdesccachedUploadTemplateDocumentMetadata.md → UploadTemplateDataDocumentMetadata.md} +1 -1
  20. data/lib/docspring.rb +10 -6
  21. data/lib/docspring/api/pdf_api.rb +77 -18
  22. data/lib/docspring/models/add_fields_data.rb +190 -0
  23. data/lib/docspring/models/add_fields_template_response.rb +239 -0
  24. data/lib/docspring/models/{create_template_data.rb → create_html_template_data.rb} +2 -2
  25. data/lib/docspring/models/{create_template_data1.rb → create_template_from_upload_data.rb} +2 -2
  26. data/lib/docspring/models/html_template_data.rb +373 -0
  27. data/lib/docspring/models/pending_template.rb +10 -1
  28. data/lib/docspring/models/submission.rb +10 -1
  29. data/lib/docspring/models/template.rb +10 -1
  30. data/lib/docspring/models/{templatestemplate_id_template.rb → template_data.rb} +1 -1
  31. data/lib/docspring/models/templatestemplate_idadd_fields_fields.rb +1306 -0
  32. data/lib/docspring/models/update_template_data.rb +1 -1
  33. data/lib/docspring/models/{templatesdesccached_upload_template.rb → upload_template_data.rb} +2 -2
  34. data/lib/docspring/models/{templatesdesccached_upload_template_document.rb → upload_template_data_document.rb} +2 -2
  35. data/lib/docspring/models/{templatesdesccached_upload_template_document_metadata.rb → upload_template_data_document_metadata.rb} +1 -1
  36. data/lib/docspring/version.rb +1 -1
  37. data/spec/api/pdf_api_integration_spec.rb +49 -18
  38. data/spec/api/pdf_api_spec_original.skipped.rb +20 -6
  39. data/spec/models/add_fields_data_spec.rb +41 -0
  40. data/spec/models/add_fields_template_response_spec.rb +57 -0
  41. data/spec/models/{create_template_data_spec.rb → create_html_template_data_spec.rb} +6 -6
  42. data/spec/models/{create_template_data1_spec.rb → create_template_from_upload_data_spec.rb} +6 -6
  43. data/spec/models/html_template_data_spec.rb +145 -0
  44. data/spec/models/pending_template_spec.rb +6 -0
  45. data/spec/models/submission_spec.rb +6 -0
  46. data/spec/models/{templatestemplate_id_template_spec.rb → template_data_spec.rb} +6 -6
  47. data/spec/models/template_spec.rb +6 -0
  48. data/spec/models/templatestemplate_idadd_fields_fields_spec.rb +589 -0
  49. data/spec/models/{templatesdesccached_upload_template_document_metadata_spec.rb → upload_template_data_document_metadata_spec.rb} +6 -6
  50. data/spec/models/{templatesdesccached_upload_template_document_spec.rb → upload_template_data_document_spec.rb} +6 -6
  51. data/spec/models/{templatesdesccached_upload_template_spec.rb → upload_template_data_spec.rb} +6 -6
  52. metadata +42 -26
  53. data/docs/CreateTemplateData.md +0 -8
  54. data/docs/CreateTemplateData1.md +0 -8
  55. data/docs/TemplatesdesccachedUploadTemplateDocument.md +0 -10
@@ -13,7 +13,7 @@ OpenAPI Generator version: 3.3.0-SNAPSHOT
13
13
  require 'date'
14
14
 
15
15
  module DocSpring
16
- class CreateTemplateData
16
+ class CreateHtmlTemplateData
17
17
  attr_accessor :template
18
18
 
19
19
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -26,7 +26,7 @@ module DocSpring
26
26
  # Attribute type mapping.
27
27
  def self.openapi_types
28
28
  {
29
- :'template' => :'TemplatesdesccachedUploadTemplate'
29
+ :'template' => :'HtmlTemplateData'
30
30
  }
31
31
  end
32
32
 
@@ -13,7 +13,7 @@ OpenAPI Generator version: 3.3.0-SNAPSHOT
13
13
  require 'date'
14
14
 
15
15
  module DocSpring
16
- class CreateTemplateData1
16
+ class CreateTemplateFromUploadData
17
17
  attr_accessor :template
18
18
 
19
19
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -26,7 +26,7 @@ module DocSpring
26
26
  # Attribute type mapping.
27
27
  def self.openapi_types
28
28
  {
29
- :'template' => :'TemplatesdesccachedUploadTemplate'
29
+ :'template' => :'UploadTemplateData'
30
30
  }
31
31
  end
32
32
 
@@ -0,0 +1,373 @@
1
+ =begin
2
+ #API v1
3
+
4
+ #DocSpring is a service that helps you fill out and sign PDF templates.
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 3.3.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module DocSpring
16
+ class HtmlTemplateData
17
+ attr_accessor :expiration_interval
18
+
19
+ attr_accessor :webhook_url
20
+
21
+ attr_accessor :scss
22
+
23
+ attr_accessor :expire_after
24
+
25
+ attr_accessor :allow_additional_properties
26
+
27
+ attr_accessor :description
28
+
29
+ attr_accessor :public_submissions
30
+
31
+ attr_accessor :slack_webhook_url
32
+
33
+ attr_accessor :header_html
34
+
35
+ attr_accessor :public_web_form
36
+
37
+ attr_accessor :editable_submissions
38
+
39
+ attr_accessor :expire_submissions
40
+
41
+ attr_accessor :name
42
+
43
+ attr_accessor :html
44
+
45
+ attr_accessor :footer_html
46
+
47
+ attr_accessor :template_type
48
+
49
+ attr_accessor :redirect_url
50
+
51
+ class EnumAttributeValidator
52
+ attr_reader :datatype
53
+ attr_reader :allowable_values
54
+
55
+ def initialize(datatype, allowable_values)
56
+ @allowable_values = allowable_values.map do |value|
57
+ case datatype.to_s
58
+ when /Integer/i
59
+ value.to_i
60
+ when /Float/i
61
+ value.to_f
62
+ else
63
+ value
64
+ end
65
+ end
66
+ end
67
+
68
+ def valid?(value)
69
+ !value || allowable_values.include?(value)
70
+ end
71
+ end
72
+
73
+ # Attribute mapping from ruby-style variable name to JSON key.
74
+ def self.attribute_map
75
+ {
76
+ :'expiration_interval' => :'expiration_interval',
77
+ :'webhook_url' => :'webhook_url',
78
+ :'scss' => :'scss',
79
+ :'expire_after' => :'expire_after',
80
+ :'allow_additional_properties' => :'allow_additional_properties',
81
+ :'description' => :'description',
82
+ :'public_submissions' => :'public_submissions',
83
+ :'slack_webhook_url' => :'slack_webhook_url',
84
+ :'header_html' => :'header_html',
85
+ :'public_web_form' => :'public_web_form',
86
+ :'editable_submissions' => :'editable_submissions',
87
+ :'expire_submissions' => :'expire_submissions',
88
+ :'name' => :'name',
89
+ :'html' => :'html',
90
+ :'footer_html' => :'footer_html',
91
+ :'template_type' => :'template_type',
92
+ :'redirect_url' => :'redirect_url'
93
+ }
94
+ end
95
+
96
+ # Attribute type mapping.
97
+ def self.openapi_types
98
+ {
99
+ :'expiration_interval' => :'String',
100
+ :'webhook_url' => :'String',
101
+ :'scss' => :'String',
102
+ :'expire_after' => :'Float',
103
+ :'allow_additional_properties' => :'BOOLEAN',
104
+ :'description' => :'String',
105
+ :'public_submissions' => :'BOOLEAN',
106
+ :'slack_webhook_url' => :'String',
107
+ :'header_html' => :'String',
108
+ :'public_web_form' => :'BOOLEAN',
109
+ :'editable_submissions' => :'BOOLEAN',
110
+ :'expire_submissions' => :'BOOLEAN',
111
+ :'name' => :'String',
112
+ :'html' => :'String',
113
+ :'footer_html' => :'String',
114
+ :'template_type' => :'String',
115
+ :'redirect_url' => :'String'
116
+ }
117
+ end
118
+
119
+ # Initializes the object
120
+ # @param [Hash] attributes Model attributes in the form of hash
121
+ def initialize(attributes = {})
122
+ return unless attributes.is_a?(Hash)
123
+
124
+ # convert string to symbol for hash key
125
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
126
+
127
+ if attributes.has_key?(:'expiration_interval')
128
+ self.expiration_interval = attributes[:'expiration_interval']
129
+ end
130
+
131
+ if attributes.has_key?(:'webhook_url')
132
+ self.webhook_url = attributes[:'webhook_url']
133
+ end
134
+
135
+ if attributes.has_key?(:'scss')
136
+ self.scss = attributes[:'scss']
137
+ end
138
+
139
+ if attributes.has_key?(:'expire_after')
140
+ self.expire_after = attributes[:'expire_after']
141
+ end
142
+
143
+ if attributes.has_key?(:'allow_additional_properties')
144
+ self.allow_additional_properties = attributes[:'allow_additional_properties']
145
+ end
146
+
147
+ if attributes.has_key?(:'description')
148
+ self.description = attributes[:'description']
149
+ end
150
+
151
+ if attributes.has_key?(:'public_submissions')
152
+ self.public_submissions = attributes[:'public_submissions']
153
+ end
154
+
155
+ if attributes.has_key?(:'slack_webhook_url')
156
+ self.slack_webhook_url = attributes[:'slack_webhook_url']
157
+ end
158
+
159
+ if attributes.has_key?(:'header_html')
160
+ self.header_html = attributes[:'header_html']
161
+ end
162
+
163
+ if attributes.has_key?(:'public_web_form')
164
+ self.public_web_form = attributes[:'public_web_form']
165
+ end
166
+
167
+ if attributes.has_key?(:'editable_submissions')
168
+ self.editable_submissions = attributes[:'editable_submissions']
169
+ end
170
+
171
+ if attributes.has_key?(:'expire_submissions')
172
+ self.expire_submissions = attributes[:'expire_submissions']
173
+ end
174
+
175
+ if attributes.has_key?(:'name')
176
+ self.name = attributes[:'name']
177
+ end
178
+
179
+ if attributes.has_key?(:'html')
180
+ self.html = attributes[:'html']
181
+ end
182
+
183
+ if attributes.has_key?(:'footer_html')
184
+ self.footer_html = attributes[:'footer_html']
185
+ end
186
+
187
+ if attributes.has_key?(:'template_type')
188
+ self.template_type = attributes[:'template_type']
189
+ end
190
+
191
+ if attributes.has_key?(:'redirect_url')
192
+ self.redirect_url = attributes[:'redirect_url']
193
+ end
194
+ end
195
+
196
+ # Show invalid properties with the reasons. Usually used together with valid?
197
+ # @return Array for valid properties with the reasons
198
+ def list_invalid_properties
199
+ invalid_properties = Array.new
200
+ invalid_properties
201
+ end
202
+
203
+ # Check to see if the all the properties in the model are valid
204
+ # @return true if the model is valid
205
+ def valid?
206
+ expiration_interval_validator = EnumAttributeValidator.new('String', ['minutes', 'hours', 'days'])
207
+ return false unless expiration_interval_validator.valid?(@expiration_interval)
208
+ template_type_validator = EnumAttributeValidator.new('String', ['pdf', 'html'])
209
+ return false unless template_type_validator.valid?(@template_type)
210
+ true
211
+ end
212
+
213
+ # Custom attribute writer method checking allowed values (enum).
214
+ # @param [Object] expiration_interval Object to be assigned
215
+ def expiration_interval=(expiration_interval)
216
+ validator = EnumAttributeValidator.new('String', ['minutes', 'hours', 'days'])
217
+ unless validator.valid?(expiration_interval)
218
+ fail ArgumentError, 'invalid value for "expiration_interval", must be one of #{validator.allowable_values}.'
219
+ end
220
+ @expiration_interval = expiration_interval
221
+ end
222
+
223
+ # Custom attribute writer method checking allowed values (enum).
224
+ # @param [Object] template_type Object to be assigned
225
+ def template_type=(template_type)
226
+ validator = EnumAttributeValidator.new('String', ['pdf', 'html'])
227
+ unless validator.valid?(template_type)
228
+ fail ArgumentError, 'invalid value for "template_type", must be one of #{validator.allowable_values}.'
229
+ end
230
+ @template_type = template_type
231
+ end
232
+
233
+ # Checks equality by comparing each attribute.
234
+ # @param [Object] Object to be compared
235
+ def ==(o)
236
+ return true if self.equal?(o)
237
+ self.class == o.class &&
238
+ expiration_interval == o.expiration_interval &&
239
+ webhook_url == o.webhook_url &&
240
+ scss == o.scss &&
241
+ expire_after == o.expire_after &&
242
+ allow_additional_properties == o.allow_additional_properties &&
243
+ description == o.description &&
244
+ public_submissions == o.public_submissions &&
245
+ slack_webhook_url == o.slack_webhook_url &&
246
+ header_html == o.header_html &&
247
+ public_web_form == o.public_web_form &&
248
+ editable_submissions == o.editable_submissions &&
249
+ expire_submissions == o.expire_submissions &&
250
+ name == o.name &&
251
+ html == o.html &&
252
+ footer_html == o.footer_html &&
253
+ template_type == o.template_type &&
254
+ redirect_url == o.redirect_url
255
+ end
256
+
257
+ # @see the `==` method
258
+ # @param [Object] Object to be compared
259
+ def eql?(o)
260
+ self == o
261
+ end
262
+
263
+ # Calculates hash code according to all attributes.
264
+ # @return [Fixnum] Hash code
265
+ def hash
266
+ [expiration_interval, webhook_url, scss, expire_after, allow_additional_properties, description, public_submissions, slack_webhook_url, header_html, public_web_form, editable_submissions, expire_submissions, name, html, footer_html, template_type, redirect_url].hash
267
+ end
268
+
269
+ # Builds the object from hash
270
+ # @param [Hash] attributes Model attributes in the form of hash
271
+ # @return [Object] Returns the model itself
272
+ def build_from_hash(attributes)
273
+ return nil unless attributes.is_a?(Hash)
274
+ self.class.openapi_types.each_pair do |key, type|
275
+ if type =~ /\AArray<(.*)>/i
276
+ # check to ensure the input is an array given that the the attribute
277
+ # is documented as an array but the input is not
278
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
279
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
280
+ end
281
+ elsif !attributes[self.class.attribute_map[key]].nil?
282
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
283
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
284
+ end
285
+
286
+ self
287
+ end
288
+
289
+ # Deserializes the data based on type
290
+ # @param string type Data type
291
+ # @param string value Value to be deserialized
292
+ # @return [Object] Deserialized data
293
+ def _deserialize(type, value)
294
+ case type.to_sym
295
+ when :DateTime
296
+ DateTime.parse(value)
297
+ when :Date
298
+ Date.parse(value)
299
+ when :String
300
+ value.to_s
301
+ when :Integer
302
+ value.to_i
303
+ when :Float
304
+ value.to_f
305
+ when :BOOLEAN
306
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
307
+ true
308
+ else
309
+ false
310
+ end
311
+ when :Object
312
+ # generic object (usually a Hash), return directly
313
+ value
314
+ when /\AArray<(?<inner_type>.+)>\z/
315
+ inner_type = Regexp.last_match[:inner_type]
316
+ value.map { |v| _deserialize(inner_type, v) }
317
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
318
+ k_type = Regexp.last_match[:k_type]
319
+ v_type = Regexp.last_match[:v_type]
320
+ {}.tap do |hash|
321
+ value.each do |k, v|
322
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
323
+ end
324
+ end
325
+ else # model
326
+ temp_model = DocSpring.const_get(type).new
327
+ temp_model.build_from_hash(value)
328
+ end
329
+ end
330
+
331
+ # Returns the string representation of the object
332
+ # @return [String] String presentation of the object
333
+ def to_s
334
+ to_hash.to_s
335
+ end
336
+
337
+ # to_body is an alias to to_hash (backward compatibility)
338
+ # @return [Hash] Returns the object in the form of hash
339
+ def to_body
340
+ to_hash
341
+ end
342
+
343
+ # Returns the object in the form of hash
344
+ # @return [Hash] Returns the object in the form of hash
345
+ def to_hash
346
+ hash = {}
347
+ self.class.attribute_map.each_pair do |attr, param|
348
+ value = self.send(attr)
349
+ next if value.nil?
350
+ hash[param] = _to_hash(value)
351
+ end
352
+ hash
353
+ end
354
+
355
+ # Outputs non-array value in the form of hash
356
+ # For object, use to_hash. Otherwise, just return the value
357
+ # @param [Object] value Any valid value
358
+ # @return [Hash] Returns the value in the form of hash
359
+ def _to_hash(value)
360
+ if value.is_a?(Array)
361
+ value.compact.map { |v| _to_hash(v) }
362
+ elsif value.is_a?(Hash)
363
+ {}.tap do |hash|
364
+ value.each { |k, v| hash[k] = _to_hash(v) }
365
+ end
366
+ elsif value.respond_to? :to_hash
367
+ value.to_hash
368
+ else
369
+ value
370
+ end
371
+ end
372
+ end
373
+ end
@@ -44,6 +44,8 @@ module DocSpring
44
44
 
45
45
  attr_accessor :id
46
46
 
47
+ attr_accessor :locked
48
+
47
49
  attr_accessor :redirect_url
48
50
 
49
51
  class EnumAttributeValidator
@@ -86,6 +88,7 @@ module DocSpring
86
88
  :'name' => :'name',
87
89
  :'template_type' => :'template_type',
88
90
  :'id' => :'id',
91
+ :'locked' => :'locked',
89
92
  :'redirect_url' => :'redirect_url'
90
93
  }
91
94
  end
@@ -108,6 +111,7 @@ module DocSpring
108
111
  :'name' => :'String',
109
112
  :'template_type' => :'String',
110
113
  :'id' => :'String',
114
+ :'locked' => :'BOOLEAN',
111
115
  :'redirect_url' => :'String'
112
116
  }
113
117
  end
@@ -180,6 +184,10 @@ module DocSpring
180
184
  self.id = attributes[:'id']
181
185
  end
182
186
 
187
+ if attributes.has_key?(:'locked')
188
+ self.locked = attributes[:'locked']
189
+ end
190
+
183
191
  if attributes.has_key?(:'redirect_url')
184
192
  self.redirect_url = attributes[:'redirect_url']
185
193
  end
@@ -230,6 +238,7 @@ module DocSpring
230
238
  name == o.name &&
231
239
  template_type == o.template_type &&
232
240
  id == o.id &&
241
+ locked == o.locked &&
233
242
  redirect_url == o.redirect_url
234
243
  end
235
244
 
@@ -242,7 +251,7 @@ module DocSpring
242
251
  # Calculates hash code according to all attributes.
243
252
  # @return [Fixnum] Hash code
244
253
  def hash
245
- [expiration_interval, webhook_url, parent_folder_id, expire_after, allow_additional_properties, description, public_submissions, slack_webhook_url, path, public_web_form, editable_submissions, expire_submissions, name, template_type, id, redirect_url].hash
254
+ [expiration_interval, webhook_url, parent_folder_id, expire_after, allow_additional_properties, description, public_submissions, slack_webhook_url, path, public_web_form, editable_submissions, expire_submissions, name, template_type, id, locked, redirect_url].hash
246
255
  end
247
256
 
248
257
  # Builds the object from hash