form_api 1.6.0 → 1.7.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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +3 -0
  3. data/Gemfile.lock +1 -1
  4. data/README.md +21 -10
  5. data/docs/{CreateSubmissionDataBatchV1.md → CombinePdfsData.md} +4 -4
  6. data/docs/CombinedSubmission.md +1 -0
  7. data/docs/CreateCustomFileData.md +8 -0
  8. data/docs/CreateCustomFileResponse.md +10 -0
  9. data/docs/CreateTemplateData.md +8 -0
  10. data/docs/CustomFile.md +9 -0
  11. data/docs/PDFApi.md +208 -12
  12. data/docs/SubmissionBatchData.md +1 -1
  13. data/docs/{CreateSubmissionData.md → SubmissionData.md} +1 -1
  14. data/docs/{CreateSubmissionDataBatchRequest.md → SubmissionDataBatchRequest.md} +5 -5
  15. data/docs/Templatesv2Template.md +19 -0
  16. data/docs/Templatesv2TemplateDocument.md +10 -0
  17. data/docs/Templatesv2TemplateDocumentMetadata.md +10 -0
  18. data/lib/form_api.rb +10 -3
  19. data/lib/form_api/api/client.rb +25 -9
  20. data/lib/form_api/api/pdf_api.rb +224 -20
  21. data/lib/form_api/models/{create_submission_data_batch_request.rb → combine_pdfs_data.rb} +31 -43
  22. data/lib/form_api/models/combined_submission.rb +12 -1
  23. data/lib/form_api/models/create_custom_file_data.rb +188 -0
  24. data/lib/form_api/models/create_custom_file_response.rb +237 -0
  25. data/lib/form_api/models/create_template_data.rb +188 -0
  26. data/lib/form_api/models/custom_file.rb +192 -0
  27. data/lib/form_api/models/submission_batch_data.rb +1 -1
  28. data/lib/form_api/models/{create_submission_data.rb → submission_data.rb} +1 -1
  29. data/lib/form_api/models/{create_submission_data_batch_v1.rb → submission_data_batch_request.rb} +32 -28
  30. data/lib/form_api/models/templatesv2_template.rb +316 -0
  31. data/lib/form_api/models/templatesv2_template_document.rb +235 -0
  32. data/lib/form_api/models/templatesv2_template_document_metadata.rb +235 -0
  33. data/lib/form_api/version.rb +1 -1
  34. data/spec/api/client_integration_spec.rb +41 -4
  35. data/spec/api/pdf_api_integration_spec.rb +7 -7
  36. data/spec/api/pdf_api_spec_original.skipped.rb +55 -9
  37. data/spec/models/{create_submission_data_batch_v1_spec.rb → combine_pdfs_data_spec.rb} +10 -10
  38. data/spec/models/combined_submission_spec.rb +6 -0
  39. data/spec/models/create_custom_file_data_spec.rb +41 -0
  40. data/spec/models/create_custom_file_response_spec.rb +57 -0
  41. data/spec/models/create_template_data_spec.rb +41 -0
  42. data/spec/models/custom_file_spec.rb +47 -0
  43. data/spec/models/{create_submission_data_batch_request_spec.rb → submission_data_batch_request_spec.rb} +12 -12
  44. data/spec/models/{create_submission_data_spec.rb → submission_data_spec.rb} +6 -6
  45. data/spec/models/templatesv2_template_document_metadata_spec.rb +57 -0
  46. data/spec/models/templatesv2_template_document_spec.rb +57 -0
  47. data/spec/models/templatesv2_template_spec.rb +111 -0
  48. data/spec/spec_helper.rb +3 -0
  49. metadata +42 -14
@@ -0,0 +1,316 @@
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 Templatesv2Template
17
+ attr_accessor :expiration_interval
18
+
19
+ attr_accessor :public_web_form
20
+
21
+ attr_accessor :webhook_url
22
+
23
+ attr_accessor :expire_submissions
24
+
25
+ attr_accessor :expire_after
26
+
27
+ attr_accessor :allow_additional_properties
28
+
29
+ attr_accessor :document
30
+
31
+ attr_accessor :name
32
+
33
+ attr_accessor :public_submissions
34
+
35
+ attr_accessor :slack_webhook_url
36
+
37
+ attr_accessor :redirect_url
38
+
39
+ attr_accessor :blockchain_timestamp_verification
40
+
41
+ class EnumAttributeValidator
42
+ attr_reader :datatype
43
+ attr_reader :allowable_values
44
+
45
+ def initialize(datatype, allowable_values)
46
+ @allowable_values = allowable_values.map do |value|
47
+ case datatype.to_s
48
+ when /Integer/i
49
+ value.to_i
50
+ when /Float/i
51
+ value.to_f
52
+ else
53
+ value
54
+ end
55
+ end
56
+ end
57
+
58
+ def valid?(value)
59
+ !value || allowable_values.include?(value)
60
+ end
61
+ end
62
+
63
+ # Attribute mapping from ruby-style variable name to JSON key.
64
+ def self.attribute_map
65
+ {
66
+ :'expiration_interval' => :'expiration_interval',
67
+ :'public_web_form' => :'public_web_form',
68
+ :'webhook_url' => :'webhook_url',
69
+ :'expire_submissions' => :'expire_submissions',
70
+ :'expire_after' => :'expire_after',
71
+ :'allow_additional_properties' => :'allow_additional_properties',
72
+ :'document' => :'document',
73
+ :'name' => :'name',
74
+ :'public_submissions' => :'public_submissions',
75
+ :'slack_webhook_url' => :'slack_webhook_url',
76
+ :'redirect_url' => :'redirect_url',
77
+ :'blockchain_timestamp_verification' => :'blockchain_timestamp_verification'
78
+ }
79
+ end
80
+
81
+ # Attribute type mapping.
82
+ def self.openapi_types
83
+ {
84
+ :'expiration_interval' => :'String',
85
+ :'public_web_form' => :'BOOLEAN',
86
+ :'webhook_url' => :'String',
87
+ :'expire_submissions' => :'BOOLEAN',
88
+ :'expire_after' => :'Float',
89
+ :'allow_additional_properties' => :'BOOLEAN',
90
+ :'document' => :'Templatesv2TemplateDocument',
91
+ :'name' => :'String',
92
+ :'public_submissions' => :'BOOLEAN',
93
+ :'slack_webhook_url' => :'String',
94
+ :'redirect_url' => :'String',
95
+ :'blockchain_timestamp_verification' => :'BOOLEAN'
96
+ }
97
+ end
98
+
99
+ # Initializes the object
100
+ # @param [Hash] attributes Model attributes in the form of hash
101
+ def initialize(attributes = {})
102
+ return unless attributes.is_a?(Hash)
103
+
104
+ # convert string to symbol for hash key
105
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
106
+
107
+ if attributes.has_key?(:'expiration_interval')
108
+ self.expiration_interval = attributes[:'expiration_interval']
109
+ end
110
+
111
+ if attributes.has_key?(:'public_web_form')
112
+ self.public_web_form = attributes[:'public_web_form']
113
+ end
114
+
115
+ if attributes.has_key?(:'webhook_url')
116
+ self.webhook_url = attributes[:'webhook_url']
117
+ end
118
+
119
+ if attributes.has_key?(:'expire_submissions')
120
+ self.expire_submissions = attributes[:'expire_submissions']
121
+ end
122
+
123
+ if attributes.has_key?(:'expire_after')
124
+ self.expire_after = attributes[:'expire_after']
125
+ end
126
+
127
+ if attributes.has_key?(:'allow_additional_properties')
128
+ self.allow_additional_properties = attributes[:'allow_additional_properties']
129
+ end
130
+
131
+ if attributes.has_key?(:'document')
132
+ self.document = attributes[:'document']
133
+ end
134
+
135
+ if attributes.has_key?(:'name')
136
+ self.name = attributes[:'name']
137
+ end
138
+
139
+ if attributes.has_key?(:'public_submissions')
140
+ self.public_submissions = attributes[:'public_submissions']
141
+ end
142
+
143
+ if attributes.has_key?(:'slack_webhook_url')
144
+ self.slack_webhook_url = attributes[:'slack_webhook_url']
145
+ end
146
+
147
+ if attributes.has_key?(:'redirect_url')
148
+ self.redirect_url = attributes[:'redirect_url']
149
+ end
150
+
151
+ if attributes.has_key?(:'blockchain_timestamp_verification')
152
+ self.blockchain_timestamp_verification = attributes[:'blockchain_timestamp_verification']
153
+ end
154
+ end
155
+
156
+ # Show invalid properties with the reasons. Usually used together with valid?
157
+ # @return Array for valid properties with the reasons
158
+ def list_invalid_properties
159
+ invalid_properties = Array.new
160
+ invalid_properties
161
+ end
162
+
163
+ # Check to see if the all the properties in the model are valid
164
+ # @return true if the model is valid
165
+ def valid?
166
+ expiration_interval_validator = EnumAttributeValidator.new('String', ['minutes', 'hours', 'days'])
167
+ return false unless expiration_interval_validator.valid?(@expiration_interval)
168
+ true
169
+ end
170
+
171
+ # Custom attribute writer method checking allowed values (enum).
172
+ # @param [Object] expiration_interval Object to be assigned
173
+ def expiration_interval=(expiration_interval)
174
+ validator = EnumAttributeValidator.new('String', ['minutes', 'hours', 'days'])
175
+ unless validator.valid?(expiration_interval)
176
+ fail ArgumentError, 'invalid value for "expiration_interval", must be one of #{validator.allowable_values}.'
177
+ end
178
+ @expiration_interval = expiration_interval
179
+ end
180
+
181
+ # Checks equality by comparing each attribute.
182
+ # @param [Object] Object to be compared
183
+ def ==(o)
184
+ return true if self.equal?(o)
185
+ self.class == o.class &&
186
+ expiration_interval == o.expiration_interval &&
187
+ public_web_form == o.public_web_form &&
188
+ webhook_url == o.webhook_url &&
189
+ expire_submissions == o.expire_submissions &&
190
+ expire_after == o.expire_after &&
191
+ allow_additional_properties == o.allow_additional_properties &&
192
+ document == o.document &&
193
+ name == o.name &&
194
+ public_submissions == o.public_submissions &&
195
+ slack_webhook_url == o.slack_webhook_url &&
196
+ redirect_url == o.redirect_url &&
197
+ blockchain_timestamp_verification == o.blockchain_timestamp_verification
198
+ end
199
+
200
+ # @see the `==` method
201
+ # @param [Object] Object to be compared
202
+ def eql?(o)
203
+ self == o
204
+ end
205
+
206
+ # Calculates hash code according to all attributes.
207
+ # @return [Fixnum] Hash code
208
+ def hash
209
+ [expiration_interval, public_web_form, webhook_url, expire_submissions, expire_after, allow_additional_properties, document, name, public_submissions, slack_webhook_url, redirect_url, blockchain_timestamp_verification].hash
210
+ end
211
+
212
+ # Builds the object from hash
213
+ # @param [Hash] attributes Model attributes in the form of hash
214
+ # @return [Object] Returns the model itself
215
+ def build_from_hash(attributes)
216
+ return nil unless attributes.is_a?(Hash)
217
+ self.class.openapi_types.each_pair do |key, type|
218
+ if type =~ /\AArray<(.*)>/i
219
+ # check to ensure the input is an array given that the the attribute
220
+ # is documented as an array but the input is not
221
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
222
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
223
+ end
224
+ elsif !attributes[self.class.attribute_map[key]].nil?
225
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
226
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
227
+ end
228
+
229
+ self
230
+ end
231
+
232
+ # Deserializes the data based on type
233
+ # @param string type Data type
234
+ # @param string value Value to be deserialized
235
+ # @return [Object] Deserialized data
236
+ def _deserialize(type, value)
237
+ case type.to_sym
238
+ when :DateTime
239
+ DateTime.parse(value)
240
+ when :Date
241
+ Date.parse(value)
242
+ when :String
243
+ value.to_s
244
+ when :Integer
245
+ value.to_i
246
+ when :Float
247
+ value.to_f
248
+ when :BOOLEAN
249
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
250
+ true
251
+ else
252
+ false
253
+ end
254
+ when :Object
255
+ # generic object (usually a Hash), return directly
256
+ value
257
+ when /\AArray<(?<inner_type>.+)>\z/
258
+ inner_type = Regexp.last_match[:inner_type]
259
+ value.map { |v| _deserialize(inner_type, v) }
260
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
261
+ k_type = Regexp.last_match[:k_type]
262
+ v_type = Regexp.last_match[:v_type]
263
+ {}.tap do |hash|
264
+ value.each do |k, v|
265
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
266
+ end
267
+ end
268
+ else # model
269
+ temp_model = FormAPI.const_get(type).new
270
+ temp_model.build_from_hash(value)
271
+ end
272
+ end
273
+
274
+ # Returns the string representation of the object
275
+ # @return [String] String presentation of the object
276
+ def to_s
277
+ to_hash.to_s
278
+ end
279
+
280
+ # to_body is an alias to to_hash (backward compatibility)
281
+ # @return [Hash] Returns the object in the form of hash
282
+ def to_body
283
+ to_hash
284
+ end
285
+
286
+ # Returns the object in the form of hash
287
+ # @return [Hash] Returns the object in the form of hash
288
+ def to_hash
289
+ hash = {}
290
+ self.class.attribute_map.each_pair do |attr, param|
291
+ value = self.send(attr)
292
+ next if value.nil?
293
+ hash[param] = _to_hash(value)
294
+ end
295
+ hash
296
+ end
297
+
298
+ # Outputs non-array value in the form of hash
299
+ # For object, use to_hash. Otherwise, just return the value
300
+ # @param [Object] value Any valid value
301
+ # @return [Hash] Returns the value in the form of hash
302
+ def _to_hash(value)
303
+ if value.is_a?(Array)
304
+ value.compact.map { |v| _to_hash(v) }
305
+ elsif value.is_a?(Hash)
306
+ {}.tap do |hash|
307
+ value.each { |k, v| hash[k] = _to_hash(v) }
308
+ end
309
+ elsif value.respond_to? :to_hash
310
+ value.to_hash
311
+ else
312
+ value
313
+ end
314
+ end
315
+ end
316
+ end
@@ -0,0 +1,235 @@
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 Templatesv2TemplateDocument
17
+ attr_accessor :metadata
18
+
19
+ attr_accessor :id
20
+
21
+ attr_accessor :storage
22
+
23
+ class EnumAttributeValidator
24
+ attr_reader :datatype
25
+ attr_reader :allowable_values
26
+
27
+ def initialize(datatype, allowable_values)
28
+ @allowable_values = allowable_values.map do |value|
29
+ case datatype.to_s
30
+ when /Integer/i
31
+ value.to_i
32
+ when /Float/i
33
+ value.to_f
34
+ else
35
+ value
36
+ end
37
+ end
38
+ end
39
+
40
+ def valid?(value)
41
+ !value || allowable_values.include?(value)
42
+ end
43
+ end
44
+
45
+ # Attribute mapping from ruby-style variable name to JSON key.
46
+ def self.attribute_map
47
+ {
48
+ :'metadata' => :'metadata',
49
+ :'id' => :'id',
50
+ :'storage' => :'storage'
51
+ }
52
+ end
53
+
54
+ # Attribute type mapping.
55
+ def self.openapi_types
56
+ {
57
+ :'metadata' => :'Templatesv2TemplateDocumentMetadata',
58
+ :'id' => :'String',
59
+ :'storage' => :'String'
60
+ }
61
+ end
62
+
63
+ # Initializes the object
64
+ # @param [Hash] attributes Model attributes in the form of hash
65
+ def initialize(attributes = {})
66
+ return unless attributes.is_a?(Hash)
67
+
68
+ # convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
70
+
71
+ if attributes.has_key?(:'metadata')
72
+ self.metadata = attributes[:'metadata']
73
+ end
74
+
75
+ if attributes.has_key?(:'id')
76
+ self.id = attributes[:'id']
77
+ end
78
+
79
+ if attributes.has_key?(:'storage')
80
+ self.storage = attributes[:'storage']
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ invalid_properties = Array.new
88
+ invalid_properties
89
+ end
90
+
91
+ # Check to see if the all the properties in the model are valid
92
+ # @return true if the model is valid
93
+ def valid?
94
+ storage_validator = EnumAttributeValidator.new('String', ['cache'])
95
+ return false unless storage_validator.valid?(@storage)
96
+ true
97
+ end
98
+
99
+ # Custom attribute writer method checking allowed values (enum).
100
+ # @param [Object] storage Object to be assigned
101
+ def storage=(storage)
102
+ validator = EnumAttributeValidator.new('String', ['cache'])
103
+ unless validator.valid?(storage)
104
+ fail ArgumentError, 'invalid value for "storage", must be one of #{validator.allowable_values}.'
105
+ end
106
+ @storage = storage
107
+ end
108
+
109
+ # Checks equality by comparing each attribute.
110
+ # @param [Object] Object to be compared
111
+ def ==(o)
112
+ return true if self.equal?(o)
113
+ self.class == o.class &&
114
+ metadata == o.metadata &&
115
+ id == o.id &&
116
+ storage == o.storage
117
+ end
118
+
119
+ # @see the `==` method
120
+ # @param [Object] Object to be compared
121
+ def eql?(o)
122
+ self == o
123
+ end
124
+
125
+ # Calculates hash code according to all attributes.
126
+ # @return [Fixnum] Hash code
127
+ def hash
128
+ [metadata, id, storage].hash
129
+ end
130
+
131
+ # Builds the object from hash
132
+ # @param [Hash] attributes Model attributes in the form of hash
133
+ # @return [Object] Returns the model itself
134
+ def build_from_hash(attributes)
135
+ return nil unless attributes.is_a?(Hash)
136
+ self.class.openapi_types.each_pair do |key, type|
137
+ if type =~ /\AArray<(.*)>/i
138
+ # check to ensure the input is an array given that the the attribute
139
+ # is documented as an array but the input is not
140
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
141
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
142
+ end
143
+ elsif !attributes[self.class.attribute_map[key]].nil?
144
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
145
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
146
+ end
147
+
148
+ self
149
+ end
150
+
151
+ # Deserializes the data based on type
152
+ # @param string type Data type
153
+ # @param string value Value to be deserialized
154
+ # @return [Object] Deserialized data
155
+ def _deserialize(type, value)
156
+ case type.to_sym
157
+ when :DateTime
158
+ DateTime.parse(value)
159
+ when :Date
160
+ Date.parse(value)
161
+ when :String
162
+ value.to_s
163
+ when :Integer
164
+ value.to_i
165
+ when :Float
166
+ value.to_f
167
+ when :BOOLEAN
168
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
169
+ true
170
+ else
171
+ false
172
+ end
173
+ when :Object
174
+ # generic object (usually a Hash), return directly
175
+ value
176
+ when /\AArray<(?<inner_type>.+)>\z/
177
+ inner_type = Regexp.last_match[:inner_type]
178
+ value.map { |v| _deserialize(inner_type, v) }
179
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
180
+ k_type = Regexp.last_match[:k_type]
181
+ v_type = Regexp.last_match[:v_type]
182
+ {}.tap do |hash|
183
+ value.each do |k, v|
184
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
185
+ end
186
+ end
187
+ else # model
188
+ temp_model = FormAPI.const_get(type).new
189
+ temp_model.build_from_hash(value)
190
+ end
191
+ end
192
+
193
+ # Returns the string representation of the object
194
+ # @return [String] String presentation of the object
195
+ def to_s
196
+ to_hash.to_s
197
+ end
198
+
199
+ # to_body is an alias to to_hash (backward compatibility)
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_body
202
+ to_hash
203
+ end
204
+
205
+ # Returns the object in the form of hash
206
+ # @return [Hash] Returns the object in the form of hash
207
+ def to_hash
208
+ hash = {}
209
+ self.class.attribute_map.each_pair do |attr, param|
210
+ value = self.send(attr)
211
+ next if value.nil?
212
+ hash[param] = _to_hash(value)
213
+ end
214
+ hash
215
+ end
216
+
217
+ # Outputs non-array value in the form of hash
218
+ # For object, use to_hash. Otherwise, just return the value
219
+ # @param [Object] value Any valid value
220
+ # @return [Hash] Returns the value in the form of hash
221
+ def _to_hash(value)
222
+ if value.is_a?(Array)
223
+ value.compact.map { |v| _to_hash(v) }
224
+ elsif value.is_a?(Hash)
225
+ {}.tap do |hash|
226
+ value.each { |k, v| hash[k] = _to_hash(v) }
227
+ end
228
+ elsif value.respond_to? :to_hash
229
+ value.to_hash
230
+ else
231
+ value
232
+ end
233
+ end
234
+ end
235
+ end