docspring 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +39 -0
- data/.openapi-generator-ignore +23 -0
- data/.openapi-generator/VERSION +1 -0
- data/.rspec +2 -0
- data/.rubocop.yml +154 -0
- data/.swagger-codegen-ignore +31 -0
- data/.swagger-codegen/VERSION +1 -0
- data/.swagger-revision +1 -0
- data/.travis.yml +8 -0
- data/CHANGELOG.md +48 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +80 -0
- data/LICENSE +7 -0
- data/README.md +162 -0
- data/Rakefile +10 -0
- data/docs/AuthenticationError.md +9 -0
- data/docs/AuthenticationSuccessResponse.md +8 -0
- data/docs/CombinePdfsData.md +12 -0
- data/docs/CombinedSubmission.md +16 -0
- data/docs/CombinedSubmissionAction.md +13 -0
- data/docs/CombinedSubmissionData.md +11 -0
- data/docs/CreateCombinedSubmissionResponse.md +10 -0
- data/docs/CreateCustomFileData.md +8 -0
- data/docs/CreateCustomFileResponse.md +10 -0
- data/docs/CreateFolderData.md +8 -0
- data/docs/CreateSubmissionBatchResponse.md +12 -0
- data/docs/CreateSubmissionBatchSubmissionsResponse.md +10 -0
- data/docs/CreateSubmissionDataRequestData.md +20 -0
- data/docs/CreateSubmissionDataRequestTokenResponse.md +10 -0
- data/docs/CreateSubmissionDataRequestTokenResponseToken.md +11 -0
- data/docs/CreateSubmissionResponse.md +10 -0
- data/docs/CreateTemplateData.md +8 -0
- data/docs/CustomFile.md +9 -0
- data/docs/Error.md +9 -0
- data/docs/Folder.md +11 -0
- data/docs/FoldersFolder.md +9 -0
- data/docs/InvalidRequest.md +9 -0
- data/docs/MoveFolderData.md +8 -0
- data/docs/MoveTemplateData.md +8 -0
- data/docs/PDFApi.md +1385 -0
- data/docs/PendingTemplate.md +22 -0
- data/docs/RenameFolderData.md +8 -0
- data/docs/Submission.md +21 -0
- data/docs/SubmissionAction.md +13 -0
- data/docs/SubmissionBatch.md +16 -0
- data/docs/SubmissionBatchData.md +11 -0
- data/docs/SubmissionData.md +13 -0
- data/docs/SubmissionDataBatchRequest.md +13 -0
- data/docs/SubmissionDataRequest.md +24 -0
- data/docs/Template.md +25 -0
- data/docs/Templatesv2Template.md +19 -0
- data/docs/Templatesv2TemplateDocument.md +10 -0
- data/docs/Templatesv2TemplateDocumentMetadata.md +10 -0
- data/docs/UpdateDataRequestResponse.md +10 -0
- data/docs/UpdateSubmissionDataRequestData.md +20 -0
- data/docspring.gemspec +47 -0
- data/git_push.sh +55 -0
- data/lib/docspring.rb +82 -0
- data/lib/docspring/api/client.rb +174 -0
- data/lib/docspring/api/pdf_api.rb +1481 -0
- data/lib/docspring/api_client.rb +406 -0
- data/lib/docspring/api_error.rb +38 -0
- data/lib/docspring/configuration.rb +230 -0
- data/lib/docspring/models/authentication_error.rb +231 -0
- data/lib/docspring/models/authentication_success_response.rb +217 -0
- data/lib/docspring/models/combine_pdfs_data.rb +226 -0
- data/lib/docspring/models/combined_submission.rb +295 -0
- data/lib/docspring/models/combined_submission_action.rb +316 -0
- data/lib/docspring/models/combined_submission_data.rb +217 -0
- data/lib/docspring/models/create_combined_submission_response.rb +237 -0
- data/lib/docspring/models/create_custom_file_data.rb +207 -0
- data/lib/docspring/models/create_custom_file_response.rb +237 -0
- data/lib/docspring/models/create_folder_data.rb +188 -0
- data/lib/docspring/models/create_submission_batch_response.rb +257 -0
- data/lib/docspring/models/create_submission_batch_submissions_response.rb +237 -0
- data/lib/docspring/models/create_submission_data_request_data.rb +339 -0
- data/lib/docspring/models/create_submission_data_request_token_response.rb +237 -0
- data/lib/docspring/models/create_submission_data_request_token_response_token.rb +210 -0
- data/lib/docspring/models/create_submission_response.rb +237 -0
- data/lib/docspring/models/create_template_data.rb +188 -0
- data/lib/docspring/models/custom_file.rb +192 -0
- data/lib/docspring/models/error.rb +236 -0
- data/lib/docspring/models/folder.rb +210 -0
- data/lib/docspring/models/folders_folder.rb +192 -0
- data/lib/docspring/models/invalid_request.rb +238 -0
- data/lib/docspring/models/move_folder_data.rb +183 -0
- data/lib/docspring/models/move_template_data.rb +183 -0
- data/lib/docspring/models/pending_template.rb +343 -0
- data/lib/docspring/models/rename_folder_data.rb +188 -0
- data/lib/docspring/models/submission.rb +358 -0
- data/lib/docspring/models/submission_action.rb +316 -0
- data/lib/docspring/models/submission_batch.rb +291 -0
- data/lib/docspring/models/submission_batch_data.rb +217 -0
- data/lib/docspring/models/submission_data.rb +235 -0
- data/lib/docspring/models/submission_data_batch_request.rb +228 -0
- data/lib/docspring/models/submission_data_request.rb +422 -0
- data/lib/docspring/models/template.rb +372 -0
- data/lib/docspring/models/templatesv2_template.rb +316 -0
- data/lib/docspring/models/templatesv2_template_document.rb +235 -0
- data/lib/docspring/models/templatesv2_template_document_metadata.rb +235 -0
- data/lib/docspring/models/update_data_request_response.rb +237 -0
- data/lib/docspring/models/update_submission_data_request_data.rb +339 -0
- data/lib/docspring/version.rb +15 -0
- data/spec/api/client_integration_spec.rb +259 -0
- data/spec/api/pdf_api_integration_spec.rb +377 -0
- data/spec/api/pdf_api_spec_original.skipped.rb +397 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +53 -0
- data/spec/models/authentication_error_spec.rb +51 -0
- data/spec/models/authentication_success_response_spec.rb +45 -0
- data/spec/models/combine_pdfs_data_spec.rb +65 -0
- data/spec/models/combined_submission_action_spec.rb +83 -0
- data/spec/models/combined_submission_data_spec.rb +59 -0
- data/spec/models/combined_submission_spec.rb +93 -0
- data/spec/models/create_combined_submission_response_spec.rb +57 -0
- data/spec/models/create_custom_file_data_spec.rb +41 -0
- data/spec/models/create_custom_file_response_spec.rb +57 -0
- data/spec/models/create_folder_data_spec.rb +41 -0
- data/spec/models/create_submission_batch_response_spec.rb +69 -0
- data/spec/models/create_submission_batch_submissions_response_spec.rb +57 -0
- data/spec/models/create_submission_data_request_data_spec.rb +121 -0
- data/spec/models/create_submission_data_request_token_response_spec.rb +57 -0
- data/spec/models/create_submission_data_request_token_response_token_spec.rb +59 -0
- data/spec/models/create_submission_response_spec.rb +57 -0
- data/spec/models/create_template_data_spec.rb +41 -0
- data/spec/models/custom_file_spec.rb +47 -0
- data/spec/models/error_spec.rb +51 -0
- data/spec/models/folder_spec.rb +59 -0
- data/spec/models/folders_folder_spec.rb +47 -0
- data/spec/models/invalid_request_spec.rb +51 -0
- data/spec/models/move_folder_data_spec.rb +41 -0
- data/spec/models/move_template_data_spec.rb +41 -0
- data/spec/models/pending_template_spec.rb +129 -0
- data/spec/models/rename_folder_data_spec.rb +41 -0
- data/spec/models/submission_action_spec.rb +83 -0
- data/spec/models/submission_batch_data_spec.rb +59 -0
- data/spec/models/submission_batch_spec.rb +93 -0
- data/spec/models/submission_data_batch_request_spec.rb +71 -0
- data/spec/models/submission_data_request_spec.rb +149 -0
- data/spec/models/submission_data_spec.rb +71 -0
- data/spec/models/submission_spec.rb +123 -0
- data/spec/models/template_spec.rb +147 -0
- data/spec/models/templatesv2_template_document_metadata_spec.rb +57 -0
- data/spec/models/templatesv2_template_document_spec.rb +57 -0
- data/spec/models/templatesv2_template_spec.rb +111 -0
- data/spec/models/update_data_request_response_spec.rb +57 -0
- data/spec/models/update_submission_data_request_data_spec.rb +121 -0
- data/spec/spec_helper.rb +117 -0
- metadata +430 -0
@@ -0,0 +1,372 @@
|
|
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 Template
|
17
|
+
attr_accessor :expiration_interval
|
18
|
+
|
19
|
+
attr_accessor :webhook_url
|
20
|
+
|
21
|
+
attr_accessor :parent_folder_id
|
22
|
+
|
23
|
+
attr_accessor :expire_after
|
24
|
+
|
25
|
+
attr_accessor :allow_additional_properties
|
26
|
+
|
27
|
+
attr_accessor :public_submissions
|
28
|
+
|
29
|
+
attr_accessor :slack_webhook_url
|
30
|
+
|
31
|
+
attr_accessor :path
|
32
|
+
|
33
|
+
attr_accessor :public_web_form
|
34
|
+
|
35
|
+
attr_accessor :editable_submissions
|
36
|
+
|
37
|
+
attr_accessor :expire_submissions
|
38
|
+
|
39
|
+
attr_accessor :name
|
40
|
+
|
41
|
+
attr_accessor :permanent_document_url
|
42
|
+
|
43
|
+
attr_accessor :template_type
|
44
|
+
|
45
|
+
attr_accessor :id
|
46
|
+
|
47
|
+
attr_accessor :page_dimensions
|
48
|
+
|
49
|
+
attr_accessor :redirect_url
|
50
|
+
|
51
|
+
attr_accessor :document_url
|
52
|
+
|
53
|
+
class EnumAttributeValidator
|
54
|
+
attr_reader :datatype
|
55
|
+
attr_reader :allowable_values
|
56
|
+
|
57
|
+
def initialize(datatype, allowable_values)
|
58
|
+
@allowable_values = allowable_values.map do |value|
|
59
|
+
case datatype.to_s
|
60
|
+
when /Integer/i
|
61
|
+
value.to_i
|
62
|
+
when /Float/i
|
63
|
+
value.to_f
|
64
|
+
else
|
65
|
+
value
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def valid?(value)
|
71
|
+
!value || allowable_values.include?(value)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
76
|
+
def self.attribute_map
|
77
|
+
{
|
78
|
+
:'expiration_interval' => :'expiration_interval',
|
79
|
+
:'webhook_url' => :'webhook_url',
|
80
|
+
:'parent_folder_id' => :'parent_folder_id',
|
81
|
+
:'expire_after' => :'expire_after',
|
82
|
+
:'allow_additional_properties' => :'allow_additional_properties',
|
83
|
+
:'public_submissions' => :'public_submissions',
|
84
|
+
:'slack_webhook_url' => :'slack_webhook_url',
|
85
|
+
:'path' => :'path',
|
86
|
+
:'public_web_form' => :'public_web_form',
|
87
|
+
:'editable_submissions' => :'editable_submissions',
|
88
|
+
:'expire_submissions' => :'expire_submissions',
|
89
|
+
:'name' => :'name',
|
90
|
+
:'permanent_document_url' => :'permanent_document_url',
|
91
|
+
:'template_type' => :'template_type',
|
92
|
+
:'id' => :'id',
|
93
|
+
:'page_dimensions' => :'page_dimensions',
|
94
|
+
:'redirect_url' => :'redirect_url',
|
95
|
+
:'document_url' => :'document_url'
|
96
|
+
}
|
97
|
+
end
|
98
|
+
|
99
|
+
# Attribute type mapping.
|
100
|
+
def self.openapi_types
|
101
|
+
{
|
102
|
+
:'expiration_interval' => :'String',
|
103
|
+
:'webhook_url' => :'String',
|
104
|
+
:'parent_folder_id' => :'String',
|
105
|
+
:'expire_after' => :'Float',
|
106
|
+
:'allow_additional_properties' => :'BOOLEAN',
|
107
|
+
:'public_submissions' => :'BOOLEAN',
|
108
|
+
:'slack_webhook_url' => :'String',
|
109
|
+
:'path' => :'String',
|
110
|
+
:'public_web_form' => :'BOOLEAN',
|
111
|
+
:'editable_submissions' => :'BOOLEAN',
|
112
|
+
:'expire_submissions' => :'BOOLEAN',
|
113
|
+
:'name' => :'String',
|
114
|
+
:'permanent_document_url' => :'String',
|
115
|
+
:'template_type' => :'String',
|
116
|
+
:'id' => :'String',
|
117
|
+
:'page_dimensions' => :'Array<Array<Float>>',
|
118
|
+
:'redirect_url' => :'String',
|
119
|
+
:'document_url' => :'String'
|
120
|
+
}
|
121
|
+
end
|
122
|
+
|
123
|
+
# Initializes the object
|
124
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
125
|
+
def initialize(attributes = {})
|
126
|
+
return unless attributes.is_a?(Hash)
|
127
|
+
|
128
|
+
# convert string to symbol for hash key
|
129
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
130
|
+
|
131
|
+
if attributes.has_key?(:'expiration_interval')
|
132
|
+
self.expiration_interval = attributes[:'expiration_interval']
|
133
|
+
end
|
134
|
+
|
135
|
+
if attributes.has_key?(:'webhook_url')
|
136
|
+
self.webhook_url = attributes[:'webhook_url']
|
137
|
+
end
|
138
|
+
|
139
|
+
if attributes.has_key?(:'parent_folder_id')
|
140
|
+
self.parent_folder_id = attributes[:'parent_folder_id']
|
141
|
+
end
|
142
|
+
|
143
|
+
if attributes.has_key?(:'expire_after')
|
144
|
+
self.expire_after = attributes[:'expire_after']
|
145
|
+
end
|
146
|
+
|
147
|
+
if attributes.has_key?(:'allow_additional_properties')
|
148
|
+
self.allow_additional_properties = attributes[:'allow_additional_properties']
|
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?(:'path')
|
160
|
+
self.path = attributes[:'path']
|
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?(:'permanent_document_url')
|
180
|
+
self.permanent_document_url = attributes[:'permanent_document_url']
|
181
|
+
end
|
182
|
+
|
183
|
+
if attributes.has_key?(:'template_type')
|
184
|
+
self.template_type = attributes[:'template_type']
|
185
|
+
end
|
186
|
+
|
187
|
+
if attributes.has_key?(:'id')
|
188
|
+
self.id = attributes[:'id']
|
189
|
+
end
|
190
|
+
|
191
|
+
if attributes.has_key?(:'page_dimensions')
|
192
|
+
if (value = attributes[:'page_dimensions']).is_a?(Array)
|
193
|
+
self.page_dimensions = value
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
if attributes.has_key?(:'redirect_url')
|
198
|
+
self.redirect_url = attributes[:'redirect_url']
|
199
|
+
end
|
200
|
+
|
201
|
+
if attributes.has_key?(:'document_url')
|
202
|
+
self.document_url = attributes[:'document_url']
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
207
|
+
# @return Array for valid properties with the reasons
|
208
|
+
def list_invalid_properties
|
209
|
+
invalid_properties = Array.new
|
210
|
+
invalid_properties
|
211
|
+
end
|
212
|
+
|
213
|
+
# Check to see if the all the properties in the model are valid
|
214
|
+
# @return true if the model is valid
|
215
|
+
def valid?
|
216
|
+
expiration_interval_validator = EnumAttributeValidator.new('String', ['minutes', 'hours', 'days'])
|
217
|
+
return false unless expiration_interval_validator.valid?(@expiration_interval)
|
218
|
+
true
|
219
|
+
end
|
220
|
+
|
221
|
+
# Custom attribute writer method checking allowed values (enum).
|
222
|
+
# @param [Object] expiration_interval Object to be assigned
|
223
|
+
def expiration_interval=(expiration_interval)
|
224
|
+
validator = EnumAttributeValidator.new('String', ['minutes', 'hours', 'days'])
|
225
|
+
unless validator.valid?(expiration_interval)
|
226
|
+
fail ArgumentError, 'invalid value for "expiration_interval", must be one of #{validator.allowable_values}.'
|
227
|
+
end
|
228
|
+
@expiration_interval = expiration_interval
|
229
|
+
end
|
230
|
+
|
231
|
+
# Checks equality by comparing each attribute.
|
232
|
+
# @param [Object] Object to be compared
|
233
|
+
def ==(o)
|
234
|
+
return true if self.equal?(o)
|
235
|
+
self.class == o.class &&
|
236
|
+
expiration_interval == o.expiration_interval &&
|
237
|
+
webhook_url == o.webhook_url &&
|
238
|
+
parent_folder_id == o.parent_folder_id &&
|
239
|
+
expire_after == o.expire_after &&
|
240
|
+
allow_additional_properties == o.allow_additional_properties &&
|
241
|
+
public_submissions == o.public_submissions &&
|
242
|
+
slack_webhook_url == o.slack_webhook_url &&
|
243
|
+
path == o.path &&
|
244
|
+
public_web_form == o.public_web_form &&
|
245
|
+
editable_submissions == o.editable_submissions &&
|
246
|
+
expire_submissions == o.expire_submissions &&
|
247
|
+
name == o.name &&
|
248
|
+
permanent_document_url == o.permanent_document_url &&
|
249
|
+
template_type == o.template_type &&
|
250
|
+
id == o.id &&
|
251
|
+
page_dimensions == o.page_dimensions &&
|
252
|
+
redirect_url == o.redirect_url &&
|
253
|
+
document_url == o.document_url
|
254
|
+
end
|
255
|
+
|
256
|
+
# @see the `==` method
|
257
|
+
# @param [Object] Object to be compared
|
258
|
+
def eql?(o)
|
259
|
+
self == o
|
260
|
+
end
|
261
|
+
|
262
|
+
# Calculates hash code according to all attributes.
|
263
|
+
# @return [Fixnum] Hash code
|
264
|
+
def 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
|
266
|
+
end
|
267
|
+
|
268
|
+
# Builds the object from hash
|
269
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
270
|
+
# @return [Object] Returns the model itself
|
271
|
+
def build_from_hash(attributes)
|
272
|
+
return nil unless attributes.is_a?(Hash)
|
273
|
+
self.class.openapi_types.each_pair do |key, type|
|
274
|
+
if type =~ /\AArray<(.*)>/i
|
275
|
+
# check to ensure the input is an array given that the the attribute
|
276
|
+
# is documented as an array but the input is not
|
277
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
278
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
279
|
+
end
|
280
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
281
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
282
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
283
|
+
end
|
284
|
+
|
285
|
+
self
|
286
|
+
end
|
287
|
+
|
288
|
+
# Deserializes the data based on type
|
289
|
+
# @param string type Data type
|
290
|
+
# @param string value Value to be deserialized
|
291
|
+
# @return [Object] Deserialized data
|
292
|
+
def _deserialize(type, value)
|
293
|
+
case type.to_sym
|
294
|
+
when :DateTime
|
295
|
+
DateTime.parse(value)
|
296
|
+
when :Date
|
297
|
+
Date.parse(value)
|
298
|
+
when :String
|
299
|
+
value.to_s
|
300
|
+
when :Integer
|
301
|
+
value.to_i
|
302
|
+
when :Float
|
303
|
+
value.to_f
|
304
|
+
when :BOOLEAN
|
305
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
306
|
+
true
|
307
|
+
else
|
308
|
+
false
|
309
|
+
end
|
310
|
+
when :Object
|
311
|
+
# generic object (usually a Hash), return directly
|
312
|
+
value
|
313
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
314
|
+
inner_type = Regexp.last_match[:inner_type]
|
315
|
+
value.map { |v| _deserialize(inner_type, v) }
|
316
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
317
|
+
k_type = Regexp.last_match[:k_type]
|
318
|
+
v_type = Regexp.last_match[:v_type]
|
319
|
+
{}.tap do |hash|
|
320
|
+
value.each do |k, v|
|
321
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
322
|
+
end
|
323
|
+
end
|
324
|
+
else # model
|
325
|
+
temp_model = DocSpring.const_get(type).new
|
326
|
+
temp_model.build_from_hash(value)
|
327
|
+
end
|
328
|
+
end
|
329
|
+
|
330
|
+
# Returns the string representation of the object
|
331
|
+
# @return [String] String presentation of the object
|
332
|
+
def to_s
|
333
|
+
to_hash.to_s
|
334
|
+
end
|
335
|
+
|
336
|
+
# to_body is an alias to to_hash (backward compatibility)
|
337
|
+
# @return [Hash] Returns the object in the form of hash
|
338
|
+
def to_body
|
339
|
+
to_hash
|
340
|
+
end
|
341
|
+
|
342
|
+
# Returns the object in the form of hash
|
343
|
+
# @return [Hash] Returns the object in the form of hash
|
344
|
+
def to_hash
|
345
|
+
hash = {}
|
346
|
+
self.class.attribute_map.each_pair do |attr, param|
|
347
|
+
value = self.send(attr)
|
348
|
+
next if value.nil?
|
349
|
+
hash[param] = _to_hash(value)
|
350
|
+
end
|
351
|
+
hash
|
352
|
+
end
|
353
|
+
|
354
|
+
# Outputs non-array value in the form of hash
|
355
|
+
# For object, use to_hash. Otherwise, just return the value
|
356
|
+
# @param [Object] value Any valid value
|
357
|
+
# @return [Hash] Returns the value in the form of hash
|
358
|
+
def _to_hash(value)
|
359
|
+
if value.is_a?(Array)
|
360
|
+
value.compact.map { |v| _to_hash(v) }
|
361
|
+
elsif value.is_a?(Hash)
|
362
|
+
{}.tap do |hash|
|
363
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
364
|
+
end
|
365
|
+
elsif value.respond_to? :to_hash
|
366
|
+
value.to_hash
|
367
|
+
else
|
368
|
+
value
|
369
|
+
end
|
370
|
+
end
|
371
|
+
end
|
372
|
+
end
|
@@ -0,0 +1,316 @@
|
|
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 Templatesv2Template
|
17
|
+
attr_accessor :expiration_interval
|
18
|
+
|
19
|
+
attr_accessor :public_web_form
|
20
|
+
|
21
|
+
attr_accessor :webhook_url
|
22
|
+
|
23
|
+
attr_accessor :editable_submissions
|
24
|
+
|
25
|
+
attr_accessor :expire_submissions
|
26
|
+
|
27
|
+
attr_accessor :expire_after
|
28
|
+
|
29
|
+
attr_accessor :allow_additional_properties
|
30
|
+
|
31
|
+
attr_accessor :document
|
32
|
+
|
33
|
+
attr_accessor :name
|
34
|
+
|
35
|
+
attr_accessor :public_submissions
|
36
|
+
|
37
|
+
attr_accessor :slack_webhook_url
|
38
|
+
|
39
|
+
attr_accessor :redirect_url
|
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
|
+
:'editable_submissions' => :'editable_submissions',
|
70
|
+
:'expire_submissions' => :'expire_submissions',
|
71
|
+
:'expire_after' => :'expire_after',
|
72
|
+
:'allow_additional_properties' => :'allow_additional_properties',
|
73
|
+
:'document' => :'document',
|
74
|
+
:'name' => :'name',
|
75
|
+
:'public_submissions' => :'public_submissions',
|
76
|
+
:'slack_webhook_url' => :'slack_webhook_url',
|
77
|
+
:'redirect_url' => :'redirect_url'
|
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
|
+
:'editable_submissions' => :'BOOLEAN',
|
88
|
+
:'expire_submissions' => :'BOOLEAN',
|
89
|
+
:'expire_after' => :'Float',
|
90
|
+
:'allow_additional_properties' => :'BOOLEAN',
|
91
|
+
:'document' => :'Templatesv2TemplateDocument',
|
92
|
+
:'name' => :'String',
|
93
|
+
:'public_submissions' => :'BOOLEAN',
|
94
|
+
:'slack_webhook_url' => :'String',
|
95
|
+
:'redirect_url' => :'String'
|
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?(:'editable_submissions')
|
120
|
+
self.editable_submissions = attributes[:'editable_submissions']
|
121
|
+
end
|
122
|
+
|
123
|
+
if attributes.has_key?(:'expire_submissions')
|
124
|
+
self.expire_submissions = attributes[:'expire_submissions']
|
125
|
+
end
|
126
|
+
|
127
|
+
if attributes.has_key?(:'expire_after')
|
128
|
+
self.expire_after = attributes[:'expire_after']
|
129
|
+
end
|
130
|
+
|
131
|
+
if attributes.has_key?(:'allow_additional_properties')
|
132
|
+
self.allow_additional_properties = attributes[:'allow_additional_properties']
|
133
|
+
end
|
134
|
+
|
135
|
+
if attributes.has_key?(:'document')
|
136
|
+
self.document = attributes[:'document']
|
137
|
+
end
|
138
|
+
|
139
|
+
if attributes.has_key?(:'name')
|
140
|
+
self.name = attributes[:'name']
|
141
|
+
end
|
142
|
+
|
143
|
+
if attributes.has_key?(:'public_submissions')
|
144
|
+
self.public_submissions = attributes[:'public_submissions']
|
145
|
+
end
|
146
|
+
|
147
|
+
if attributes.has_key?(:'slack_webhook_url')
|
148
|
+
self.slack_webhook_url = attributes[:'slack_webhook_url']
|
149
|
+
end
|
150
|
+
|
151
|
+
if attributes.has_key?(:'redirect_url')
|
152
|
+
self.redirect_url = attributes[:'redirect_url']
|
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
|
+
editable_submissions == o.editable_submissions &&
|
190
|
+
expire_submissions == o.expire_submissions &&
|
191
|
+
expire_after == o.expire_after &&
|
192
|
+
allow_additional_properties == o.allow_additional_properties &&
|
193
|
+
document == o.document &&
|
194
|
+
name == o.name &&
|
195
|
+
public_submissions == o.public_submissions &&
|
196
|
+
slack_webhook_url == o.slack_webhook_url &&
|
197
|
+
redirect_url == o.redirect_url
|
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, editable_submissions, expire_submissions, expire_after, allow_additional_properties, document, name, public_submissions, slack_webhook_url, redirect_url].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 = DocSpring.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
|