docspring 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +39 -0
  3. data/.openapi-generator-ignore +23 -0
  4. data/.openapi-generator/VERSION +1 -0
  5. data/.rspec +2 -0
  6. data/.rubocop.yml +154 -0
  7. data/.swagger-codegen-ignore +31 -0
  8. data/.swagger-codegen/VERSION +1 -0
  9. data/.swagger-revision +1 -0
  10. data/.travis.yml +8 -0
  11. data/CHANGELOG.md +48 -0
  12. data/Gemfile +8 -0
  13. data/Gemfile.lock +80 -0
  14. data/LICENSE +7 -0
  15. data/README.md +162 -0
  16. data/Rakefile +10 -0
  17. data/docs/AuthenticationError.md +9 -0
  18. data/docs/AuthenticationSuccessResponse.md +8 -0
  19. data/docs/CombinePdfsData.md +12 -0
  20. data/docs/CombinedSubmission.md +16 -0
  21. data/docs/CombinedSubmissionAction.md +13 -0
  22. data/docs/CombinedSubmissionData.md +11 -0
  23. data/docs/CreateCombinedSubmissionResponse.md +10 -0
  24. data/docs/CreateCustomFileData.md +8 -0
  25. data/docs/CreateCustomFileResponse.md +10 -0
  26. data/docs/CreateFolderData.md +8 -0
  27. data/docs/CreateSubmissionBatchResponse.md +12 -0
  28. data/docs/CreateSubmissionBatchSubmissionsResponse.md +10 -0
  29. data/docs/CreateSubmissionDataRequestData.md +20 -0
  30. data/docs/CreateSubmissionDataRequestTokenResponse.md +10 -0
  31. data/docs/CreateSubmissionDataRequestTokenResponseToken.md +11 -0
  32. data/docs/CreateSubmissionResponse.md +10 -0
  33. data/docs/CreateTemplateData.md +8 -0
  34. data/docs/CustomFile.md +9 -0
  35. data/docs/Error.md +9 -0
  36. data/docs/Folder.md +11 -0
  37. data/docs/FoldersFolder.md +9 -0
  38. data/docs/InvalidRequest.md +9 -0
  39. data/docs/MoveFolderData.md +8 -0
  40. data/docs/MoveTemplateData.md +8 -0
  41. data/docs/PDFApi.md +1385 -0
  42. data/docs/PendingTemplate.md +22 -0
  43. data/docs/RenameFolderData.md +8 -0
  44. data/docs/Submission.md +21 -0
  45. data/docs/SubmissionAction.md +13 -0
  46. data/docs/SubmissionBatch.md +16 -0
  47. data/docs/SubmissionBatchData.md +11 -0
  48. data/docs/SubmissionData.md +13 -0
  49. data/docs/SubmissionDataBatchRequest.md +13 -0
  50. data/docs/SubmissionDataRequest.md +24 -0
  51. data/docs/Template.md +25 -0
  52. data/docs/Templatesv2Template.md +19 -0
  53. data/docs/Templatesv2TemplateDocument.md +10 -0
  54. data/docs/Templatesv2TemplateDocumentMetadata.md +10 -0
  55. data/docs/UpdateDataRequestResponse.md +10 -0
  56. data/docs/UpdateSubmissionDataRequestData.md +20 -0
  57. data/docspring.gemspec +47 -0
  58. data/git_push.sh +55 -0
  59. data/lib/docspring.rb +82 -0
  60. data/lib/docspring/api/client.rb +174 -0
  61. data/lib/docspring/api/pdf_api.rb +1481 -0
  62. data/lib/docspring/api_client.rb +406 -0
  63. data/lib/docspring/api_error.rb +38 -0
  64. data/lib/docspring/configuration.rb +230 -0
  65. data/lib/docspring/models/authentication_error.rb +231 -0
  66. data/lib/docspring/models/authentication_success_response.rb +217 -0
  67. data/lib/docspring/models/combine_pdfs_data.rb +226 -0
  68. data/lib/docspring/models/combined_submission.rb +295 -0
  69. data/lib/docspring/models/combined_submission_action.rb +316 -0
  70. data/lib/docspring/models/combined_submission_data.rb +217 -0
  71. data/lib/docspring/models/create_combined_submission_response.rb +237 -0
  72. data/lib/docspring/models/create_custom_file_data.rb +207 -0
  73. data/lib/docspring/models/create_custom_file_response.rb +237 -0
  74. data/lib/docspring/models/create_folder_data.rb +188 -0
  75. data/lib/docspring/models/create_submission_batch_response.rb +257 -0
  76. data/lib/docspring/models/create_submission_batch_submissions_response.rb +237 -0
  77. data/lib/docspring/models/create_submission_data_request_data.rb +339 -0
  78. data/lib/docspring/models/create_submission_data_request_token_response.rb +237 -0
  79. data/lib/docspring/models/create_submission_data_request_token_response_token.rb +210 -0
  80. data/lib/docspring/models/create_submission_response.rb +237 -0
  81. data/lib/docspring/models/create_template_data.rb +188 -0
  82. data/lib/docspring/models/custom_file.rb +192 -0
  83. data/lib/docspring/models/error.rb +236 -0
  84. data/lib/docspring/models/folder.rb +210 -0
  85. data/lib/docspring/models/folders_folder.rb +192 -0
  86. data/lib/docspring/models/invalid_request.rb +238 -0
  87. data/lib/docspring/models/move_folder_data.rb +183 -0
  88. data/lib/docspring/models/move_template_data.rb +183 -0
  89. data/lib/docspring/models/pending_template.rb +343 -0
  90. data/lib/docspring/models/rename_folder_data.rb +188 -0
  91. data/lib/docspring/models/submission.rb +358 -0
  92. data/lib/docspring/models/submission_action.rb +316 -0
  93. data/lib/docspring/models/submission_batch.rb +291 -0
  94. data/lib/docspring/models/submission_batch_data.rb +217 -0
  95. data/lib/docspring/models/submission_data.rb +235 -0
  96. data/lib/docspring/models/submission_data_batch_request.rb +228 -0
  97. data/lib/docspring/models/submission_data_request.rb +422 -0
  98. data/lib/docspring/models/template.rb +372 -0
  99. data/lib/docspring/models/templatesv2_template.rb +316 -0
  100. data/lib/docspring/models/templatesv2_template_document.rb +235 -0
  101. data/lib/docspring/models/templatesv2_template_document_metadata.rb +235 -0
  102. data/lib/docspring/models/update_data_request_response.rb +237 -0
  103. data/lib/docspring/models/update_submission_data_request_data.rb +339 -0
  104. data/lib/docspring/version.rb +15 -0
  105. data/spec/api/client_integration_spec.rb +259 -0
  106. data/spec/api/pdf_api_integration_spec.rb +377 -0
  107. data/spec/api/pdf_api_spec_original.skipped.rb +397 -0
  108. data/spec/api_client_spec.rb +226 -0
  109. data/spec/configuration_spec.rb +53 -0
  110. data/spec/models/authentication_error_spec.rb +51 -0
  111. data/spec/models/authentication_success_response_spec.rb +45 -0
  112. data/spec/models/combine_pdfs_data_spec.rb +65 -0
  113. data/spec/models/combined_submission_action_spec.rb +83 -0
  114. data/spec/models/combined_submission_data_spec.rb +59 -0
  115. data/spec/models/combined_submission_spec.rb +93 -0
  116. data/spec/models/create_combined_submission_response_spec.rb +57 -0
  117. data/spec/models/create_custom_file_data_spec.rb +41 -0
  118. data/spec/models/create_custom_file_response_spec.rb +57 -0
  119. data/spec/models/create_folder_data_spec.rb +41 -0
  120. data/spec/models/create_submission_batch_response_spec.rb +69 -0
  121. data/spec/models/create_submission_batch_submissions_response_spec.rb +57 -0
  122. data/spec/models/create_submission_data_request_data_spec.rb +121 -0
  123. data/spec/models/create_submission_data_request_token_response_spec.rb +57 -0
  124. data/spec/models/create_submission_data_request_token_response_token_spec.rb +59 -0
  125. data/spec/models/create_submission_response_spec.rb +57 -0
  126. data/spec/models/create_template_data_spec.rb +41 -0
  127. data/spec/models/custom_file_spec.rb +47 -0
  128. data/spec/models/error_spec.rb +51 -0
  129. data/spec/models/folder_spec.rb +59 -0
  130. data/spec/models/folders_folder_spec.rb +47 -0
  131. data/spec/models/invalid_request_spec.rb +51 -0
  132. data/spec/models/move_folder_data_spec.rb +41 -0
  133. data/spec/models/move_template_data_spec.rb +41 -0
  134. data/spec/models/pending_template_spec.rb +129 -0
  135. data/spec/models/rename_folder_data_spec.rb +41 -0
  136. data/spec/models/submission_action_spec.rb +83 -0
  137. data/spec/models/submission_batch_data_spec.rb +59 -0
  138. data/spec/models/submission_batch_spec.rb +93 -0
  139. data/spec/models/submission_data_batch_request_spec.rb +71 -0
  140. data/spec/models/submission_data_request_spec.rb +149 -0
  141. data/spec/models/submission_data_spec.rb +71 -0
  142. data/spec/models/submission_spec.rb +123 -0
  143. data/spec/models/template_spec.rb +147 -0
  144. data/spec/models/templatesv2_template_document_metadata_spec.rb +57 -0
  145. data/spec/models/templatesv2_template_document_spec.rb +57 -0
  146. data/spec/models/templatesv2_template_spec.rb +111 -0
  147. data/spec/models/update_data_request_response_spec.rb +57 -0
  148. data/spec/models/update_submission_data_request_data_spec.rb +121 -0
  149. data/spec/spec_helper.rb +117 -0
  150. metadata +430 -0
@@ -0,0 +1,397 @@
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 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for DocSpring::PDFApi
17
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
18
+ # Please update as you see appropriate
19
+ describe 'PDFApi' do
20
+ before do
21
+ DocSpring.configure do |c|
22
+ c.username = 'api_token123'
23
+ c.password = 'testsecret123'
24
+ c.host = 'api.docspring.local:31337'
25
+ c.scheme = 'http'
26
+ end
27
+ end
28
+
29
+ let(:api_instance) { DocSpring::PDFApi.new }
30
+
31
+ after do
32
+ # run after each test
33
+ end
34
+
35
+ describe 'test an instance of PDFApi' do
36
+ it 'should create an instance of PDFApi' do
37
+ expect(api_instance).to be_instance_of(DocSpring::PDFApi)
38
+ end
39
+ end
40
+
41
+ # integration tests for batch_generate_pdf_v1
42
+ # Generates multiple PDFs
43
+ # @param template_id
44
+ # @param request_body
45
+ # @param [Hash] opts the optional parameters
46
+ # @return [Array<CreateSubmissionResponse>]
47
+ describe 'batch_generate_pdf_v1 test' do
48
+ it 'should work' do
49
+ template_id = 'tpl_000000000000000001' # String |
50
+ request_body = nil # Array<Object> |
51
+ result = api_instance.batch_generate_pdf_v1(template_id, request_body)
52
+ expect(result).to_not be_nil
53
+ end
54
+ end
55
+ # integration tests for batch_generate_pdfs
56
+ # Generates multiple PDFs
57
+ # @param submission_batch_data
58
+ # @param [Hash] opts the optional parameters
59
+ # @return [CreateSubmissionBatchResponse]
60
+ describe 'batch_generate_pdfs test' do
61
+ it 'should work' do
62
+ submission_batch_data = DocSpring::SubmissionBatchData.new # SubmissionBatchData |
63
+ result = api_instance.batch_generate_pdfs(submission_batch_data)
64
+ expect(result).to_not be_nil
65
+ end
66
+ end
67
+ # integration tests for combine_pdfs
68
+ # Merge submission PDFs, template PDFs, or custom files
69
+ # @param combine_pdfs_data
70
+ # @param [Hash] opts the optional parameters
71
+ # @return [CreateCombinedSubmissionResponse]
72
+ describe 'combine_pdfs test' do
73
+ it 'should work' do
74
+ combine_pdfs_data = DocSpring::CombinePdfsData.new # CombinePdfsData |
75
+ result = api_instance.combine_pdfs(combine_pdfs_data)
76
+ expect(result).to_not be_nil
77
+ end
78
+ end
79
+ # integration tests for combine_submissions
80
+ # Merge generated PDFs together
81
+ # @param combined_submission_data
82
+ # @param [Hash] opts the optional parameters
83
+ # @return [CreateCombinedSubmissionResponse]
84
+ describe 'combine_submissions test' do
85
+ it 'should work' do
86
+ combined_submission_data = DocSpring::CombinedSubmissionData.new # CombinedSubmissionData |
87
+ result = api_instance.combine_submissions(combined_submission_data)
88
+ expect(result).to_not be_nil
89
+ end
90
+ end
91
+ # integration tests for create_custom_file_from_upload
92
+ # Create a new custom file from a cached presign upload
93
+ # @param create_custom_file_data
94
+ # @param [Hash] opts the optional parameters
95
+ # @return [CreateCustomFileResponse]
96
+ describe 'create_custom_file_from_upload test' do
97
+ it 'should work' do
98
+ create_custom_file_data = DocSpring::CreateCustomFileData.new # CreateCustomFileData |
99
+ result = api_instance.create_custom_file_from_upload(create_custom_file_data)
100
+ expect(result).to_not be_nil
101
+ end
102
+ end
103
+ # integration tests for create_data_request_token
104
+ # Creates a new data request token for form authentication
105
+ # @param data_request_id
106
+ # @param [Hash] opts the optional parameters
107
+ # @return [CreateSubmissionDataRequestTokenResponse]
108
+ describe 'create_data_request_token test' do
109
+ it 'should work' do
110
+ data_request_id = 'drq_000000000000000001' # String |
111
+ result = api_instance.create_data_request_token(data_request_id)
112
+ expect(result).to_not be_nil
113
+ end
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 = DocSpring::CreateFolderData.new # CreateFolderData |
123
+ result = api_instance.create_folder(create_folder_data)
124
+ expect(result).to_not be_nil
125
+ end
126
+ end
127
+ # integration tests for create_template
128
+ # Upload a new PDF template with a file upload
129
+ # @param template_document
130
+ # @param template_name
131
+ # @param [Hash] opts the optional parameters
132
+ # @option opts [String] :template_parent_folder_id
133
+ # @return [PendingTemplate]
134
+ describe 'create_template test' do
135
+ it 'should work' do
136
+ template_document = File.new('/path/to/file') # File |
137
+ template_name = 'template_name_example' # String |
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)
142
+ expect(result).to_not be_nil
143
+ end
144
+ end
145
+ # integration tests for create_template_from_upload
146
+ # Create a new PDF template from a cached presign upload
147
+ # @param create_template_data
148
+ # @param [Hash] opts the optional parameters
149
+ # @return [PendingTemplate]
150
+ describe 'create_template_from_upload test' do
151
+ it 'should work' do
152
+ create_template_data = DocSpring::CreateTemplateData.new # CreateTemplateData |
153
+ result = api_instance.create_template_from_upload(create_template_data)
154
+ expect(result).to_not be_nil
155
+ end
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
169
+ # integration tests for expire_combined_submission
170
+ # Expire a combined submission
171
+ # @param combined_submission_id
172
+ # @param [Hash] opts the optional parameters
173
+ # @return [CombinedSubmission]
174
+ describe 'expire_combined_submission test' do
175
+ it 'should work' do
176
+ combined_submission_id = 'com_000000000000000001' # String |
177
+ result = api_instance.expire_combined_submission(combined_submission_id)
178
+ expect(result).to_not be_nil
179
+ end
180
+ end
181
+ # integration tests for expire_submission
182
+ # Expire a PDF submission
183
+ # @param submission_id
184
+ # @param [Hash] opts the optional parameters
185
+ # @return [Submission]
186
+ describe 'expire_submission test' do
187
+ it 'should work' do
188
+ submission_id = 'sub_000000000000000001' # String |
189
+ result = api_instance.expire_submission(submission_id)
190
+ expect(result).to_not be_nil
191
+ end
192
+ end
193
+ # integration tests for generate_pdf
194
+ # Generates a new PDF
195
+ # @param template_id
196
+ # @param submission_data
197
+ # @param [Hash] opts the optional parameters
198
+ # @return [CreateSubmissionResponse]
199
+ describe 'generate_pdf test' do
200
+ it 'should work' do
201
+ template_id = 'tpl_000000000000000001' # String |
202
+ submission_data = DocSpring::SubmissionData.new # SubmissionData |
203
+ result = api_instance.generate_pdf(template_id, submission_data)
204
+ expect(result).to_not be_nil
205
+ end
206
+ end
207
+ # integration tests for get_combined_submission
208
+ # Check the status of a combined submission (merged PDFs)
209
+ # @param combined_submission_id
210
+ # @param [Hash] opts the optional parameters
211
+ # @return [CombinedSubmission]
212
+ describe 'get_combined_submission test' do
213
+ it 'should work' do
214
+ combined_submission_id = 'com_000000000000000001' # String |
215
+ result = api_instance.get_combined_submission(combined_submission_id)
216
+ expect(result).to_not be_nil
217
+ end
218
+ end
219
+ # integration tests for get_data_request
220
+ # Look up a submission data request
221
+ # @param data_request_id
222
+ # @param [Hash] opts the optional parameters
223
+ # @return [SubmissionDataRequest]
224
+ describe 'get_data_request test' do
225
+ it 'should work' do
226
+ data_request_id = 'drq_000000000000000001' # String |
227
+ result = api_instance.get_data_request(data_request_id)
228
+ expect(result).to_not be_nil
229
+ end
230
+ end
231
+ # integration tests for get_presign_url
232
+ # Get a presigned URL so that you can upload a file to our AWS S3 bucket
233
+ # @param [Hash] opts the optional parameters
234
+ # @return [Hash<String, Object>]
235
+ describe 'get_presign_url test' do
236
+ it 'should work' do
237
+ result = api_instance.get_presign_url
238
+ expect(result).to_not be_nil
239
+ end
240
+ end
241
+ # integration tests for get_submission
242
+ # Check the status of a PDF
243
+ # @param submission_id
244
+ # @param [Hash] opts the optional parameters
245
+ # @option opts [BOOLEAN] :include_data
246
+ # @return [Submission]
247
+ describe 'get_submission test' do
248
+ it 'should work' do
249
+ submission_id = 'sub_000000000000000001' # String |
250
+ opts = {
251
+ include_data: false # BOOLEAN |
252
+ }
253
+ result = api_instance.get_submission(submission_id, opts)
254
+ expect(result).to_not be_nil
255
+ end
256
+ end
257
+ # integration tests for get_submission_batch
258
+ # Check the status of a submission batch job
259
+ # @param submission_batch_id
260
+ # @param [Hash] opts the optional parameters
261
+ # @option opts [BOOLEAN] :include_submissions
262
+ # @return [SubmissionBatch]
263
+ describe 'get_submission_batch test' do
264
+ it 'should work' do
265
+ submission_batch_id = 'sbb_000000000000000001' # String |
266
+ opts = {
267
+ include_submissions: true # BOOLEAN |
268
+ }
269
+ result = api_instance.get_submission_batch(submission_batch_id, opts)
270
+ expect(result).to_not be_nil
271
+ end
272
+ end
273
+ # integration tests for get_template
274
+ # Get a single template
275
+ # @param template_id
276
+ # @param [Hash] opts the optional parameters
277
+ # @return [Template]
278
+ describe 'get_template test' do
279
+ it 'should work' do
280
+ template_id = 'tpl_000000000000000011' # String |
281
+ result = api_instance.get_template(template_id)
282
+ expect(result).to_not be_nil
283
+ end
284
+ end
285
+ # integration tests for get_template_schema
286
+ # Fetch the JSON schema for a template
287
+ # @param template_id
288
+ # @param [Hash] opts the optional parameters
289
+ # @return [Hash<String, Object>]
290
+ describe 'get_template_schema test' do
291
+ it 'should work' do
292
+ template_id = 'tpl_000000000000000001' # String |
293
+ result = api_instance.get_template_schema(template_id)
294
+ expect(result).to_not be_nil
295
+ end
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
311
+ # integration tests for list_templates
312
+ # Get a list of all templates
313
+ # @param [Hash] opts the optional parameters
314
+ # @option opts [String] :query Search By Name
315
+ # @option opts [String] :parent_folder_id Filter By Folder Id
316
+ # @option opts [Integer] :page Default: 1
317
+ # @option opts [Integer] :per_page Default: 50
318
+ # @return [Array<Template>]
319
+ describe 'list_templates test' do
320
+ it 'should work' do
321
+ opts = {
322
+ query: '2', # String | Search By Name
323
+ parent_folder_id: 'fld_000000000000000001', # String | Filter By Folder Id
324
+ page: 2, # Integer | Default: 1
325
+ per_page: 1 # Integer | Default: 50
326
+ }
327
+ result = api_instance.list_templates(opts)
328
+ expect(result).to_not be_nil
329
+ end
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 = DocSpring::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 = DocSpring::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 = DocSpring::RenameFolderData.new # RenameFolderData |
369
+ api_instance.rename_folder(folder_id, rename_folder_data)
370
+ expect(result).to_not be_nil
371
+ end
372
+ end
373
+ # integration tests for test_authentication
374
+ # Test Authentication
375
+ # @param [Hash] opts the optional parameters
376
+ # @return [AuthenticationSuccessResponse]
377
+ describe 'test_authentication test' do
378
+ it 'should work' do
379
+ result = api_instance.test_authentication
380
+ expect(result).to_not be_nil
381
+ end
382
+ end
383
+ # integration tests for update_data_request
384
+ # Update a submission data request
385
+ # @param data_request_id
386
+ # @param update_submission_data_request_data
387
+ # @param [Hash] opts the optional parameters
388
+ # @return [UpdateDataRequestResponse]
389
+ describe 'update_data_request test' do
390
+ it 'should work' do
391
+ data_request_id = 'drq_000000000000000001' # String |
392
+ update_submission_data_request_data = DocSpring::UpdateSubmissionDataRequestData.new # UpdateSubmissionDataRequestData |
393
+ result = api_instance.update_data_request(data_request_id, update_submission_data_request_data)
394
+ expect(result).to_not be_nil
395
+ end
396
+ end
397
+ end
@@ -0,0 +1,226 @@
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 'spec_helper'
14
+
15
+ describe DocSpring::ApiClient do
16
+ context 'initialization' do
17
+ context 'URL stuff' do
18
+ context 'host' do
19
+ it 'removes http from host' do
20
+ DocSpring.configure { |c| c.host = 'http://example.com' }
21
+ expect(DocSpring::Configuration.default.host).to eq('example.com')
22
+ end
23
+
24
+ it 'removes https from host' do
25
+ DocSpring.configure { |c| c.host = 'https://wookiee.com' }
26
+ expect(DocSpring::ApiClient.default.config.host).to eq('wookiee.com')
27
+ end
28
+
29
+ it 'removes trailing path from host' do
30
+ DocSpring.configure { |c| c.host = 'hobo.com/v4' }
31
+ expect(DocSpring::Configuration.default.host).to eq('hobo.com')
32
+ end
33
+ end
34
+
35
+ context 'base_path' do
36
+ it "prepends a slash to base_path" do
37
+ DocSpring.configure { |c| c.base_path = 'v4/dog' }
38
+ expect(DocSpring::Configuration.default.base_path).to eq('/v4/dog')
39
+ end
40
+
41
+ it "doesn't prepend a slash if one is already there" do
42
+ DocSpring.configure { |c| c.base_path = '/v4/dog' }
43
+ expect(DocSpring::Configuration.default.base_path).to eq('/v4/dog')
44
+ end
45
+
46
+ it "ends up as a blank string if nil" do
47
+ DocSpring.configure { |c| c.base_path = nil }
48
+ expect(DocSpring::Configuration.default.base_path).to eq('')
49
+ end
50
+ end
51
+ end
52
+ end
53
+
54
+ describe 'params_encoding in #build_request' do
55
+ let(:config) { DocSpring::Configuration.new }
56
+ let(:api_client) { DocSpring::ApiClient.new(config) }
57
+
58
+ it 'defaults to nil' do
59
+ expect(DocSpring::Configuration.default.params_encoding).to eq(nil)
60
+ expect(config.params_encoding).to eq(nil)
61
+
62
+ request = api_client.build_request(:get, '/test')
63
+ expect(request.options[:params_encoding]).to eq(nil)
64
+ end
65
+
66
+ it 'can be customized' do
67
+ config.params_encoding = :multi
68
+ request = api_client.build_request(:get, '/test')
69
+ expect(request.options[:params_encoding]).to eq(:multi)
70
+ end
71
+ end
72
+
73
+ describe 'timeout in #build_request' do
74
+ let(:config) { DocSpring::Configuration.new }
75
+ let(:api_client) { DocSpring::ApiClient.new(config) }
76
+
77
+ it 'defaults to 0' do
78
+ expect(DocSpring::Configuration.default.timeout).to eq(0)
79
+ expect(config.timeout).to eq(0)
80
+
81
+ request = api_client.build_request(:get, '/test')
82
+ expect(request.options[:timeout]).to eq(0)
83
+ end
84
+
85
+ it 'can be customized' do
86
+ config.timeout = 100
87
+ request = api_client.build_request(:get, '/test')
88
+ expect(request.options[:timeout]).to eq(100)
89
+ end
90
+ end
91
+
92
+ describe '#deserialize' do
93
+ it "handles Array<Integer>" do
94
+ api_client = DocSpring::ApiClient.new
95
+ headers = { 'Content-Type' => 'application/json' }
96
+ response = double('response', headers: headers, body: '[12, 34]')
97
+ data = api_client.deserialize(response, 'Array<Integer>')
98
+ expect(data).to be_instance_of(Array)
99
+ expect(data).to eq([12, 34])
100
+ end
101
+
102
+ it 'handles Array<Array<Integer>>' do
103
+ api_client = DocSpring::ApiClient.new
104
+ headers = { 'Content-Type' => 'application/json' }
105
+ response = double('response', headers: headers, body: '[[12, 34], [56]]')
106
+ data = api_client.deserialize(response, 'Array<Array<Integer>>')
107
+ expect(data).to be_instance_of(Array)
108
+ expect(data).to eq([[12, 34], [56]])
109
+ end
110
+
111
+ it 'handles Hash<String, String>' do
112
+ api_client = DocSpring::ApiClient.new
113
+ headers = { 'Content-Type' => 'application/json' }
114
+ response = double('response', headers: headers, body: '{"message": "Hello"}')
115
+ data = api_client.deserialize(response, 'Hash<String, String>')
116
+ expect(data).to be_instance_of(Hash)
117
+ expect(data).to eq(:message => 'Hello')
118
+ end
119
+ end
120
+
121
+ describe "#object_to_hash" do
122
+ it 'ignores nils and includes empty arrays' do
123
+ # uncomment below to test object_to_hash for model
124
+ # api_client = DocSpring::ApiClient.new
125
+ # _model = DocSpring::ModelName.new
126
+ # update the model attribute below
127
+ # _model.id = 1
128
+ # update the expected value (hash) below
129
+ # expected = {id: 1, name: '', tags: []}
130
+ # expect(api_client.object_to_hash(_model)).to eq(expected)
131
+ end
132
+ end
133
+
134
+ describe '#build_collection_param' do
135
+ let(:param) { ['aa', 'bb', 'cc'] }
136
+ let(:api_client) { DocSpring::ApiClient.new }
137
+
138
+ it 'works for csv' do
139
+ expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
140
+ end
141
+
142
+ it 'works for ssv' do
143
+ expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
144
+ end
145
+
146
+ it 'works for tsv' do
147
+ expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
148
+ end
149
+
150
+ it 'works for pipes' do
151
+ expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
152
+ end
153
+
154
+ it 'works for multi' do
155
+ expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
156
+ end
157
+
158
+ it 'fails for invalid collection format' do
159
+ expect(proc { api_client.build_collection_param(param, :INVALID) }).to raise_error(RuntimeError, 'unknown collection format: :INVALID')
160
+ end
161
+ end
162
+
163
+ describe '#json_mime?' do
164
+ let(:api_client) { DocSpring::ApiClient.new }
165
+
166
+ it 'works' do
167
+ expect(api_client.json_mime?(nil)).to eq false
168
+ expect(api_client.json_mime?('')).to eq false
169
+
170
+ expect(api_client.json_mime?('application/json')).to eq true
171
+ expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
172
+ expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
173
+
174
+ expect(api_client.json_mime?('application/xml')).to eq false
175
+ expect(api_client.json_mime?('text/plain')).to eq false
176
+ expect(api_client.json_mime?('application/jsonp')).to eq false
177
+ end
178
+ end
179
+
180
+ describe '#select_header_accept' do
181
+ let(:api_client) { DocSpring::ApiClient.new }
182
+
183
+ it 'works' do
184
+ expect(api_client.select_header_accept(nil)).to be_nil
185
+ expect(api_client.select_header_accept([])).to be_nil
186
+
187
+ expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
188
+ expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
189
+ expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
190
+
191
+ expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
192
+ expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
193
+ end
194
+ end
195
+
196
+ describe '#select_header_content_type' do
197
+ let(:api_client) { DocSpring::ApiClient.new }
198
+
199
+ it 'works' do
200
+ expect(api_client.select_header_content_type(nil)).to eq('application/json')
201
+ expect(api_client.select_header_content_type([])).to eq('application/json')
202
+
203
+ expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
204
+ expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
205
+ expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
206
+ expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
207
+ expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
208
+ end
209
+ end
210
+
211
+ describe '#sanitize_filename' do
212
+ let(:api_client) { DocSpring::ApiClient.new }
213
+
214
+ it 'works' do
215
+ expect(api_client.sanitize_filename('sun')).to eq('sun')
216
+ expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
217
+ expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
218
+ expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
219
+ expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
220
+ expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
221
+ expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
222
+ expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
223
+ expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
224
+ end
225
+ end
226
+ end