form_api 1.9.1 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,188 @@
1
+ =begin
2
+ #API v1
3
+
4
+ #FormAPI 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 FormAPI
16
+ class RenameFolderData
17
+ attr_accessor :name
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'name' => :'name'
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.openapi_types
28
+ {
29
+ :'name' => :'String'
30
+ }
31
+ end
32
+
33
+ # Initializes the object
34
+ # @param [Hash] attributes Model attributes in the form of hash
35
+ def initialize(attributes = {})
36
+ return unless attributes.is_a?(Hash)
37
+
38
+ # convert string to symbol for hash key
39
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
40
+
41
+ if attributes.has_key?(:'name')
42
+ self.name = attributes[:'name']
43
+ end
44
+ end
45
+
46
+ # Show invalid properties with the reasons. Usually used together with valid?
47
+ # @return Array for valid properties with the reasons
48
+ def list_invalid_properties
49
+ invalid_properties = Array.new
50
+ if @name.nil?
51
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
52
+ end
53
+
54
+ invalid_properties
55
+ end
56
+
57
+ # Check to see if the all the properties in the model are valid
58
+ # @return true if the model is valid
59
+ def valid?
60
+ return false if @name.nil?
61
+ true
62
+ end
63
+
64
+ # Checks equality by comparing each attribute.
65
+ # @param [Object] Object to be compared
66
+ def ==(o)
67
+ return true if self.equal?(o)
68
+ self.class == o.class &&
69
+ name == o.name
70
+ end
71
+
72
+ # @see the `==` method
73
+ # @param [Object] Object to be compared
74
+ def eql?(o)
75
+ self == o
76
+ end
77
+
78
+ # Calculates hash code according to all attributes.
79
+ # @return [Fixnum] Hash code
80
+ def hash
81
+ [name].hash
82
+ end
83
+
84
+ # Builds the object from hash
85
+ # @param [Hash] attributes Model attributes in the form of hash
86
+ # @return [Object] Returns the model itself
87
+ def build_from_hash(attributes)
88
+ return nil unless attributes.is_a?(Hash)
89
+ self.class.openapi_types.each_pair do |key, type|
90
+ if type =~ /\AArray<(.*)>/i
91
+ # check to ensure the input is an array given that the the attribute
92
+ # is documented as an array but the input is not
93
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
94
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
95
+ end
96
+ elsif !attributes[self.class.attribute_map[key]].nil?
97
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
98
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
99
+ end
100
+
101
+ self
102
+ end
103
+
104
+ # Deserializes the data based on type
105
+ # @param string type Data type
106
+ # @param string value Value to be deserialized
107
+ # @return [Object] Deserialized data
108
+ def _deserialize(type, value)
109
+ case type.to_sym
110
+ when :DateTime
111
+ DateTime.parse(value)
112
+ when :Date
113
+ Date.parse(value)
114
+ when :String
115
+ value.to_s
116
+ when :Integer
117
+ value.to_i
118
+ when :Float
119
+ value.to_f
120
+ when :BOOLEAN
121
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
122
+ true
123
+ else
124
+ false
125
+ end
126
+ when :Object
127
+ # generic object (usually a Hash), return directly
128
+ value
129
+ when /\AArray<(?<inner_type>.+)>\z/
130
+ inner_type = Regexp.last_match[:inner_type]
131
+ value.map { |v| _deserialize(inner_type, v) }
132
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
133
+ k_type = Regexp.last_match[:k_type]
134
+ v_type = Regexp.last_match[:v_type]
135
+ {}.tap do |hash|
136
+ value.each do |k, v|
137
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
138
+ end
139
+ end
140
+ else # model
141
+ temp_model = FormAPI.const_get(type).new
142
+ temp_model.build_from_hash(value)
143
+ end
144
+ end
145
+
146
+ # Returns the string representation of the object
147
+ # @return [String] String presentation of the object
148
+ def to_s
149
+ to_hash.to_s
150
+ end
151
+
152
+ # to_body is an alias to to_hash (backward compatibility)
153
+ # @return [Hash] Returns the object in the form of hash
154
+ def to_body
155
+ to_hash
156
+ end
157
+
158
+ # Returns the object in the form of hash
159
+ # @return [Hash] Returns the object in the form of hash
160
+ def to_hash
161
+ hash = {}
162
+ self.class.attribute_map.each_pair do |attr, param|
163
+ value = self.send(attr)
164
+ next if value.nil?
165
+ hash[param] = _to_hash(value)
166
+ end
167
+ hash
168
+ end
169
+
170
+ # Outputs non-array value in the form of hash
171
+ # For object, use to_hash. Otherwise, just return the value
172
+ # @param [Object] value Any valid value
173
+ # @return [Hash] Returns the value in the form of hash
174
+ def _to_hash(value)
175
+ if value.is_a?(Array)
176
+ value.compact.map { |v| _to_hash(v) }
177
+ elsif value.is_a?(Hash)
178
+ {}.tap do |hash|
179
+ value.each { |k, v| hash[k] = _to_hash(v) }
180
+ end
181
+ elsif value.respond_to? :to_hash
182
+ value.to_hash
183
+ else
184
+ value
185
+ end
186
+ end
187
+ end
188
+ end
@@ -195,7 +195,7 @@ module FormAPI
195
195
  return false if @test.nil?
196
196
  return false if @expired.nil?
197
197
  return false if @state.nil?
198
- state_validator = EnumAttributeValidator.new('String', ['pending', 'processed', 'invalid_data', 'error', 'image_download_failed', 'image_processing_failed', 'waiting_for_data_requests', 'liquid_syntax_error', 'account_suspended', 'license_revoked'])
198
+ state_validator = EnumAttributeValidator.new('String', ['pending', 'processed', 'invalid_data', 'error', 'image_download_failed', 'image_processing_failed', 'waiting_for_data_requests', 'syntax_error', 'account_suspended', 'license_revoked'])
199
199
  return false unless state_validator.valid?(@state)
200
200
  true
201
201
  end
@@ -203,7 +203,7 @@ module FormAPI
203
203
  # Custom attribute writer method checking allowed values (enum).
204
204
  # @param [Object] state Object to be assigned
205
205
  def state=(state)
206
- validator = EnumAttributeValidator.new('String', ['pending', 'processed', 'invalid_data', 'error', 'image_download_failed', 'image_processing_failed', 'waiting_for_data_requests', 'liquid_syntax_error', 'account_suspended', 'license_revoked'])
206
+ validator = EnumAttributeValidator.new('String', ['pending', 'processed', 'invalid_data', 'error', 'image_download_failed', 'image_processing_failed', 'waiting_for_data_requests', 'syntax_error', 'account_suspended', 'license_revoked'])
207
207
  unless validator.valid?(state)
208
208
  fail ArgumentError, 'invalid value for "state", must be one of #{validator.allowable_values}.'
209
209
  end
@@ -18,6 +18,8 @@ module FormAPI
18
18
 
19
19
  attr_accessor :webhook_url
20
20
 
21
+ attr_accessor :parent_folder_id
22
+
21
23
  attr_accessor :expire_after
22
24
 
23
25
  attr_accessor :allow_additional_properties
@@ -26,6 +28,8 @@ module FormAPI
26
28
 
27
29
  attr_accessor :slack_webhook_url
28
30
 
31
+ attr_accessor :path
32
+
29
33
  attr_accessor :public_web_form
30
34
 
31
35
  attr_accessor :editable_submissions
@@ -34,6 +38,8 @@ module FormAPI
34
38
 
35
39
  attr_accessor :name
36
40
 
41
+ attr_accessor :permanent_document_url
42
+
37
43
  attr_accessor :template_type
38
44
 
39
45
  attr_accessor :id
@@ -42,6 +48,8 @@ module FormAPI
42
48
 
43
49
  attr_accessor :redirect_url
44
50
 
51
+ attr_accessor :document_url
52
+
45
53
  class EnumAttributeValidator
46
54
  attr_reader :datatype
47
55
  attr_reader :allowable_values
@@ -69,18 +77,22 @@ module FormAPI
69
77
  {
70
78
  :'expiration_interval' => :'expiration_interval',
71
79
  :'webhook_url' => :'webhook_url',
80
+ :'parent_folder_id' => :'parent_folder_id',
72
81
  :'expire_after' => :'expire_after',
73
82
  :'allow_additional_properties' => :'allow_additional_properties',
74
83
  :'public_submissions' => :'public_submissions',
75
84
  :'slack_webhook_url' => :'slack_webhook_url',
85
+ :'path' => :'path',
76
86
  :'public_web_form' => :'public_web_form',
77
87
  :'editable_submissions' => :'editable_submissions',
78
88
  :'expire_submissions' => :'expire_submissions',
79
89
  :'name' => :'name',
90
+ :'permanent_document_url' => :'permanent_document_url',
80
91
  :'template_type' => :'template_type',
81
92
  :'id' => :'id',
82
93
  :'page_dimensions' => :'page_dimensions',
83
- :'redirect_url' => :'redirect_url'
94
+ :'redirect_url' => :'redirect_url',
95
+ :'document_url' => :'document_url'
84
96
  }
85
97
  end
86
98
 
@@ -89,18 +101,22 @@ module FormAPI
89
101
  {
90
102
  :'expiration_interval' => :'String',
91
103
  :'webhook_url' => :'String',
104
+ :'parent_folder_id' => :'String',
92
105
  :'expire_after' => :'Float',
93
106
  :'allow_additional_properties' => :'BOOLEAN',
94
107
  :'public_submissions' => :'BOOLEAN',
95
108
  :'slack_webhook_url' => :'String',
109
+ :'path' => :'String',
96
110
  :'public_web_form' => :'BOOLEAN',
97
111
  :'editable_submissions' => :'BOOLEAN',
98
112
  :'expire_submissions' => :'BOOLEAN',
99
113
  :'name' => :'String',
114
+ :'permanent_document_url' => :'String',
100
115
  :'template_type' => :'String',
101
116
  :'id' => :'String',
102
117
  :'page_dimensions' => :'Array<Array<Float>>',
103
- :'redirect_url' => :'String'
118
+ :'redirect_url' => :'String',
119
+ :'document_url' => :'String'
104
120
  }
105
121
  end
106
122
 
@@ -120,6 +136,10 @@ module FormAPI
120
136
  self.webhook_url = attributes[:'webhook_url']
121
137
  end
122
138
 
139
+ if attributes.has_key?(:'parent_folder_id')
140
+ self.parent_folder_id = attributes[:'parent_folder_id']
141
+ end
142
+
123
143
  if attributes.has_key?(:'expire_after')
124
144
  self.expire_after = attributes[:'expire_after']
125
145
  end
@@ -136,6 +156,10 @@ module FormAPI
136
156
  self.slack_webhook_url = attributes[:'slack_webhook_url']
137
157
  end
138
158
 
159
+ if attributes.has_key?(:'path')
160
+ self.path = attributes[:'path']
161
+ end
162
+
139
163
  if attributes.has_key?(:'public_web_form')
140
164
  self.public_web_form = attributes[:'public_web_form']
141
165
  end
@@ -152,6 +176,10 @@ module FormAPI
152
176
  self.name = attributes[:'name']
153
177
  end
154
178
 
179
+ if attributes.has_key?(:'permanent_document_url')
180
+ self.permanent_document_url = attributes[:'permanent_document_url']
181
+ end
182
+
155
183
  if attributes.has_key?(:'template_type')
156
184
  self.template_type = attributes[:'template_type']
157
185
  end
@@ -169,6 +197,10 @@ module FormAPI
169
197
  if attributes.has_key?(:'redirect_url')
170
198
  self.redirect_url = attributes[:'redirect_url']
171
199
  end
200
+
201
+ if attributes.has_key?(:'document_url')
202
+ self.document_url = attributes[:'document_url']
203
+ end
172
204
  end
173
205
 
174
206
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -203,18 +235,22 @@ module FormAPI
203
235
  self.class == o.class &&
204
236
  expiration_interval == o.expiration_interval &&
205
237
  webhook_url == o.webhook_url &&
238
+ parent_folder_id == o.parent_folder_id &&
206
239
  expire_after == o.expire_after &&
207
240
  allow_additional_properties == o.allow_additional_properties &&
208
241
  public_submissions == o.public_submissions &&
209
242
  slack_webhook_url == o.slack_webhook_url &&
243
+ path == o.path &&
210
244
  public_web_form == o.public_web_form &&
211
245
  editable_submissions == o.editable_submissions &&
212
246
  expire_submissions == o.expire_submissions &&
213
247
  name == o.name &&
248
+ permanent_document_url == o.permanent_document_url &&
214
249
  template_type == o.template_type &&
215
250
  id == o.id &&
216
251
  page_dimensions == o.page_dimensions &&
217
- redirect_url == o.redirect_url
252
+ redirect_url == o.redirect_url &&
253
+ document_url == o.document_url
218
254
  end
219
255
 
220
256
  # @see the `==` method
@@ -226,7 +262,7 @@ module FormAPI
226
262
  # Calculates hash code according to all attributes.
227
263
  # @return [Fixnum] Hash code
228
264
  def hash
229
- [expiration_interval, webhook_url, expire_after, allow_additional_properties, public_submissions, slack_webhook_url, public_web_form, editable_submissions, expire_submissions, name, template_type, id, page_dimensions, redirect_url].hash
265
+ [expiration_interval, webhook_url, parent_folder_id, expire_after, allow_additional_properties, public_submissions, slack_webhook_url, path, public_web_form, editable_submissions, expire_submissions, name, permanent_document_url, template_type, id, page_dimensions, redirect_url, document_url].hash
230
266
  end
231
267
 
232
268
  # Builds the object from hash
@@ -11,5 +11,5 @@ OpenAPI Generator version: 3.3.0-SNAPSHOT
11
11
  =end
12
12
 
13
13
  module FormAPI
14
- VERSION = '1.9.1'
14
+ VERSION = '1.11.0'
15
15
  end
@@ -112,17 +112,33 @@ describe 'PDFApi' do
112
112
  expect(result).to_not be_nil
113
113
  end
114
114
  end
115
+ # integration tests for create_folder
116
+ # Create a folder
117
+ # @param create_folder_data
118
+ # @param [Hash] opts the optional parameters
119
+ # @return [Folder]
120
+ describe 'create_folder test' do
121
+ it 'should work' do
122
+ create_folder_data = FormAPI::CreateFolderData.new # CreateFolderData |
123
+ result = api_instance.create_folder(create_folder_data)
124
+ expect(result).to_not be_nil
125
+ end
126
+ end
115
127
  # integration tests for create_template
116
128
  # Upload a new PDF template with a file upload
117
129
  # @param template_document
118
130
  # @param template_name
119
131
  # @param [Hash] opts the optional parameters
132
+ # @option opts [String] :template_parent_folder_id
120
133
  # @return [PendingTemplate]
121
134
  describe 'create_template test' do
122
135
  it 'should work' do
123
136
  template_document = File.new('/path/to/file') # File |
124
137
  template_name = 'template_name_example' # String |
125
- result = api_instance.create_template(template_document, template_name)
138
+ opts = {
139
+ template_parent_folder_id: 'template_parent_folder_id_example' # String |
140
+ }
141
+ result = api_instance.create_template(template_document, template_name, opts)
126
142
  expect(result).to_not be_nil
127
143
  end
128
144
  end
@@ -138,6 +154,18 @@ describe 'PDFApi' do
138
154
  expect(result).to_not be_nil
139
155
  end
140
156
  end
157
+ # integration tests for delete_folder
158
+ # Delete a folder
159
+ # @param folder_id
160
+ # @param [Hash] opts the optional parameters
161
+ # @return [Folder]
162
+ describe 'delete_folder test' do
163
+ it 'should work' do
164
+ folder_id = 'fld_000000000000000001' # String |
165
+ result = api_instance.delete_folder(folder_id)
166
+ expect(result).to_not be_nil
167
+ end
168
+ end
141
169
  # integration tests for expire_combined_submission
142
170
  # Expire a combined submission
143
171
  # @param combined_submission_id
@@ -243,13 +271,13 @@ describe 'PDFApi' do
243
271
  end
244
272
  end
245
273
  # integration tests for get_template
246
- # Check the status of an uploaded template
274
+ # Get a single template
247
275
  # @param template_id
248
276
  # @param [Hash] opts the optional parameters
249
277
  # @return [Template]
250
278
  describe 'get_template test' do
251
279
  it 'should work' do
252
- template_id = 'tpl_000000000000000001' # String |
280
+ template_id = 'tpl_000000000000000011' # String |
253
281
  result = api_instance.get_template(template_id)
254
282
  expect(result).to_not be_nil
255
283
  end
@@ -266,10 +294,25 @@ describe 'PDFApi' do
266
294
  expect(result).to_not be_nil
267
295
  end
268
296
  end
297
+ # integration tests for list_folders
298
+ # Get a list of all folders
299
+ # @param [Hash] opts the optional parameters
300
+ # @option opts [String] :parent_folder_id Filter By Folder Id
301
+ # @return [Array<Folder>]
302
+ describe 'list_folders test' do
303
+ it 'should work' do
304
+ opts = {
305
+ parent_folder_id: 'fld_000000000000000002' # String | Filter By Folder Id
306
+ }
307
+ result = api_instance.list_folders(opts)
308
+ expect(result).to_not be_nil
309
+ end
310
+ end
269
311
  # integration tests for list_templates
270
312
  # Get a list of all templates
271
313
  # @param [Hash] opts the optional parameters
272
314
  # @option opts [String] :query Search By Name
315
+ # @option opts [String] :parent_folder_id Filter By Folder Id
273
316
  # @option opts [Integer] :page Default: 1
274
317
  # @option opts [Integer] :per_page Default: 50
275
318
  # @return [Array<Template>]
@@ -277,6 +320,7 @@ describe 'PDFApi' do
277
320
  it 'should work' do
278
321
  opts = {
279
322
  query: '2', # String | Search By Name
323
+ parent_folder_id: 'fld_000000000000000001', # String | Filter By Folder Id
280
324
  page: 2, # Integer | Default: 1
281
325
  per_page: 1 # Integer | Default: 50
282
326
  }
@@ -284,6 +328,48 @@ describe 'PDFApi' do
284
328
  expect(result).to_not be_nil
285
329
  end
286
330
  end
331
+ # integration tests for move_folder_to_folder
332
+ # Move a folder
333
+ # @param folder_id
334
+ # @param move_folder_data
335
+ # @param [Hash] opts the optional parameters
336
+ # @return [Folder]
337
+ describe 'move_folder_to_folder test' do
338
+ it 'should work' do
339
+ folder_id = 'fld_000000000000000001' # String |
340
+ move_folder_data = FormAPI::MoveFolderData.new # MoveFolderData |
341
+ result = api_instance.move_folder_to_folder(folder_id, move_folder_data)
342
+ expect(result).to_not be_nil
343
+ end
344
+ end
345
+ # integration tests for move_template_to_folder
346
+ # Move Template to folder
347
+ # @param template_id
348
+ # @param move_template_data
349
+ # @param [Hash] opts the optional parameters
350
+ # @return [Template]
351
+ describe 'move_template_to_folder test' do
352
+ it 'should work' do
353
+ template_id = 'tpl_000000000000000001' # String |
354
+ move_template_data = FormAPI::MoveTemplateData.new # MoveTemplateData |
355
+ result = api_instance.move_template_to_folder(template_id, move_template_data)
356
+ expect(result).to_not be_nil
357
+ end
358
+ end
359
+ # integration tests for rename_folder
360
+ # Rename a folder
361
+ # @param folder_id
362
+ # @param rename_folder_data
363
+ # @param [Hash] opts the optional parameters
364
+ # @return [nil]
365
+ describe 'rename_folder test' do
366
+ it 'should work' do
367
+ folder_id = 'fld_000000000000000001' # String |
368
+ rename_folder_data = FormAPI::RenameFolderData.new # RenameFolderData |
369
+ api_instance.rename_folder(folder_id, rename_folder_data)
370
+ expect(result).to_not be_nil
371
+ end
372
+ end
287
373
  # integration tests for test_authentication
288
374
  # Test Authentication
289
375
  # @param [Hash] opts the optional parameters