pdf4me 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (271) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +472 -0
  4. data/Rakefile +8 -0
  5. data/docs/ActionFlow.md +8 -0
  6. data/docs/ApiUsageRes.md +11 -0
  7. data/docs/ArchiveConfig.md +11 -0
  8. data/docs/ArchiveJobReq.md +12 -0
  9. data/docs/ArchiveJobRes.md +9 -0
  10. data/docs/Color.md +10 -0
  11. data/docs/ConvertApi.md +102 -0
  12. data/docs/ConvertToPdf.md +10 -0
  13. data/docs/ConvertToPdfAction.md +10 -0
  14. data/docs/ConvertToPdfRes.md +8 -0
  15. data/docs/CreateImages.md +10 -0
  16. data/docs/CreateImagesRes.md +8 -0
  17. data/docs/CreatePdfA.md +10 -0
  18. data/docs/CreatePdfARes.md +8 -0
  19. data/docs/CustomCMSConfig.md +23 -0
  20. data/docs/DocAction.md +8 -0
  21. data/docs/DocLog.md +12 -0
  22. data/docs/DocMetadata.md +16 -0
  23. data/docs/Document.md +16 -0
  24. data/docs/DocumentApi.md +203 -0
  25. data/docs/DropDocumentReq.md +20 -0
  26. data/docs/DropDocumentRes.md +15 -0
  27. data/docs/ExecutionTrigger.md +10 -0
  28. data/docs/Extract.md +10 -0
  29. data/docs/ExtractAction.md +9 -0
  30. data/docs/ExtractApi.md +102 -0
  31. data/docs/ExtractRes.md +8 -0
  32. data/docs/GetDocumentListRes.md +13 -0
  33. data/docs/GetDocumentReq.md +14 -0
  34. data/docs/GetDocumentRes.md +14 -0
  35. data/docs/IFormFile.md +13 -0
  36. data/docs/Image.md +15 -0
  37. data/docs/ImageAction.md +30 -0
  38. data/docs/ImageApi.md +107 -0
  39. data/docs/Job.md +10 -0
  40. data/docs/JobApi.md +197 -0
  41. data/docs/JobConfig.md +18 -0
  42. data/docs/JobConfigRes.md +8 -0
  43. data/docs/KeyValuePairStringObject.md +9 -0
  44. data/docs/KeyValuePairStringString.md +9 -0
  45. data/docs/ManagementApi.md +92 -0
  46. data/docs/Merge.md +10 -0
  47. data/docs/MergeAction.md +8 -0
  48. data/docs/MergeApi.md +102 -0
  49. data/docs/MergeRes.md +8 -0
  50. data/docs/Notification.md +9 -0
  51. data/docs/OcrAction.md +12 -0
  52. data/docs/OcrApi.md +57 -0
  53. data/docs/Optimize.md +10 -0
  54. data/docs/OptimizeAction.md +35 -0
  55. data/docs/OptimizeApi.md +103 -0
  56. data/docs/OptimizeRes.md +9 -0
  57. data/docs/Page.md +14 -0
  58. data/docs/PageSelection.md +10 -0
  59. data/docs/Pdf4meAction.md +12 -0
  60. data/docs/Pdf4meDocument.md +32 -0
  61. data/docs/Pdf4meException.md +8 -0
  62. data/docs/PdfAAction.md +14 -0
  63. data/docs/PdfAApi.md +102 -0
  64. data/docs/PdfFont.md +9 -0
  65. data/docs/Pricing.md +13 -0
  66. data/docs/ProduceDocuments.md +14 -0
  67. data/docs/ProduceDocumentsRes.md +8 -0
  68. data/docs/ProduceOutput.md +8 -0
  69. data/docs/RGBSet.md +10 -0
  70. data/docs/RecognizeDocument.md +10 -0
  71. data/docs/RecognizeDocumentRes.md +9 -0
  72. data/docs/Rectangle.md +11 -0
  73. data/docs/Rotate.md +10 -0
  74. data/docs/RunJobRes.md +10 -0
  75. data/docs/SignatureConfig.md +7 -0
  76. data/docs/Split.md +10 -0
  77. data/docs/SplitAction.md +11 -0
  78. data/docs/SplitApi.md +103 -0
  79. data/docs/SplitRes.md +8 -0
  80. data/docs/Stamp.md +10 -0
  81. data/docs/StampAction.md +22 -0
  82. data/docs/StampApi.md +110 -0
  83. data/docs/StampRes.md +8 -0
  84. data/docs/StorageFolder.md +10 -0
  85. data/docs/Text.md +17 -0
  86. data/docs/Transform.md +13 -0
  87. data/docs/Translate.md +9 -0
  88. data/docs/UserFingerprint.md +9 -0
  89. data/docs/VersionRes.md +8 -0
  90. data/docs/java.md +425 -0
  91. data/git_push.sh +55 -0
  92. data/lib/pdf4me.rb +124 -0
  93. data/lib/pdf4me/api/convert_api.rb +130 -0
  94. data/lib/pdf4me/api/document_api.rb +218 -0
  95. data/lib/pdf4me/api/extract_api.rb +131 -0
  96. data/lib/pdf4me/api/image_api.rb +139 -0
  97. data/lib/pdf4me/api/job_api.rb +223 -0
  98. data/lib/pdf4me/api/management_api.rb +117 -0
  99. data/lib/pdf4me/api/merge_api.rb +131 -0
  100. data/lib/pdf4me/api/ocr_api.rb +74 -0
  101. data/lib/pdf4me/api/optimize_api.rb +139 -0
  102. data/lib/pdf4me/api/pdf_a_api.rb +134 -0
  103. data/lib/pdf4me/api/split_api.rb +135 -0
  104. data/lib/pdf4me/api/stamp_api.rb +159 -0
  105. data/lib/pdf4me/api_client.rb +380 -0
  106. data/lib/pdf4me/api_error.rb +38 -0
  107. data/lib/pdf4me/configuration.rb +109 -0
  108. data/lib/pdf4me/models/action_flow.rb +190 -0
  109. data/lib/pdf4me/models/api_usage_res.rb +219 -0
  110. data/lib/pdf4me/models/archive_config.rb +226 -0
  111. data/lib/pdf4me/models/archive_job_req.rb +249 -0
  112. data/lib/pdf4me/models/archive_job_res.rb +207 -0
  113. data/lib/pdf4me/models/color.rb +206 -0
  114. data/lib/pdf4me/models/convert_to_pdf.rb +209 -0
  115. data/lib/pdf4me/models/convert_to_pdf_action.rb +253 -0
  116. data/lib/pdf4me/models/convert_to_pdf_res.rb +189 -0
  117. data/lib/pdf4me/models/create_images.rb +209 -0
  118. data/lib/pdf4me/models/create_images_res.rb +189 -0
  119. data/lib/pdf4me/models/create_pdf_a.rb +209 -0
  120. data/lib/pdf4me/models/create_pdf_a_res.rb +189 -0
  121. data/lib/pdf4me/models/custom_cms_config.rb +323 -0
  122. data/lib/pdf4me/models/doc_action.rb +190 -0
  123. data/lib/pdf4me/models/doc_log.rb +257 -0
  124. data/lib/pdf4me/models/doc_metadata.rb +285 -0
  125. data/lib/pdf4me/models/document.rb +285 -0
  126. data/lib/pdf4me/models/drop_document_req.rb +348 -0
  127. data/lib/pdf4me/models/drop_document_res.rb +260 -0
  128. data/lib/pdf4me/models/execution_trigger.rb +206 -0
  129. data/lib/pdf4me/models/extract.rb +207 -0
  130. data/lib/pdf4me/models/extract_action.rb +201 -0
  131. data/lib/pdf4me/models/extract_res.rb +188 -0
  132. data/lib/pdf4me/models/get_document_list_res.rb +237 -0
  133. data/lib/pdf4me/models/get_document_req.rb +243 -0
  134. data/lib/pdf4me/models/get_document_res.rb +246 -0
  135. data/lib/pdf4me/models/i_form_file.rb +235 -0
  136. data/lib/pdf4me/models/image.rb +300 -0
  137. data/lib/pdf4me/models/image_action.rb +513 -0
  138. data/lib/pdf4me/models/job.rb +213 -0
  139. data/lib/pdf4me/models/job_config.rb +298 -0
  140. data/lib/pdf4me/models/job_config_res.rb +193 -0
  141. data/lib/pdf4me/models/key_value_pair_string_object.rb +197 -0
  142. data/lib/pdf4me/models/key_value_pair_string_string.rb +197 -0
  143. data/lib/pdf4me/models/merge.rb +209 -0
  144. data/lib/pdf4me/models/merge_action.rb +190 -0
  145. data/lib/pdf4me/models/merge_res.rb +188 -0
  146. data/lib/pdf4me/models/notification.rb +199 -0
  147. data/lib/pdf4me/models/ocr_action.rb +259 -0
  148. data/lib/pdf4me/models/optimize.rb +209 -0
  149. data/lib/pdf4me/models/optimize_action.rb +514 -0
  150. data/lib/pdf4me/models/optimize_res.rb +199 -0
  151. data/lib/pdf4me/models/page.rb +258 -0
  152. data/lib/pdf4me/models/page_selection.rb +246 -0
  153. data/lib/pdf4me/models/pdf4me_action.rb +259 -0
  154. data/lib/pdf4me/models/pdf4me_document.rb +511 -0
  155. data/lib/pdf4me/models/pdf4me_exception.rb +189 -0
  156. data/lib/pdf4me/models/pdf_a_action.rb +297 -0
  157. data/lib/pdf4me/models/pdf_font.rb +213 -0
  158. data/lib/pdf4me/models/pricing.rb +278 -0
  159. data/lib/pdf4me/models/produce_documents.rb +251 -0
  160. data/lib/pdf4me/models/produce_documents_res.rb +191 -0
  161. data/lib/pdf4me/models/produce_output.rb +221 -0
  162. data/lib/pdf4me/models/recognize_document.rb +209 -0
  163. data/lib/pdf4me/models/recognize_document_res.rb +198 -0
  164. data/lib/pdf4me/models/rectangle.rb +215 -0
  165. data/lib/pdf4me/models/rgb_set.rb +206 -0
  166. data/lib/pdf4me/models/rotate.rb +221 -0
  167. data/lib/pdf4me/models/run_job_res.rb +215 -0
  168. data/lib/pdf4me/models/signature_config.rb +179 -0
  169. data/lib/pdf4me/models/split.rb +207 -0
  170. data/lib/pdf4me/models/split_action.rb +219 -0
  171. data/lib/pdf4me/models/split_res.rb +190 -0
  172. data/lib/pdf4me/models/stamp.rb +209 -0
  173. data/lib/pdf4me/models/stamp_action.rb +387 -0
  174. data/lib/pdf4me/models/stamp_res.rb +189 -0
  175. data/lib/pdf4me/models/storage_folder.rb +239 -0
  176. data/lib/pdf4me/models/text.rb +320 -0
  177. data/lib/pdf4me/models/transform.rb +263 -0
  178. data/lib/pdf4me/models/translate.rb +207 -0
  179. data/lib/pdf4me/models/user_fingerprint.rb +197 -0
  180. data/lib/pdf4me/models/version_res.rb +188 -0
  181. data/lib/pdf4me/version.rb +15 -0
  182. data/pdf4me.gemspec +47 -0
  183. data/spec/api/convert_api_spec.rb +60 -0
  184. data/spec/api/document_api_spec.rb +83 -0
  185. data/spec/api/extract_api_spec.rb +60 -0
  186. data/spec/api/image_api_spec.rb +62 -0
  187. data/spec/api/job_api_spec.rb +82 -0
  188. data/spec/api/management_api_spec.rb +57 -0
  189. data/spec/api/merge_api_spec.rb +60 -0
  190. data/spec/api/ocr_api_spec.rb +47 -0
  191. data/spec/api/optimize_api_spec.rb +60 -0
  192. data/spec/api/pdf_a_api_spec.rb +60 -0
  193. data/spec/api/split_api_spec.rb +60 -0
  194. data/spec/api/stamp_api_spec.rb +63 -0
  195. data/spec/api_client_spec.rb +226 -0
  196. data/spec/configuration_spec.rb +42 -0
  197. data/spec/models/action_flow_spec.rb +42 -0
  198. data/spec/models/api_usage_res_spec.rb +60 -0
  199. data/spec/models/archive_config_spec.rb +60 -0
  200. data/spec/models/archive_job_req_spec.rb +66 -0
  201. data/spec/models/archive_job_res_spec.rb +48 -0
  202. data/spec/models/color_spec.rb +54 -0
  203. data/spec/models/convert_to_pdf_action_spec.rb +62 -0
  204. data/spec/models/convert_to_pdf_res_spec.rb +42 -0
  205. data/spec/models/convert_to_pdf_spec.rb +54 -0
  206. data/spec/models/create_images_res_spec.rb +42 -0
  207. data/spec/models/create_images_spec.rb +54 -0
  208. data/spec/models/create_pdf_a_res_spec.rb +42 -0
  209. data/spec/models/create_pdf_a_spec.rb +54 -0
  210. data/spec/models/custom_cms_config_spec.rb +132 -0
  211. data/spec/models/doc_action_spec.rb +42 -0
  212. data/spec/models/doc_log_spec.rb +70 -0
  213. data/spec/models/doc_metadata_spec.rb +90 -0
  214. data/spec/models/document_spec.rb +90 -0
  215. data/spec/models/drop_document_req_spec.rb +118 -0
  216. data/spec/models/drop_document_res_spec.rb +84 -0
  217. data/spec/models/execution_trigger_spec.rb +54 -0
  218. data/spec/models/extract_action_spec.rb +48 -0
  219. data/spec/models/extract_res_spec.rb +42 -0
  220. data/spec/models/extract_spec.rb +54 -0
  221. data/spec/models/get_document_list_res_spec.rb +72 -0
  222. data/spec/models/get_document_req_spec.rb +78 -0
  223. data/spec/models/get_document_res_spec.rb +78 -0
  224. data/spec/models/i_form_file_spec.rb +72 -0
  225. data/spec/models/image_action_spec.rb +206 -0
  226. data/spec/models/image_spec.rb +88 -0
  227. data/spec/models/job_config_res_spec.rb +42 -0
  228. data/spec/models/job_config_spec.rb +102 -0
  229. data/spec/models/job_spec.rb +54 -0
  230. data/spec/models/key_value_pair_string_object_spec.rb +48 -0
  231. data/spec/models/key_value_pair_string_string_spec.rb +48 -0
  232. data/spec/models/merge_action_spec.rb +42 -0
  233. data/spec/models/merge_res_spec.rb +42 -0
  234. data/spec/models/merge_spec.rb +54 -0
  235. data/spec/models/notification_spec.rb +48 -0
  236. data/spec/models/ocr_action_spec.rb +70 -0
  237. data/spec/models/optimize_action_spec.rb +228 -0
  238. data/spec/models/optimize_res_spec.rb +48 -0
  239. data/spec/models/optimize_spec.rb +54 -0
  240. data/spec/models/page_selection_spec.rb +58 -0
  241. data/spec/models/page_spec.rb +78 -0
  242. data/spec/models/pdf4me_action_spec.rb +70 -0
  243. data/spec/models/pdf4me_document_spec.rb +202 -0
  244. data/spec/models/pdf4me_exception_spec.rb +42 -0
  245. data/spec/models/pdf_a_action_spec.rb +86 -0
  246. data/spec/models/pdf_font_spec.rb +48 -0
  247. data/spec/models/pricing_spec.rb +80 -0
  248. data/spec/models/produce_documents_res_spec.rb +42 -0
  249. data/spec/models/produce_documents_spec.rb +78 -0
  250. data/spec/models/produce_output_spec.rb +46 -0
  251. data/spec/models/recognize_document_res_spec.rb +48 -0
  252. data/spec/models/recognize_document_spec.rb +54 -0
  253. data/spec/models/rectangle_spec.rb +60 -0
  254. data/spec/models/rgb_set_spec.rb +54 -0
  255. data/spec/models/rotate_spec.rb +54 -0
  256. data/spec/models/run_job_res_spec.rb +54 -0
  257. data/spec/models/signature_config_spec.rb +36 -0
  258. data/spec/models/split_action_spec.rb +60 -0
  259. data/spec/models/split_res_spec.rb +42 -0
  260. data/spec/models/split_spec.rb +54 -0
  261. data/spec/models/stamp_action_spec.rb +142 -0
  262. data/spec/models/stamp_res_spec.rb +42 -0
  263. data/spec/models/stamp_spec.rb +54 -0
  264. data/spec/models/storage_folder_spec.rb +58 -0
  265. data/spec/models/text_spec.rb +104 -0
  266. data/spec/models/transform_spec.rb +72 -0
  267. data/spec/models/translate_spec.rb +48 -0
  268. data/spec/models/user_fingerprint_spec.rb +48 -0
  269. data/spec/models/version_res_spec.rb +42 -0
  270. data/spec/spec_helper.rb +111 -0
  271. metadata +594 -0
@@ -0,0 +1,134 @@
1
+ =begin
2
+ #DmsApi
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.0
10
+
11
+ =end
12
+
13
+ require "uri"
14
+
15
+ module Pdf4me
16
+ class PdfAApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+
23
+ #
24
+ #
25
+ # @param [Hash] opts the optional parameters
26
+ # @option opts [String] :pdf_compliance
27
+ # @option opts [String] :file
28
+ # @return [File]
29
+ def create_pdf_a(opts = {})
30
+ data, _status_code, _headers = create_pdf_a_with_http_info(opts)
31
+ return data
32
+ end
33
+
34
+ #
35
+ #
36
+ # @param [Hash] opts the optional parameters
37
+ # @option opts [String] :pdf_compliance
38
+ # @option opts [String] :file
39
+ # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
40
+ def create_pdf_a_with_http_info(opts = {})
41
+ if @api_client.config.debugging
42
+ @api_client.config.logger.debug "Calling API: PdfAApi.create_pdf_a ..."
43
+ end
44
+ if @api_client.config.client_side_validation && opts[:'pdf_compliance'] && !['pdfA1b', 'pdfA1a', 'pdfA2b', 'pdfA2u', 'pdfA2a', 'pdfA3b', 'pdfA3u', 'pdfA3a'].include?(opts[:'pdf_compliance'])
45
+ fail ArgumentError, 'invalid value for "pdf_compliance", must be one of pdfA1b, pdfA1a, pdfA2b, pdfA2u, pdfA2a, pdfA3b, pdfA3u, pdfA3a'
46
+ end
47
+ # resource path
48
+ local_var_path = "/PdfA/CreatePdfA"
49
+
50
+ # query parameters
51
+ query_params = {}
52
+ # query_params[:'pdfCompliance'] = opts[:'pdf_compliance'] if !opts[:'pdf_compliance'].nil?
53
+ # query_params[:'file'] = opts[:'file'] if !opts[:'file'].nil?
54
+
55
+ # header parameters
56
+ header_params = {}
57
+ # HTTP header 'Accept' (if needed)
58
+ header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
59
+ header_params['Content-Type'] ='multipart/form-data'
60
+
61
+ # form parameters
62
+ form_params = {
63
+ pdfCompliance: opts[:pdf_compliance],
64
+ file: opts[:file]
65
+ }
66
+
67
+ # http body (model)
68
+ post_body = nil
69
+ auth_names = []
70
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
71
+ :header_params => header_params,
72
+ :query_params => query_params,
73
+ :form_params => form_params,
74
+ :body => post_body,
75
+ :auth_names => auth_names,
76
+ :return_type => 'File')
77
+ if @api_client.config.debugging
78
+ @api_client.config.logger.debug "API called: PdfAApi#create_pdf_a\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
79
+ end
80
+ return data, status_code, headers
81
+ end
82
+
83
+ #
84
+ #
85
+ # @param [Hash] opts the optional parameters
86
+ # @option opts [CreatePdfA] :req
87
+ # @return [CreatePdfARes]
88
+ def pdf_a(opts = {})
89
+ data, _status_code, _headers = pdf_a_with_http_info(opts)
90
+ return data
91
+ end
92
+
93
+ #
94
+ #
95
+ # @param [Hash] opts the optional parameters
96
+ # @option opts [CreatePdfA] :req
97
+ # @return [Array<(CreatePdfARes, Fixnum, Hash)>] CreatePdfARes data, response status code and response headers
98
+ def pdf_a_with_http_info(opts = {})
99
+ if @api_client.config.debugging
100
+ @api_client.config.logger.debug "Calling API: PdfAApi.pdf_a ..."
101
+ end
102
+ # resource path
103
+ local_var_path = "/PdfA/PdfA"
104
+
105
+ # query parameters
106
+ query_params = {}
107
+
108
+ # header parameters
109
+ header_params = {}
110
+ # HTTP header 'Accept' (if needed)
111
+ header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/json', 'text/json', 'application/bson'])
112
+ # HTTP header 'Content-Type'
113
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json-patch+json', 'application/json', 'text/json', 'application/*+json', 'application/bson'])
114
+
115
+ # form parameters
116
+ form_params = {}
117
+
118
+ # http body (model)
119
+ post_body = @api_client.object_to_http_body(opts[:'req'])
120
+ auth_names = []
121
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
122
+ :header_params => header_params,
123
+ :query_params => query_params,
124
+ :form_params => form_params,
125
+ :body => post_body,
126
+ :auth_names => auth_names,
127
+ :return_type => 'CreatePdfARes')
128
+ if @api_client.config.debugging
129
+ @api_client.config.logger.debug "API called: PdfAApi#pdf_a\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
130
+ end
131
+ return data, status_code, headers
132
+ end
133
+ end
134
+ end
@@ -0,0 +1,135 @@
1
+ =begin
2
+ #DmsApi
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.0
10
+
11
+ =end
12
+
13
+ require "uri"
14
+
15
+ module Pdf4me
16
+ class SplitApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+
23
+ #
24
+ #
25
+ # @param [Hash] opts the optional parameters
26
+ # @option opts [Split] :req
27
+ # @return [SplitRes]
28
+ def split(opts = {})
29
+ data, _status_code, _headers = split_with_http_info(opts)
30
+ return data
31
+ end
32
+
33
+ #
34
+ #
35
+ # @param [Hash] opts the optional parameters
36
+ # @option opts [Split] :req
37
+ # @return [Array<(SplitRes, Fixnum, Hash)>] SplitRes data, response status code and response headers
38
+ def split_with_http_info(opts = {})
39
+ if @api_client.config.debugging
40
+ @api_client.config.logger.debug "Calling API: SplitApi.split ..."
41
+ end
42
+ # resource path
43
+ local_var_path = "/Split/Split"
44
+
45
+ # query parameters
46
+ query_params = {}
47
+
48
+ # header parameters
49
+ header_params = {}
50
+ # HTTP header 'Accept' (if needed)
51
+ header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/json', 'text/json', 'application/bson'])
52
+ # HTTP header 'Content-Type'
53
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json-patch+json', 'application/json', 'text/json', 'application/*+json', 'application/bson'])
54
+
55
+ # form parameters
56
+ form_params = {}
57
+
58
+ # http body (model)
59
+ post_body = @api_client.object_to_http_body(opts[:'req'])
60
+ auth_names = []
61
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
62
+ :header_params => header_params,
63
+ :query_params => query_params,
64
+ :form_params => form_params,
65
+ :body => post_body,
66
+ :auth_names => auth_names,
67
+ :return_type => 'SplitRes')
68
+ if @api_client.config.debugging
69
+ @api_client.config.logger.debug "API called: SplitApi#split\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
70
+ end
71
+ return data, status_code, headers
72
+ end
73
+
74
+ #
75
+ #
76
+ # @param page_nr
77
+ # @param [Hash] opts the optional parameters
78
+ # @option opts [String] :file
79
+ # @return [SplitRes]
80
+ def split_by_page_nr(page_nr, opts = {})
81
+ data, _status_code, _headers = split_by_page_nr_with_http_info(page_nr, opts)
82
+ return data
83
+ end
84
+
85
+ #
86
+ #
87
+ # @param page_nr
88
+ # @param [Hash] opts the optional parameters
89
+ # @option opts [String] :file
90
+ # @return [Array<(SplitRes, Fixnum, Hash)>] SplitRes data, response status code and response headers
91
+ def split_by_page_nr_with_http_info(page_nr, opts = {})
92
+ if @api_client.config.debugging
93
+ @api_client.config.logger.debug "Calling API: SplitApi.split_by_page_nr ..."
94
+ end
95
+ # verify the required parameter 'page_nr' is set
96
+ if @api_client.config.client_side_validation && page_nr.nil?
97
+ fail ArgumentError, "Missing the required parameter 'page_nr' when calling SplitApi.split_by_page_nr"
98
+ end
99
+ # resource path
100
+ local_var_path = "/Split/SplitByPageNr"
101
+
102
+ # query parameters
103
+ query_params = {}
104
+ # query_params[:'pageNr'] = page_nr
105
+ # query_params[:'file'] = opts[:'file'] if !opts[:'file'].nil?
106
+
107
+ # header parameters
108
+ header_params = {}
109
+ # HTTP header 'Accept' (if needed)
110
+ header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/json', 'text/json', 'application/bson'])
111
+ header_params['Content-Type'] ='multipart/form-data'
112
+
113
+ # form parameters
114
+ form_params = {
115
+ pageNr: page_nr,
116
+ file: opts[:file]
117
+ }
118
+
119
+ # http body (model)
120
+ post_body = nil
121
+ auth_names = []
122
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
123
+ :header_params => header_params,
124
+ :query_params => query_params,
125
+ :form_params => form_params,
126
+ :body => post_body,
127
+ :auth_names => auth_names,
128
+ :return_type => 'SplitRes')
129
+ if @api_client.config.debugging
130
+ @api_client.config.logger.debug "API called: SplitApi#split_by_page_nr\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
131
+ end
132
+ return data, status_code, headers
133
+ end
134
+ end
135
+ end
@@ -0,0 +1,159 @@
1
+ =begin
2
+ #DmsApi
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.0
10
+
11
+ =end
12
+
13
+ require "uri"
14
+
15
+ module Pdf4me
16
+ class StampApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+
23
+ #
24
+ #
25
+ # @param [Hash] opts the optional parameters
26
+ # @option opts [Stamp] :req
27
+ # @return [StampRes]
28
+ def stamp(opts = {})
29
+ data, _status_code, _headers = stamp_with_http_info(opts)
30
+ return data
31
+ end
32
+
33
+ #
34
+ #
35
+ # @param [Hash] opts the optional parameters
36
+ # @option opts [Stamp] :req
37
+ # @return [Array<(StampRes, Fixnum, Hash)>] StampRes data, response status code and response headers
38
+ def stamp_with_http_info(opts = {})
39
+ if @api_client.config.debugging
40
+ @api_client.config.logger.debug "Calling API: StampApi.stamp ..."
41
+ end
42
+ # resource path
43
+ local_var_path = "/Stamp/Stamp"
44
+
45
+ # query parameters
46
+ query_params = {}
47
+
48
+ # header parameters
49
+ header_params = {}
50
+ # HTTP header 'Accept' (if needed)
51
+ header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/json', 'text/json', 'application/bson'])
52
+ # HTTP header 'Content-Type'
53
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json-patch+json', 'application/json', 'text/json', 'application/*+json', 'application/bson'])
54
+
55
+ # form parameters
56
+ form_params = {}
57
+
58
+ # http body (model)
59
+ post_body = @api_client.object_to_http_body(opts[:'req'])
60
+ auth_names = []
61
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
62
+ :header_params => header_params,
63
+ :query_params => query_params,
64
+ :form_params => form_params,
65
+ :body => post_body,
66
+ :auth_names => auth_names,
67
+ :return_type => 'StampRes')
68
+ if @api_client.config.debugging
69
+ @api_client.config.logger.debug "API called: StampApi#stamp\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
70
+ end
71
+ return data, status_code, headers
72
+ end
73
+
74
+ #
75
+ #
76
+ # @param align_x
77
+ # @param align_y
78
+ # @param [Hash] opts the optional parameters
79
+ # @option opts [String] :text
80
+ # @option opts [String] :pages
81
+ # @option opts [String] :file
82
+ # @return [File]
83
+ def text_stamp(align_x, align_y, opts = {})
84
+ data, _status_code, _headers = text_stamp_with_http_info(align_x, align_y, opts)
85
+ return data
86
+ end
87
+
88
+ #
89
+ #
90
+ # @param align_x
91
+ # @param align_y
92
+ # @param [Hash] opts the optional parameters
93
+ # @option opts [String] :text
94
+ # @option opts [String] :pages
95
+ # @option opts [String] :file
96
+ # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
97
+ def text_stamp_with_http_info(align_x, align_y, opts = {})
98
+ if @api_client.config.debugging
99
+ @api_client.config.logger.debug "Calling API: StampApi.text_stamp ..."
100
+ end
101
+ # verify the required parameter 'align_x' is set
102
+ if @api_client.config.client_side_validation && align_x.nil?
103
+ fail ArgumentError, "Missing the required parameter 'align_x' when calling StampApi.text_stamp"
104
+ end
105
+ # verify enum value
106
+ if @api_client.config.client_side_validation && !['left', 'center', 'right'].include?(align_x)
107
+ fail ArgumentError, "invalid value for 'align_x', must be one of left, center, right"
108
+ end
109
+ # verify the required parameter 'align_y' is set
110
+ if @api_client.config.client_side_validation && align_y.nil?
111
+ fail ArgumentError, "Missing the required parameter 'align_y' when calling StampApi.text_stamp"
112
+ end
113
+ # verify enum value
114
+ if @api_client.config.client_side_validation && !['top', 'middle', 'bottom'].include?(align_y)
115
+ fail ArgumentError, "invalid value for 'align_y', must be one of top, middle, bottom"
116
+ end
117
+ # resource path
118
+ local_var_path = "/Stamp/TextStamp"
119
+
120
+ # query parameters
121
+ query_params = {}
122
+ # query_params[:'alignX'] = align_x
123
+ # query_params[:'alignY'] = align_y
124
+ # query_params[:'text'] = opts[:'text'] if !opts[:'text'].nil?
125
+ # query_params[:'pages'] = opts[:'pages'] if !opts[:'pages'].nil?
126
+ # query_params[:'file'] = opts[:'file'] if !opts[:'file'].nil?
127
+
128
+ # header parameters
129
+ header_params = {}
130
+ # HTTP header 'Accept' (if needed)
131
+ header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
132
+ header_params['Content-Type'] ='multipart/form-data'
133
+
134
+ # form parameters
135
+ form_params = {
136
+ alignX: align_x,
137
+ alignY: align_y,
138
+ text: opts[:text],
139
+ pages: opts[:pages],
140
+ file: opts[:file]
141
+ }
142
+
143
+ # http body (model)
144
+ post_body = nil
145
+ auth_names = []
146
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
147
+ :header_params => header_params,
148
+ :query_params => query_params,
149
+ :form_params => form_params,
150
+ :body => post_body,
151
+ :auth_names => auth_names,
152
+ :return_type => 'File')
153
+ if @api_client.config.debugging
154
+ @api_client.config.logger.debug "API called: StampApi#text_stamp\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
155
+ end
156
+ return data, status_code, headers
157
+ end
158
+ end
159
+ end
@@ -0,0 +1,380 @@
1
+ =begin
2
+ #DmsApi
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'json'
15
+ require 'logger'
16
+ require 'tempfile'
17
+ require 'typhoeus'
18
+ require 'uri'
19
+
20
+ module Pdf4me
21
+ class ApiClient
22
+ # The Configuration object holding settings to be used in the API client.
23
+ attr_accessor :config
24
+
25
+ # Defines the headers to be used in HTTP requests of all API calls by default.
26
+ #
27
+ # @return [Hash]
28
+ attr_accessor :default_headers
29
+
30
+ # Initializes the ApiClient
31
+ # @option config [Configuration] Configuration for initializing the object, default to Configuration.default
32
+ def initialize(config = Configuration.default)
33
+ @config = config
34
+ @user_agent = "Swagger-Codegen/#{VERSION}/ruby"
35
+ @default_headers = {
36
+ 'Content-Type' => "application/json",
37
+ 'User-Agent' => @user_agent,
38
+ 'Authorization' => "Bearer #{config.access_token}"
39
+ }
40
+ end
41
+
42
+ def self.default
43
+ @@default ||= ApiClient.new
44
+ end
45
+
46
+ # Call an API with given options.
47
+ #
48
+ # @return [Array<(Object, Fixnum, Hash)>] an array of 3 elements:
49
+ # the data deserialized from response body (could be nil), response status code and response headers.
50
+ def call_api(http_method, path, opts = {})
51
+ request = build_request(http_method, path, opts)
52
+ response = request.run
53
+
54
+ if @config.debugging
55
+ @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
56
+ end
57
+
58
+ unless response.success?
59
+ if response.timed_out?
60
+ fail ApiError.new('Connection timed out')
61
+ elsif response.code == 0
62
+ # Errors from libcurl will be made visible here
63
+ fail ApiError.new(:code => 0,
64
+ :message => response.return_message)
65
+ else
66
+ fail ApiError.new(:code => response.code,
67
+ :response_headers => response.headers,
68
+ :response_body => response.body),
69
+ response.status_message
70
+ end
71
+ end
72
+
73
+ if opts[:return_type]
74
+ data = deserialize(response, opts[:return_type])
75
+ else
76
+ data = nil
77
+ end
78
+ return data, response.code, response.headers
79
+ end
80
+
81
+ # Builds the HTTP request
82
+ #
83
+ # @param [String] http_method HTTP method/verb (e.g. POST)
84
+ # @param [String] path URL path (e.g. /account/new)
85
+ # @option opts [Hash] :header_params Header parameters
86
+ # @option opts [Hash] :query_params Query parameters
87
+ # @option opts [Hash] :form_params Query parameters
88
+ # @option opts [Object] :body HTTP body (JSON/XML)
89
+ # @return [Typhoeus::Request] A Typhoeus Request
90
+ def build_request(http_method, path, opts = {})
91
+ url = build_request_url(path)
92
+ http_method = http_method.to_sym.downcase
93
+
94
+ header_params = @default_headers.merge(opts[:header_params] || {})
95
+ query_params = opts[:query_params] || {}
96
+ form_params = opts[:form_params] || {}
97
+
98
+ req_opts = {
99
+ :method => http_method,
100
+ :headers => header_params,
101
+ :params => query_params,
102
+ :params_encoding => @config.params_encoding,
103
+ :timeout => @config.timeout,
104
+ :ssl_verifypeer => true,
105
+ :ssl_verifyhost => 2,
106
+ :verbose => @config.debugging
107
+ }
108
+
109
+ if [:post, :patch, :put, :delete].include?(http_method)
110
+ req_body = build_request_body(header_params, form_params, opts[:body])
111
+ req_opts.update :body => req_body
112
+ if @config.debugging
113
+ @config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
114
+ end
115
+ end
116
+
117
+ request = Typhoeus::Request.new(url, req_opts)
118
+ download_file(request) if opts[:return_type] == 'File'
119
+ request
120
+ end
121
+
122
+ # Check if the given MIME is a JSON MIME.
123
+ # JSON MIME examples:
124
+ # application/json
125
+ # application/json; charset=UTF8
126
+ # APPLICATION/JSON
127
+ # */*
128
+ # @param [String] mime MIME
129
+ # @return [Boolean] True if the MIME is application/json
130
+ def json_mime?(mime)
131
+ (mime == "*/*") || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
132
+ end
133
+
134
+ # Deserialize the response to the given return type.
135
+ #
136
+ # @param [Response] response HTTP response
137
+ # @param [String] return_type some examples: "User", "Array[User]", "Hash[String,Integer]"
138
+ def deserialize(response, return_type)
139
+ body = response.body
140
+
141
+ # handle file downloading - return the File instance processed in request callbacks
142
+ # note that response body is empty when the file is written in chunks in request on_body callback
143
+ return @tempfile if return_type == 'File'
144
+
145
+ return nil if body.nil? || body.empty?
146
+
147
+ # return response body directly for String return type
148
+ return body if return_type == 'String'
149
+
150
+ # ensuring a default content type
151
+ content_type = response.headers['Content-Type'] || 'application/json'
152
+
153
+ fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type)
154
+
155
+ begin
156
+ data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
157
+ rescue JSON::ParserError => e
158
+ if %w(String Date DateTime).include?(return_type)
159
+ data = body
160
+ else
161
+ raise e
162
+ end
163
+ end
164
+
165
+ convert_to_type data, return_type
166
+ end
167
+
168
+ # Convert data to the given return type.
169
+ # @param [Object] data Data to be converted
170
+ # @param [String] return_type Return type
171
+ # @return [Mixed] Data in a particular type
172
+ def convert_to_type(data, return_type)
173
+ return nil if data.nil?
174
+ case return_type
175
+ when 'String'
176
+ data.to_s
177
+ when 'Integer'
178
+ data.to_i
179
+ when 'Float'
180
+ data.to_f
181
+ when 'BOOLEAN'
182
+ data == true
183
+ when 'DateTime'
184
+ # parse date time (expecting ISO 8601 format)
185
+ DateTime.parse data
186
+ when 'Date'
187
+ # parse date time (expecting ISO 8601 format)
188
+ Date.parse data
189
+ when 'Object'
190
+ # generic object (usually a Hash), return directly
191
+ data
192
+ when /\AArray<(.+)>\z/
193
+ # e.g. Array<Pet>
194
+ sub_type = $1
195
+ data.map {|item| convert_to_type(item, sub_type) }
196
+ when /\AHash\<String, (.+)\>\z/
197
+ # e.g. Hash<String, Integer>
198
+ sub_type = $1
199
+ {}.tap do |hash|
200
+ data.each {|k, v| hash[k] = convert_to_type(v, sub_type) }
201
+ end
202
+ else
203
+ # models, e.g. Pet
204
+ Pdf4me.const_get(return_type).new.tap do |model|
205
+ model.build_from_hash data
206
+ end
207
+ end
208
+ end
209
+
210
+ # Save response body into a file in (the defined) temporary folder, using the filename
211
+ # from the "Content-Disposition" header if provided, otherwise a random filename.
212
+ # The response body is written to the file in chunks in order to handle files which
213
+ # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
214
+ # process can use.
215
+ #
216
+ # @see Configuration#temp_folder_path
217
+ def download_file(request)
218
+ tempfile = nil
219
+ encoding = nil
220
+ request.on_headers do |response|
221
+ content_disposition = response.headers['Content-Disposition']
222
+ if content_disposition and content_disposition =~ /filename=/i
223
+ filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
224
+ prefix = sanitize_filename(filename)
225
+ else
226
+ prefix = 'download-'
227
+ end
228
+ prefix = prefix + '-' unless prefix.end_with?('-')
229
+ encoding = response.body.encoding
230
+ tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
231
+ @tempfile = tempfile
232
+ end
233
+ request.on_body do |chunk|
234
+ chunk.force_encoding(encoding)
235
+ tempfile.write(chunk)
236
+ end
237
+ request.on_complete do |response|
238
+ tempfile.close
239
+ @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
240
+ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
241
+ "will be deleted automatically with GC. It's also recommended to delete the temp file "\
242
+ "explicitly with `tempfile.delete`"
243
+ end
244
+ end
245
+
246
+ # Sanitize filename by removing path.
247
+ # e.g. ../../sun.gif becomes sun.gif
248
+ #
249
+ # @param [String] filename the filename to be sanitized
250
+ # @return [String] the sanitized filename
251
+ def sanitize_filename(filename)
252
+ filename.gsub(/.*[\/\\]/, '')
253
+ end
254
+
255
+ def build_request_url(path)
256
+ # Add leading and trailing slashes to path
257
+ path = "/#{path}".gsub(/\/+/, '/')
258
+ URI.encode(@config.base_url + path)
259
+ end
260
+
261
+ # Builds the HTTP request body
262
+ #
263
+ # @param [Hash] header_params Header parameters
264
+ # @param [Hash] form_params Query parameters
265
+ # @param [Object] body HTTP body (JSON/XML)
266
+ # @return [String] HTTP body data in the form of string
267
+ def build_request_body(header_params, form_params, body)
268
+ # http form
269
+ if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
270
+ header_params['Content-Type'] == 'multipart/form-data'
271
+ data = {}
272
+ form_params.each do |key, value|
273
+ case value
274
+ when ::File, ::Array, nil
275
+ # let typhoeus handle File, Array and nil parameters
276
+ data[key] = value
277
+ else
278
+ data[key] = value.to_s
279
+ end
280
+ end
281
+ elsif body
282
+ data = body.is_a?(String) ? body : body.to_json
283
+ else
284
+ data = nil
285
+ end
286
+ data
287
+ end
288
+
289
+ # Update hearder and query params based on authentication settings.
290
+ #
291
+ # @param [Hash] header_params Header parameters
292
+ # @param [Hash] query_params Query parameters
293
+ # @param [String] auth_names Authentication scheme name
294
+ def update_params_for_auth!(header_params, query_params, auth_names)
295
+ Array(auth_names).each do |auth_name|
296
+ auth_setting = @config.auth_settings[auth_name]
297
+ next unless auth_setting
298
+ case auth_setting[:in]
299
+ when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
300
+ when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
301
+ else fail ArgumentError, 'Authentication token must be in `query` of `header`'
302
+ end
303
+ end
304
+ end
305
+
306
+ # Sets user agent in HTTP header
307
+ #
308
+ # @param [String] user_agent User agent (e.g. swagger-codegen/ruby/1.0.0)
309
+ def user_agent=(user_agent)
310
+ @user_agent = user_agent
311
+ @default_headers['User-Agent'] = @user_agent
312
+ end
313
+
314
+ # Return Accept header based on an array of accepts provided.
315
+ # @param [Array] accepts array for Accept
316
+ # @return [String] the Accept header (e.g. application/json)
317
+ def select_header_accept(accepts)
318
+ return nil if accepts.nil? || accepts.empty?
319
+ # use JSON when present, otherwise use all of the provided
320
+ json_accept = accepts.find { |s| json_mime?(s) }
321
+ return json_accept || accepts.join(',')
322
+ end
323
+
324
+ # Return Content-Type header based on an array of content types provided.
325
+ # @param [Array] content_types array for Content-Type
326
+ # @return [String] the Content-Type header (e.g. application/json)
327
+ def select_header_content_type(content_types)
328
+ # use application/json by default
329
+ return 'application/json' if content_types.nil? || content_types.empty?
330
+ # use JSON when present, otherwise use the first one
331
+ json_content_type = content_types.find { |s| json_mime?(s) }
332
+ return json_content_type || content_types.first
333
+ end
334
+
335
+ # Convert object (array, hash, object, etc) to JSON string.
336
+ # @param [Object] model object to be converted into JSON string
337
+ # @return [String] JSON string representation of the object
338
+ def object_to_http_body(model)
339
+ return model if model.nil? || model.is_a?(String)
340
+ local_body = nil
341
+ if model.is_a?(Array)
342
+ local_body = model.map{|m| object_to_hash(m) }
343
+ else
344
+ local_body = object_to_hash(model)
345
+ end
346
+ local_body.to_json
347
+ end
348
+
349
+ # Convert object(non-array) to hash.
350
+ # @param [Object] obj object to be converted into JSON string
351
+ # @return [String] JSON string representation of the object
352
+ def object_to_hash(obj)
353
+ if obj.respond_to?(:to_hash)
354
+ obj.to_hash
355
+ else
356
+ obj
357
+ end
358
+ end
359
+
360
+ # Build parameter value according to the given collection format.
361
+ # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi
362
+ def build_collection_param(param, collection_format)
363
+ case collection_format
364
+ when :csv
365
+ param.join(',')
366
+ when :ssv
367
+ param.join(' ')
368
+ when :tsv
369
+ param.join("\t")
370
+ when :pipes
371
+ param.join('|')
372
+ when :multi
373
+ # return the array directly as typhoeus will handle it as expected
374
+ param
375
+ else
376
+ fail "unknown collection format: #{collection_format.inspect}"
377
+ end
378
+ end
379
+ end
380
+ end