pdf4me 1.0.1 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (291) hide show
  1. checksums.yaml +4 -4
  2. data/{LICENSE → LICENSE.txt} +6 -6
  3. data/README.md +124 -395
  4. data/lib/pdf4me.rb +40 -110
  5. data/lib/pdf4me/actions/complex_action.rb +64 -0
  6. data/lib/pdf4me/actions/convert_file_to_pdf.rb +30 -0
  7. data/lib/pdf4me/actions/convert_to_pdf.rb +14 -0
  8. data/lib/pdf4me/actions/create_pdf_a.rb +29 -0
  9. data/lib/pdf4me/actions/create_thumbnail.rb +55 -0
  10. data/lib/pdf4me/actions/extract_pages.rb +49 -0
  11. data/lib/pdf4me/actions/merge_two_pdfs.rb +34 -0
  12. data/lib/pdf4me/actions/optimize.rb +10 -0
  13. data/lib/pdf4me/actions/optimize_by_profile.rb +42 -0
  14. data/lib/pdf4me/actions/split_by_page_nr.rb +55 -0
  15. data/lib/pdf4me/actions/text_stamp.rb +63 -0
  16. data/lib/pdf4me/actions/wrapper_action.rb +65 -0
  17. data/lib/pdf4me/client.rb +87 -0
  18. data/lib/pdf4me/configuration.rb +9 -88
  19. data/lib/pdf4me/exceptions.rb +26 -0
  20. data/lib/pdf4me/models/base.rb +26 -0
  21. data/lib/pdf4me/models/convert_to_pdf_action.rb +26 -246
  22. data/lib/pdf4me/models/convert_to_pdf_res.rb +5 -185
  23. data/lib/pdf4me/models/doc_log.rb +12 -257
  24. data/lib/pdf4me/models/doc_metadata.rb +13 -282
  25. data/lib/pdf4me/models/document.rb +14 -282
  26. data/lib/pdf4me/models/notification.rb +8 -191
  27. data/lib/pdf4me/models/optimize_action.rb +72 -508
  28. data/lib/pdf4me/models/optimize_res.rb +5 -195
  29. data/lib/pdf4me/models/page.rb +12 -254
  30. data/lib/pdf4me/utils/assigner.rb +10 -0
  31. data/lib/pdf4me/utils/serializer.rb +43 -0
  32. data/lib/pdf4me/version.rb +1 -13
  33. data/spec/actions/create_pdf_a_spec.rb +21 -0
  34. data/spec/actions/wrapper_action_spec.rb +24 -0
  35. data/spec/files/4.pdf +0 -0
  36. data/spec/spec_helper.rb +17 -100
  37. metadata +70 -421
  38. data/Gemfile +0 -7
  39. data/Rakefile +0 -8
  40. data/docs/ActionFlow.md +0 -8
  41. data/docs/ApiUsageRes.md +0 -11
  42. data/docs/ArchiveConfig.md +0 -11
  43. data/docs/ArchiveJobReq.md +0 -12
  44. data/docs/ArchiveJobRes.md +0 -9
  45. data/docs/Color.md +0 -10
  46. data/docs/ConvertApi.md +0 -102
  47. data/docs/ConvertToPdf.md +0 -10
  48. data/docs/ConvertToPdfAction.md +0 -10
  49. data/docs/ConvertToPdfRes.md +0 -8
  50. data/docs/CreateImages.md +0 -10
  51. data/docs/CreateImagesRes.md +0 -8
  52. data/docs/CreatePdfA.md +0 -10
  53. data/docs/CreatePdfARes.md +0 -8
  54. data/docs/CustomCMSConfig.md +0 -23
  55. data/docs/DocAction.md +0 -8
  56. data/docs/DocLog.md +0 -12
  57. data/docs/DocMetadata.md +0 -16
  58. data/docs/Document.md +0 -16
  59. data/docs/DocumentApi.md +0 -203
  60. data/docs/DropDocumentReq.md +0 -20
  61. data/docs/DropDocumentRes.md +0 -15
  62. data/docs/ExecutionTrigger.md +0 -10
  63. data/docs/Extract.md +0 -10
  64. data/docs/ExtractAction.md +0 -9
  65. data/docs/ExtractApi.md +0 -102
  66. data/docs/ExtractRes.md +0 -8
  67. data/docs/GetDocumentListRes.md +0 -13
  68. data/docs/GetDocumentReq.md +0 -14
  69. data/docs/GetDocumentRes.md +0 -14
  70. data/docs/IFormFile.md +0 -13
  71. data/docs/Image.md +0 -15
  72. data/docs/ImageAction.md +0 -30
  73. data/docs/ImageApi.md +0 -107
  74. data/docs/Job.md +0 -10
  75. data/docs/JobApi.md +0 -197
  76. data/docs/JobConfig.md +0 -18
  77. data/docs/JobConfigRes.md +0 -8
  78. data/docs/KeyValuePairStringObject.md +0 -9
  79. data/docs/KeyValuePairStringString.md +0 -9
  80. data/docs/ManagementApi.md +0 -92
  81. data/docs/Merge.md +0 -10
  82. data/docs/MergeAction.md +0 -8
  83. data/docs/MergeApi.md +0 -102
  84. data/docs/MergeRes.md +0 -8
  85. data/docs/Notification.md +0 -9
  86. data/docs/OcrAction.md +0 -12
  87. data/docs/OcrApi.md +0 -57
  88. data/docs/Optimize.md +0 -10
  89. data/docs/OptimizeAction.md +0 -35
  90. data/docs/OptimizeApi.md +0 -103
  91. data/docs/OptimizeRes.md +0 -9
  92. data/docs/Page.md +0 -14
  93. data/docs/PageSelection.md +0 -10
  94. data/docs/Pdf4meAction.md +0 -12
  95. data/docs/Pdf4meDocument.md +0 -32
  96. data/docs/Pdf4meException.md +0 -8
  97. data/docs/PdfAAction.md +0 -14
  98. data/docs/PdfAApi.md +0 -102
  99. data/docs/PdfFont.md +0 -9
  100. data/docs/Pricing.md +0 -13
  101. data/docs/ProduceDocuments.md +0 -14
  102. data/docs/ProduceDocumentsRes.md +0 -8
  103. data/docs/ProduceOutput.md +0 -8
  104. data/docs/RGBSet.md +0 -10
  105. data/docs/RecognizeDocument.md +0 -10
  106. data/docs/RecognizeDocumentRes.md +0 -9
  107. data/docs/Rectangle.md +0 -11
  108. data/docs/Rotate.md +0 -10
  109. data/docs/RunJobRes.md +0 -10
  110. data/docs/SignatureConfig.md +0 -7
  111. data/docs/Split.md +0 -10
  112. data/docs/SplitAction.md +0 -11
  113. data/docs/SplitApi.md +0 -103
  114. data/docs/SplitRes.md +0 -8
  115. data/docs/Stamp.md +0 -10
  116. data/docs/StampAction.md +0 -22
  117. data/docs/StampApi.md +0 -110
  118. data/docs/StampRes.md +0 -8
  119. data/docs/StorageFolder.md +0 -10
  120. data/docs/Text.md +0 -17
  121. data/docs/Transform.md +0 -13
  122. data/docs/Translate.md +0 -9
  123. data/docs/UserFingerprint.md +0 -9
  124. data/docs/VersionRes.md +0 -8
  125. data/docs/java.md +0 -425
  126. data/lib/pdf4me/api/convert_api.rb +0 -130
  127. data/lib/pdf4me/api/document_api.rb +0 -218
  128. data/lib/pdf4me/api/extract_api.rb +0 -131
  129. data/lib/pdf4me/api/image_api.rb +0 -139
  130. data/lib/pdf4me/api/job_api.rb +0 -223
  131. data/lib/pdf4me/api/management_api.rb +0 -117
  132. data/lib/pdf4me/api/merge_api.rb +0 -131
  133. data/lib/pdf4me/api/ocr_api.rb +0 -74
  134. data/lib/pdf4me/api/optimize_api.rb +0 -139
  135. data/lib/pdf4me/api/pdf_a_api.rb +0 -134
  136. data/lib/pdf4me/api/split_api.rb +0 -135
  137. data/lib/pdf4me/api/stamp_api.rb +0 -159
  138. data/lib/pdf4me/api_client.rb +0 -380
  139. data/lib/pdf4me/api_error.rb +0 -38
  140. data/lib/pdf4me/models/action_flow.rb +0 -190
  141. data/lib/pdf4me/models/api_usage_res.rb +0 -219
  142. data/lib/pdf4me/models/archive_config.rb +0 -226
  143. data/lib/pdf4me/models/archive_job_req.rb +0 -249
  144. data/lib/pdf4me/models/archive_job_res.rb +0 -207
  145. data/lib/pdf4me/models/color.rb +0 -206
  146. data/lib/pdf4me/models/convert_to_pdf.rb +0 -209
  147. data/lib/pdf4me/models/create_images.rb +0 -209
  148. data/lib/pdf4me/models/create_images_res.rb +0 -189
  149. data/lib/pdf4me/models/create_pdf_a.rb +0 -209
  150. data/lib/pdf4me/models/create_pdf_a_res.rb +0 -189
  151. data/lib/pdf4me/models/custom_cms_config.rb +0 -323
  152. data/lib/pdf4me/models/doc_action.rb +0 -190
  153. data/lib/pdf4me/models/drop_document_req.rb +0 -348
  154. data/lib/pdf4me/models/drop_document_res.rb +0 -260
  155. data/lib/pdf4me/models/execution_trigger.rb +0 -206
  156. data/lib/pdf4me/models/extract.rb +0 -207
  157. data/lib/pdf4me/models/extract_action.rb +0 -201
  158. data/lib/pdf4me/models/extract_res.rb +0 -188
  159. data/lib/pdf4me/models/get_document_list_res.rb +0 -237
  160. data/lib/pdf4me/models/get_document_req.rb +0 -243
  161. data/lib/pdf4me/models/get_document_res.rb +0 -246
  162. data/lib/pdf4me/models/i_form_file.rb +0 -235
  163. data/lib/pdf4me/models/image.rb +0 -300
  164. data/lib/pdf4me/models/image_action.rb +0 -513
  165. data/lib/pdf4me/models/job.rb +0 -213
  166. data/lib/pdf4me/models/job_config.rb +0 -298
  167. data/lib/pdf4me/models/job_config_res.rb +0 -193
  168. data/lib/pdf4me/models/key_value_pair_string_object.rb +0 -197
  169. data/lib/pdf4me/models/key_value_pair_string_string.rb +0 -197
  170. data/lib/pdf4me/models/merge.rb +0 -209
  171. data/lib/pdf4me/models/merge_action.rb +0 -190
  172. data/lib/pdf4me/models/merge_res.rb +0 -188
  173. data/lib/pdf4me/models/ocr_action.rb +0 -259
  174. data/lib/pdf4me/models/optimize.rb +0 -209
  175. data/lib/pdf4me/models/page_selection.rb +0 -246
  176. data/lib/pdf4me/models/pdf4me_action.rb +0 -259
  177. data/lib/pdf4me/models/pdf4me_document.rb +0 -511
  178. data/lib/pdf4me/models/pdf4me_exception.rb +0 -189
  179. data/lib/pdf4me/models/pdf_a_action.rb +0 -297
  180. data/lib/pdf4me/models/pdf_font.rb +0 -213
  181. data/lib/pdf4me/models/pricing.rb +0 -278
  182. data/lib/pdf4me/models/produce_documents.rb +0 -251
  183. data/lib/pdf4me/models/produce_documents_res.rb +0 -191
  184. data/lib/pdf4me/models/produce_output.rb +0 -221
  185. data/lib/pdf4me/models/recognize_document.rb +0 -209
  186. data/lib/pdf4me/models/recognize_document_res.rb +0 -198
  187. data/lib/pdf4me/models/rectangle.rb +0 -215
  188. data/lib/pdf4me/models/rgb_set.rb +0 -206
  189. data/lib/pdf4me/models/rotate.rb +0 -221
  190. data/lib/pdf4me/models/run_job_res.rb +0 -215
  191. data/lib/pdf4me/models/signature_config.rb +0 -179
  192. data/lib/pdf4me/models/split.rb +0 -207
  193. data/lib/pdf4me/models/split_action.rb +0 -219
  194. data/lib/pdf4me/models/split_res.rb +0 -190
  195. data/lib/pdf4me/models/stamp.rb +0 -209
  196. data/lib/pdf4me/models/stamp_action.rb +0 -387
  197. data/lib/pdf4me/models/stamp_res.rb +0 -189
  198. data/lib/pdf4me/models/storage_folder.rb +0 -239
  199. data/lib/pdf4me/models/text.rb +0 -320
  200. data/lib/pdf4me/models/transform.rb +0 -263
  201. data/lib/pdf4me/models/translate.rb +0 -207
  202. data/lib/pdf4me/models/user_fingerprint.rb +0 -197
  203. data/lib/pdf4me/models/version_res.rb +0 -188
  204. data/pdf4me.gemspec +0 -47
  205. data/spec/api/convert_api_spec.rb +0 -60
  206. data/spec/api/document_api_spec.rb +0 -83
  207. data/spec/api/extract_api_spec.rb +0 -60
  208. data/spec/api/image_api_spec.rb +0 -62
  209. data/spec/api/job_api_spec.rb +0 -82
  210. data/spec/api/management_api_spec.rb +0 -57
  211. data/spec/api/merge_api_spec.rb +0 -60
  212. data/spec/api/ocr_api_spec.rb +0 -47
  213. data/spec/api/optimize_api_spec.rb +0 -60
  214. data/spec/api/pdf_a_api_spec.rb +0 -60
  215. data/spec/api/split_api_spec.rb +0 -60
  216. data/spec/api/stamp_api_spec.rb +0 -63
  217. data/spec/api_client_spec.rb +0 -226
  218. data/spec/configuration_spec.rb +0 -42
  219. data/spec/models/action_flow_spec.rb +0 -42
  220. data/spec/models/api_usage_res_spec.rb +0 -60
  221. data/spec/models/archive_config_spec.rb +0 -60
  222. data/spec/models/archive_job_req_spec.rb +0 -66
  223. data/spec/models/archive_job_res_spec.rb +0 -48
  224. data/spec/models/color_spec.rb +0 -54
  225. data/spec/models/convert_to_pdf_action_spec.rb +0 -62
  226. data/spec/models/convert_to_pdf_res_spec.rb +0 -42
  227. data/spec/models/convert_to_pdf_spec.rb +0 -54
  228. data/spec/models/create_images_res_spec.rb +0 -42
  229. data/spec/models/create_images_spec.rb +0 -54
  230. data/spec/models/create_pdf_a_res_spec.rb +0 -42
  231. data/spec/models/create_pdf_a_spec.rb +0 -54
  232. data/spec/models/custom_cms_config_spec.rb +0 -132
  233. data/spec/models/doc_action_spec.rb +0 -42
  234. data/spec/models/doc_log_spec.rb +0 -70
  235. data/spec/models/doc_metadata_spec.rb +0 -90
  236. data/spec/models/document_spec.rb +0 -90
  237. data/spec/models/drop_document_req_spec.rb +0 -118
  238. data/spec/models/drop_document_res_spec.rb +0 -84
  239. data/spec/models/execution_trigger_spec.rb +0 -54
  240. data/spec/models/extract_action_spec.rb +0 -48
  241. data/spec/models/extract_res_spec.rb +0 -42
  242. data/spec/models/extract_spec.rb +0 -54
  243. data/spec/models/get_document_list_res_spec.rb +0 -72
  244. data/spec/models/get_document_req_spec.rb +0 -78
  245. data/spec/models/get_document_res_spec.rb +0 -78
  246. data/spec/models/i_form_file_spec.rb +0 -72
  247. data/spec/models/image_action_spec.rb +0 -206
  248. data/spec/models/image_spec.rb +0 -88
  249. data/spec/models/job_config_res_spec.rb +0 -42
  250. data/spec/models/job_config_spec.rb +0 -102
  251. data/spec/models/job_spec.rb +0 -54
  252. data/spec/models/key_value_pair_string_object_spec.rb +0 -48
  253. data/spec/models/key_value_pair_string_string_spec.rb +0 -48
  254. data/spec/models/merge_action_spec.rb +0 -42
  255. data/spec/models/merge_res_spec.rb +0 -42
  256. data/spec/models/merge_spec.rb +0 -54
  257. data/spec/models/notification_spec.rb +0 -48
  258. data/spec/models/ocr_action_spec.rb +0 -70
  259. data/spec/models/optimize_action_spec.rb +0 -228
  260. data/spec/models/optimize_res_spec.rb +0 -48
  261. data/spec/models/optimize_spec.rb +0 -54
  262. data/spec/models/page_selection_spec.rb +0 -58
  263. data/spec/models/page_spec.rb +0 -78
  264. data/spec/models/pdf4me_action_spec.rb +0 -70
  265. data/spec/models/pdf4me_document_spec.rb +0 -202
  266. data/spec/models/pdf4me_exception_spec.rb +0 -42
  267. data/spec/models/pdf_a_action_spec.rb +0 -86
  268. data/spec/models/pdf_font_spec.rb +0 -48
  269. data/spec/models/pricing_spec.rb +0 -80
  270. data/spec/models/produce_documents_res_spec.rb +0 -42
  271. data/spec/models/produce_documents_spec.rb +0 -78
  272. data/spec/models/produce_output_spec.rb +0 -46
  273. data/spec/models/recognize_document_res_spec.rb +0 -48
  274. data/spec/models/recognize_document_spec.rb +0 -54
  275. data/spec/models/rectangle_spec.rb +0 -60
  276. data/spec/models/rgb_set_spec.rb +0 -54
  277. data/spec/models/rotate_spec.rb +0 -54
  278. data/spec/models/run_job_res_spec.rb +0 -54
  279. data/spec/models/signature_config_spec.rb +0 -36
  280. data/spec/models/split_action_spec.rb +0 -60
  281. data/spec/models/split_res_spec.rb +0 -42
  282. data/spec/models/split_spec.rb +0 -54
  283. data/spec/models/stamp_action_spec.rb +0 -142
  284. data/spec/models/stamp_res_spec.rb +0 -42
  285. data/spec/models/stamp_spec.rb +0 -54
  286. data/spec/models/storage_folder_spec.rb +0 -58
  287. data/spec/models/text_spec.rb +0 -104
  288. data/spec/models/transform_spec.rb +0 -72
  289. data/spec/models/translate_spec.rb +0 -48
  290. data/spec/models/user_fingerprint_spec.rb +0 -48
  291. data/spec/models/version_res_spec.rb +0 -42
@@ -1,300 +0,0 @@
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
-
15
- module Pdf4me
16
-
17
- class Image
18
- attr_accessor :rectangle
19
-
20
- attr_accessor :image_data
21
-
22
- attr_accessor :image_type
23
-
24
- attr_accessor :file_name
25
-
26
- attr_accessor :compression
27
-
28
- attr_accessor :rotate
29
-
30
- attr_accessor :translate
31
-
32
- attr_accessor :transform
33
-
34
- class EnumAttributeValidator
35
- attr_reader :datatype
36
- attr_reader :allowable_values
37
-
38
- def initialize(datatype, allowable_values)
39
- @allowable_values = allowable_values.map do |value|
40
- case datatype.to_s
41
- when /Integer/i
42
- value.to_i
43
- when /Float/i
44
- value.to_f
45
- else
46
- value
47
- end
48
- end
49
- end
50
-
51
- def valid?(value)
52
- !value || allowable_values.include?(value)
53
- end
54
- end
55
-
56
- # Attribute mapping from ruby-style variable name to JSON key.
57
- def self.attribute_map
58
- {
59
- :'rectangle' => :'rectangle',
60
- :'image_data' => :'imageData',
61
- :'image_type' => :'imageType',
62
- :'file_name' => :'fileName',
63
- :'compression' => :'compression',
64
- :'rotate' => :'rotate',
65
- :'translate' => :'translate',
66
- :'transform' => :'transform'
67
- }
68
- end
69
-
70
- # Attribute type mapping.
71
- def self.swagger_types
72
- {
73
- :'rectangle' => :'Rectangle',
74
- :'image_data' => :'String',
75
- :'image_type' => :'String',
76
- :'file_name' => :'String',
77
- :'compression' => :'String',
78
- :'rotate' => :'Rotate',
79
- :'translate' => :'Translate',
80
- :'transform' => :'Transform'
81
- }
82
- end
83
-
84
- # Initializes the object
85
- # @param [Hash] attributes Model attributes in the form of hash
86
- def initialize(attributes = {})
87
- return unless attributes.is_a?(Hash)
88
-
89
- # convert string to symbol for hash key
90
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
91
-
92
- if attributes.has_key?(:'rectangle')
93
- self.rectangle = attributes[:'rectangle']
94
- end
95
-
96
- if attributes.has_key?(:'imageData')
97
- self.image_data = attributes[:'imageData']
98
- end
99
-
100
- if attributes.has_key?(:'imageType')
101
- self.image_type = attributes[:'imageType']
102
- end
103
-
104
- if attributes.has_key?(:'fileName')
105
- self.file_name = attributes[:'fileName']
106
- end
107
-
108
- if attributes.has_key?(:'compression')
109
- self.compression = attributes[:'compression']
110
- end
111
-
112
- if attributes.has_key?(:'rotate')
113
- self.rotate = attributes[:'rotate']
114
- end
115
-
116
- if attributes.has_key?(:'translate')
117
- self.translate = attributes[:'translate']
118
- end
119
-
120
- if attributes.has_key?(:'transform')
121
- self.transform = attributes[:'transform']
122
- end
123
-
124
- end
125
-
126
- # Show invalid properties with the reasons. Usually used together with valid?
127
- # @return Array for valid properties with the reasons
128
- def list_invalid_properties
129
- invalid_properties = Array.new
130
- if !@image_data.nil? && @image_data !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
131
- invalid_properties.push("invalid value for 'image_data', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.")
132
- end
133
-
134
- return invalid_properties
135
- end
136
-
137
- # Check to see if the all the properties in the model are valid
138
- # @return true if the model is valid
139
- def valid?
140
- return false if !@image_data.nil? && @image_data !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
141
- compression_validator = EnumAttributeValidator.new('String', ["cCITTFax", "flate", "dCT"])
142
- return false unless compression_validator.valid?(@compression)
143
- return true
144
- end
145
-
146
- # Custom attribute writer method with validation
147
- # @param [Object] image_data Value to be assigned
148
- def image_data=(image_data)
149
-
150
- if !image_data.nil? && image_data !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
151
- fail ArgumentError, "invalid value for 'image_data', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."
152
- end
153
-
154
- @image_data = image_data
155
- end
156
-
157
- # Custom attribute writer method checking allowed values (enum).
158
- # @param [Object] compression Object to be assigned
159
- def compression=(compression)
160
- validator = EnumAttributeValidator.new('String', ["cCITTFax", "flate", "dCT"])
161
- unless validator.valid?(compression)
162
- fail ArgumentError, "invalid value for 'compression', must be one of #{validator.allowable_values}."
163
- end
164
- @compression = compression
165
- end
166
-
167
- # Checks equality by comparing each attribute.
168
- # @param [Object] Object to be compared
169
- def ==(o)
170
- return true if self.equal?(o)
171
- self.class == o.class &&
172
- rectangle == o.rectangle &&
173
- image_data == o.image_data &&
174
- image_type == o.image_type &&
175
- file_name == o.file_name &&
176
- compression == o.compression &&
177
- rotate == o.rotate &&
178
- translate == o.translate &&
179
- transform == o.transform
180
- end
181
-
182
- # @see the `==` method
183
- # @param [Object] Object to be compared
184
- def eql?(o)
185
- self == o
186
- end
187
-
188
- # Calculates hash code according to all attributes.
189
- # @return [Fixnum] Hash code
190
- def hash
191
- [rectangle, image_data, image_type, file_name, compression, rotate, translate, transform].hash
192
- end
193
-
194
- # Builds the object from hash
195
- # @param [Hash] attributes Model attributes in the form of hash
196
- # @return [Object] Returns the model itself
197
- def build_from_hash(attributes)
198
- return nil unless attributes.is_a?(Hash)
199
- self.class.swagger_types.each_pair do |key, type|
200
- if type =~ /\AArray<(.*)>/i
201
- # check to ensure the input is an array given that the the attribute
202
- # is documented as an array but the input is not
203
- if attributes[self.class.attribute_map[key]].is_a?(Array)
204
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
205
- end
206
- elsif !attributes[self.class.attribute_map[key]].nil?
207
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
208
- end # or else data not found in attributes(hash), not an issue as the data can be optional
209
- end
210
-
211
- self
212
- end
213
-
214
- # Deserializes the data based on type
215
- # @param string type Data type
216
- # @param string value Value to be deserialized
217
- # @return [Object] Deserialized data
218
- def _deserialize(type, value)
219
- case type.to_sym
220
- when :DateTime
221
- DateTime.parse(value)
222
- when :Date
223
- Date.parse(value)
224
- when :String
225
- value.to_s
226
- when :Integer
227
- value.to_i
228
- when :Float
229
- value.to_f
230
- when :BOOLEAN
231
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
232
- true
233
- else
234
- false
235
- end
236
- when :Object
237
- # generic object (usually a Hash), return directly
238
- value
239
- when /\AArray<(?<inner_type>.+)>\z/
240
- inner_type = Regexp.last_match[:inner_type]
241
- value.map { |v| _deserialize(inner_type, v) }
242
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
243
- k_type = Regexp.last_match[:k_type]
244
- v_type = Regexp.last_match[:v_type]
245
- {}.tap do |hash|
246
- value.each do |k, v|
247
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
248
- end
249
- end
250
- else # model
251
- temp_model = Pdf4me.const_get(type).new
252
- temp_model.build_from_hash(value)
253
- end
254
- end
255
-
256
- # Returns the string representation of the object
257
- # @return [String] String presentation of the object
258
- def to_s
259
- to_hash.to_s
260
- end
261
-
262
- # to_body is an alias to to_hash (backward compatibility)
263
- # @return [Hash] Returns the object in the form of hash
264
- def to_body
265
- to_hash
266
- end
267
-
268
- # Returns the object in the form of hash
269
- # @return [Hash] Returns the object in the form of hash
270
- def to_hash
271
- hash = {}
272
- self.class.attribute_map.each_pair do |attr, param|
273
- value = self.send(attr)
274
- next if value.nil?
275
- hash[param] = _to_hash(value)
276
- end
277
- hash
278
- end
279
-
280
- # Outputs non-array value in the form of hash
281
- # For object, use to_hash. Otherwise, just return the value
282
- # @param [Object] value Any valid value
283
- # @return [Hash] Returns the value in the form of hash
284
- def _to_hash(value)
285
- if value.is_a?(Array)
286
- value.compact.map{ |v| _to_hash(v) }
287
- elsif value.is_a?(Hash)
288
- {}.tap do |hash|
289
- value.each { |k, v| hash[k] = _to_hash(v) }
290
- end
291
- elsif value.respond_to? :to_hash
292
- value.to_hash
293
- else
294
- value
295
- end
296
- end
297
-
298
- end
299
-
300
- end
@@ -1,513 +0,0 @@
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
-
15
- module Pdf4me
16
-
17
- class ImageAction
18
- # Set the Pages wo apply the convertion. {default: PageSelection.All}
19
- attr_accessor :page_selection
20
-
21
- # Set or get the center mode. When set to True, the document is horizontally and vertically centered on the page. When set to False, the document is printed to the upper left corner of the page. {default: false}
22
- attr_accessor :center
23
-
24
- # set the fit page mode. If set to True, the page is scaled to fit the image (in either width or height). If set to False, the page is rendered with its true size. {default: true}
25
- attr_accessor :fit_page
26
-
27
- # Get or set the color depth. Bi-tonal: 1, gray scale: 8, RGB true color: 24, CMYK: 32. {default: 24}
28
- attr_accessor :bits_per_pixel
29
-
30
- # Set the threshold for converting from gray to bi-tonal when Dithering is eDitherNone. Value must be in the range of 0 to 255. {default: 181}
31
- attr_accessor :bilevel_threshold
32
-
33
- attr_accessor :width_pixel
34
-
35
- attr_accessor :height_pixel
36
-
37
- attr_accessor :width_point
38
-
39
- attr_accessor :height_point
40
-
41
- # Set a specific rendering option.
42
- attr_accessor :render_options
43
-
44
- # Set the rotation mode of the page. Attribute: Set the rotation to the viewing rotation attribute of the PDF page, i.e. rendering the page with the same rotation as it is displayed in a PDF viewer. {default: Attribute}
45
- attr_accessor :rotate_mode
46
-
47
- # If True a uniform up- or down-scaling is applied, i.e. the output image has the same ratio of width to height as the input file and its size will fit into the defined dimensions, given by SetBitmapDimensions. {default: true}
48
- attr_accessor :preserve_aspect_ratio
49
-
50
- # Set the quality index of lossy compression types. This value ranges from 1 to 100 and is applied to JPEG and JPEG2000 compression.For JPEG2000, a quality index of 100 means lossless compression.JPEG compression is always lossy. {default: 80}
51
- attr_accessor :image_quality
52
-
53
- # Set the Color Management System (CMS) Engine. {default: 80}
54
- attr_accessor :cms_engine
55
-
56
- # Set the Color Management System (CMS) Engine. {default: 80}
57
- attr_accessor :custom_cms_config
58
-
59
- # Set the dithering algorithm.Dithering refers to the procedure of simulating colors or grayscales.This is mainly useful for low color depth (e.g.black and white or indexed) images. The supported values for TPDFDithering are listed in the corresponding enumeration. {default: DitherFloydSteinberg}
60
- attr_accessor :dithering
61
-
62
- # <p> Get or set the resolution of the image in DPI (dots per inch). Set Both the resolutions for the x- and y-axis are set to the same value. </p> <p> Setting DPI is redundant to setting the specialized properties XDPI and YDPI. </p> {default: 150}
63
- attr_accessor :dpi
64
-
65
- # Set the bit fill order. MSB (Most significant bit) or LSB (Least significant bit) first. {default: MostSignificantBit}
66
- attr_accessor :fill_order
67
-
68
- # <p> This property is used to enable and parameterize super-sampling, a technique to initially render the image at a higher resolution and then sample it down to the target resolution.As a result of that process the final image appears smoother, i.e.anti-aliased. </p> <p> Applying super-sampling improves the image quality when rendering at low target resolutions(72 DPI or less); the higher the target resolution the less the visual impact. This property requires memory and CPU time quadratically to the ratio, therefore only small values, such as 2 or 3 should be used. </p> <p> If a too high value (in combination with the original image size) is set, it is ignored. </p> {default: 1}
69
- attr_accessor :filter_ratio
70
-
71
- # Set output Type for image file.
72
- attr_accessor :image_extension
73
-
74
- # Set color space of the output image, see enumeration TPDFColorSpace. For black white bi-tonal images, a gray color space must be selected {default: ColorRGB}
75
- attr_accessor :color_space
76
-
77
- # Get or set the compression type of TIFF images. For any other image format, the compression is automatically defined by the file extension(the file name). The supported values for TPDFCompression are listed in the corresponding enumeration. {default: ComprLZW}
78
- attr_accessor :compression
79
-
80
- attr_accessor :custom_properties
81
-
82
- class EnumAttributeValidator
83
- attr_reader :datatype
84
- attr_reader :allowable_values
85
-
86
- def initialize(datatype, allowable_values)
87
- @allowable_values = allowable_values.map do |value|
88
- case datatype.to_s
89
- when /Integer/i
90
- value.to_i
91
- when /Float/i
92
- value.to_f
93
- else
94
- value
95
- end
96
- end
97
- end
98
-
99
- def valid?(value)
100
- !value || allowable_values.include?(value)
101
- end
102
- end
103
-
104
- # Attribute mapping from ruby-style variable name to JSON key.
105
- def self.attribute_map
106
- {
107
- :'page_selection' => :'pageSelection',
108
- :'center' => :'center',
109
- :'fit_page' => :'fitPage',
110
- :'bits_per_pixel' => :'bitsPerPixel',
111
- :'bilevel_threshold' => :'bilevelThreshold',
112
- :'width_pixel' => :'widthPixel',
113
- :'height_pixel' => :'heightPixel',
114
- :'width_point' => :'widthPoint',
115
- :'height_point' => :'heightPoint',
116
- :'render_options' => :'renderOptions',
117
- :'rotate_mode' => :'rotateMode',
118
- :'preserve_aspect_ratio' => :'preserveAspectRatio',
119
- :'image_quality' => :'imageQuality',
120
- :'cms_engine' => :'cmsEngine',
121
- :'custom_cms_config' => :'customCMSConfig',
122
- :'dithering' => :'dithering',
123
- :'dpi' => :'dpi',
124
- :'fill_order' => :'fillOrder',
125
- :'filter_ratio' => :'filterRatio',
126
- :'image_extension' => :'imageExtension',
127
- :'color_space' => :'colorSpace',
128
- :'compression' => :'compression',
129
- :'custom_properties' => :'customProperties'
130
- }
131
- end
132
-
133
- # Attribute type mapping.
134
- def self.swagger_types
135
- {
136
- :'page_selection' => :'PageSelection',
137
- :'center' => :'BOOLEAN',
138
- :'fit_page' => :'BOOLEAN',
139
- :'bits_per_pixel' => :'Integer',
140
- :'bilevel_threshold' => :'Integer',
141
- :'width_pixel' => :'Integer',
142
- :'height_pixel' => :'Integer',
143
- :'width_point' => :'Integer',
144
- :'height_point' => :'Integer',
145
- :'render_options' => :'Array<String>',
146
- :'rotate_mode' => :'String',
147
- :'preserve_aspect_ratio' => :'BOOLEAN',
148
- :'image_quality' => :'Integer',
149
- :'cms_engine' => :'String',
150
- :'custom_cms_config' => :'CustomCMSConfig',
151
- :'dithering' => :'String',
152
- :'dpi' => :'Integer',
153
- :'fill_order' => :'String',
154
- :'filter_ratio' => :'Integer',
155
- :'image_extension' => :'String',
156
- :'color_space' => :'String',
157
- :'compression' => :'String',
158
- :'custom_properties' => :'Array<KeyValuePairStringString>'
159
- }
160
- end
161
-
162
- # Initializes the object
163
- # @param [Hash] attributes Model attributes in the form of hash
164
- def initialize(attributes = {})
165
- return unless attributes.is_a?(Hash)
166
-
167
- # convert string to symbol for hash key
168
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
169
-
170
- if attributes.has_key?(:'pageSelection')
171
- self.page_selection = attributes[:'pageSelection']
172
- end
173
-
174
- if attributes.has_key?(:'center')
175
- self.center = attributes[:'center']
176
- end
177
-
178
- if attributes.has_key?(:'fitPage')
179
- self.fit_page = attributes[:'fitPage']
180
- end
181
-
182
- if attributes.has_key?(:'bitsPerPixel')
183
- self.bits_per_pixel = attributes[:'bitsPerPixel']
184
- end
185
-
186
- if attributes.has_key?(:'bilevelThreshold')
187
- self.bilevel_threshold = attributes[:'bilevelThreshold']
188
- end
189
-
190
- if attributes.has_key?(:'widthPixel')
191
- self.width_pixel = attributes[:'widthPixel']
192
- end
193
-
194
- if attributes.has_key?(:'heightPixel')
195
- self.height_pixel = attributes[:'heightPixel']
196
- end
197
-
198
- if attributes.has_key?(:'widthPoint')
199
- self.width_point = attributes[:'widthPoint']
200
- end
201
-
202
- if attributes.has_key?(:'heightPoint')
203
- self.height_point = attributes[:'heightPoint']
204
- end
205
-
206
- if attributes.has_key?(:'renderOptions')
207
- if (value = attributes[:'renderOptions']).is_a?(Array)
208
- self.render_options = value
209
- end
210
- end
211
-
212
- if attributes.has_key?(:'rotateMode')
213
- self.rotate_mode = attributes[:'rotateMode']
214
- end
215
-
216
- if attributes.has_key?(:'preserveAspectRatio')
217
- self.preserve_aspect_ratio = attributes[:'preserveAspectRatio']
218
- end
219
-
220
- if attributes.has_key?(:'imageQuality')
221
- self.image_quality = attributes[:'imageQuality']
222
- end
223
-
224
- if attributes.has_key?(:'cmsEngine')
225
- self.cms_engine = attributes[:'cmsEngine']
226
- end
227
-
228
- if attributes.has_key?(:'customCMSConfig')
229
- self.custom_cms_config = attributes[:'customCMSConfig']
230
- end
231
-
232
- if attributes.has_key?(:'dithering')
233
- self.dithering = attributes[:'dithering']
234
- end
235
-
236
- if attributes.has_key?(:'dpi')
237
- self.dpi = attributes[:'dpi']
238
- end
239
-
240
- if attributes.has_key?(:'fillOrder')
241
- self.fill_order = attributes[:'fillOrder']
242
- end
243
-
244
- if attributes.has_key?(:'filterRatio')
245
- self.filter_ratio = attributes[:'filterRatio']
246
- end
247
-
248
- if attributes.has_key?(:'imageExtension')
249
- self.image_extension = attributes[:'imageExtension']
250
- end
251
-
252
- if attributes.has_key?(:'colorSpace')
253
- self.color_space = attributes[:'colorSpace']
254
- end
255
-
256
- if attributes.has_key?(:'compression')
257
- self.compression = attributes[:'compression']
258
- end
259
-
260
- if attributes.has_key?(:'customProperties')
261
- if (value = attributes[:'customProperties']).is_a?(Array)
262
- self.custom_properties = value
263
- end
264
- end
265
-
266
- end
267
-
268
- # Show invalid properties with the reasons. Usually used together with valid?
269
- # @return Array for valid properties with the reasons
270
- def list_invalid_properties
271
- invalid_properties = Array.new
272
- return invalid_properties
273
- end
274
-
275
- # Check to see if the all the properties in the model are valid
276
- # @return true if the model is valid
277
- def valid?
278
- rotate_mode_validator = EnumAttributeValidator.new('String', ["none", "attribute", "portrait", "landscape"])
279
- return false unless rotate_mode_validator.valid?(@rotate_mode)
280
- cms_engine_validator = EnumAttributeValidator.new('String', ["none", "neugebauer", "lcms", "customCMS"])
281
- return false unless cms_engine_validator.valid?(@cms_engine)
282
- dithering_validator = EnumAttributeValidator.new('String', ["none", "floydSteinberg", "halftone", "pattern", "g3Optimized", "g4Optimized", "atkinson"])
283
- return false unless dithering_validator.valid?(@dithering)
284
- fill_order_validator = EnumAttributeValidator.new('String', ["mSB", "lSB"])
285
- return false unless fill_order_validator.valid?(@fill_order)
286
- image_extension_validator = EnumAttributeValidator.new('String', ["jpg", "jpeg", "bmp", "gif", "jb2", "jp2", "jpf", "jpx", "png", "tif", "tiff"])
287
- return false unless image_extension_validator.valid?(@image_extension)
288
- color_space_validator = EnumAttributeValidator.new('String', ["rGB", "rGBA", "gray", "grayA", "cMYK", "yCbCr", "yCbCrK", "palette", "lAB", "cMYK_Konly", "cMYKA"])
289
- return false unless color_space_validator.valid?(@color_space)
290
- compression_validator = EnumAttributeValidator.new('String', ["lZW", "jPEG", "flate", "raw", "group3", "group3_2D", "group4", "jBIG2", "jPEG2000", "tIFFJPEG"])
291
- return false unless compression_validator.valid?(@compression)
292
- return true
293
- end
294
-
295
- # Custom attribute writer method checking allowed values (enum).
296
- # @param [Object] rotate_mode Object to be assigned
297
- def rotate_mode=(rotate_mode)
298
- validator = EnumAttributeValidator.new('String', ["none", "attribute", "portrait", "landscape"])
299
- unless validator.valid?(rotate_mode)
300
- fail ArgumentError, "invalid value for 'rotate_mode', must be one of #{validator.allowable_values}."
301
- end
302
- @rotate_mode = rotate_mode
303
- end
304
-
305
- # Custom attribute writer method checking allowed values (enum).
306
- # @param [Object] cms_engine Object to be assigned
307
- def cms_engine=(cms_engine)
308
- validator = EnumAttributeValidator.new('String', ["none", "neugebauer", "lcms", "customCMS"])
309
- unless validator.valid?(cms_engine)
310
- fail ArgumentError, "invalid value for 'cms_engine', must be one of #{validator.allowable_values}."
311
- end
312
- @cms_engine = cms_engine
313
- end
314
-
315
- # Custom attribute writer method checking allowed values (enum).
316
- # @param [Object] dithering Object to be assigned
317
- def dithering=(dithering)
318
- validator = EnumAttributeValidator.new('String', ["none", "floydSteinberg", "halftone", "pattern", "g3Optimized", "g4Optimized", "atkinson"])
319
- unless validator.valid?(dithering)
320
- fail ArgumentError, "invalid value for 'dithering', must be one of #{validator.allowable_values}."
321
- end
322
- @dithering = dithering
323
- end
324
-
325
- # Custom attribute writer method checking allowed values (enum).
326
- # @param [Object] fill_order Object to be assigned
327
- def fill_order=(fill_order)
328
- validator = EnumAttributeValidator.new('String', ["mSB", "lSB"])
329
- unless validator.valid?(fill_order)
330
- fail ArgumentError, "invalid value for 'fill_order', must be one of #{validator.allowable_values}."
331
- end
332
- @fill_order = fill_order
333
- end
334
-
335
- # Custom attribute writer method checking allowed values (enum).
336
- # @param [Object] image_extension Object to be assigned
337
- def image_extension=(image_extension)
338
- validator = EnumAttributeValidator.new('String', ["jpg", "jpeg", "bmp", "gif", "jb2", "jp2", "jpf", "jpx", "png", "tif", "tiff"])
339
- unless validator.valid?(image_extension)
340
- fail ArgumentError, "invalid value for 'image_extension', must be one of #{validator.allowable_values}."
341
- end
342
- @image_extension = image_extension
343
- end
344
-
345
- # Custom attribute writer method checking allowed values (enum).
346
- # @param [Object] color_space Object to be assigned
347
- def color_space=(color_space)
348
- validator = EnumAttributeValidator.new('String', ["rGB", "rGBA", "gray", "grayA", "cMYK", "yCbCr", "yCbCrK", "palette", "lAB", "cMYK_Konly", "cMYKA"])
349
- unless validator.valid?(color_space)
350
- fail ArgumentError, "invalid value for 'color_space', must be one of #{validator.allowable_values}."
351
- end
352
- @color_space = color_space
353
- end
354
-
355
- # Custom attribute writer method checking allowed values (enum).
356
- # @param [Object] compression Object to be assigned
357
- def compression=(compression)
358
- validator = EnumAttributeValidator.new('String', ["lZW", "jPEG", "flate", "raw", "group3", "group3_2D", "group4", "jBIG2", "jPEG2000", "tIFFJPEG"])
359
- unless validator.valid?(compression)
360
- fail ArgumentError, "invalid value for 'compression', must be one of #{validator.allowable_values}."
361
- end
362
- @compression = compression
363
- end
364
-
365
- # Checks equality by comparing each attribute.
366
- # @param [Object] Object to be compared
367
- def ==(o)
368
- return true if self.equal?(o)
369
- self.class == o.class &&
370
- page_selection == o.page_selection &&
371
- center == o.center &&
372
- fit_page == o.fit_page &&
373
- bits_per_pixel == o.bits_per_pixel &&
374
- bilevel_threshold == o.bilevel_threshold &&
375
- width_pixel == o.width_pixel &&
376
- height_pixel == o.height_pixel &&
377
- width_point == o.width_point &&
378
- height_point == o.height_point &&
379
- render_options == o.render_options &&
380
- rotate_mode == o.rotate_mode &&
381
- preserve_aspect_ratio == o.preserve_aspect_ratio &&
382
- image_quality == o.image_quality &&
383
- cms_engine == o.cms_engine &&
384
- custom_cms_config == o.custom_cms_config &&
385
- dithering == o.dithering &&
386
- dpi == o.dpi &&
387
- fill_order == o.fill_order &&
388
- filter_ratio == o.filter_ratio &&
389
- image_extension == o.image_extension &&
390
- color_space == o.color_space &&
391
- compression == o.compression &&
392
- custom_properties == o.custom_properties
393
- end
394
-
395
- # @see the `==` method
396
- # @param [Object] Object to be compared
397
- def eql?(o)
398
- self == o
399
- end
400
-
401
- # Calculates hash code according to all attributes.
402
- # @return [Fixnum] Hash code
403
- def hash
404
- [page_selection, center, fit_page, bits_per_pixel, bilevel_threshold, width_pixel, height_pixel, width_point, height_point, render_options, rotate_mode, preserve_aspect_ratio, image_quality, cms_engine, custom_cms_config, dithering, dpi, fill_order, filter_ratio, image_extension, color_space, compression, custom_properties].hash
405
- end
406
-
407
- # Builds the object from hash
408
- # @param [Hash] attributes Model attributes in the form of hash
409
- # @return [Object] Returns the model itself
410
- def build_from_hash(attributes)
411
- return nil unless attributes.is_a?(Hash)
412
- self.class.swagger_types.each_pair do |key, type|
413
- if type =~ /\AArray<(.*)>/i
414
- # check to ensure the input is an array given that the the attribute
415
- # is documented as an array but the input is not
416
- if attributes[self.class.attribute_map[key]].is_a?(Array)
417
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
418
- end
419
- elsif !attributes[self.class.attribute_map[key]].nil?
420
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
421
- end # or else data not found in attributes(hash), not an issue as the data can be optional
422
- end
423
-
424
- self
425
- end
426
-
427
- # Deserializes the data based on type
428
- # @param string type Data type
429
- # @param string value Value to be deserialized
430
- # @return [Object] Deserialized data
431
- def _deserialize(type, value)
432
- case type.to_sym
433
- when :DateTime
434
- DateTime.parse(value)
435
- when :Date
436
- Date.parse(value)
437
- when :String
438
- value.to_s
439
- when :Integer
440
- value.to_i
441
- when :Float
442
- value.to_f
443
- when :BOOLEAN
444
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
445
- true
446
- else
447
- false
448
- end
449
- when :Object
450
- # generic object (usually a Hash), return directly
451
- value
452
- when /\AArray<(?<inner_type>.+)>\z/
453
- inner_type = Regexp.last_match[:inner_type]
454
- value.map { |v| _deserialize(inner_type, v) }
455
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
456
- k_type = Regexp.last_match[:k_type]
457
- v_type = Regexp.last_match[:v_type]
458
- {}.tap do |hash|
459
- value.each do |k, v|
460
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
461
- end
462
- end
463
- else # model
464
- temp_model = Pdf4me.const_get(type).new
465
- temp_model.build_from_hash(value)
466
- end
467
- end
468
-
469
- # Returns the string representation of the object
470
- # @return [String] String presentation of the object
471
- def to_s
472
- to_hash.to_s
473
- end
474
-
475
- # to_body is an alias to to_hash (backward compatibility)
476
- # @return [Hash] Returns the object in the form of hash
477
- def to_body
478
- to_hash
479
- end
480
-
481
- # Returns the object in the form of hash
482
- # @return [Hash] Returns the object in the form of hash
483
- def to_hash
484
- hash = {}
485
- self.class.attribute_map.each_pair do |attr, param|
486
- value = self.send(attr)
487
- next if value.nil?
488
- hash[param] = _to_hash(value)
489
- end
490
- hash
491
- end
492
-
493
- # Outputs non-array value in the form of hash
494
- # For object, use to_hash. Otherwise, just return the value
495
- # @param [Object] value Any valid value
496
- # @return [Hash] Returns the value in the form of hash
497
- def _to_hash(value)
498
- if value.is_a?(Array)
499
- value.compact.map{ |v| _to_hash(v) }
500
- elsif value.is_a?(Hash)
501
- {}.tap do |hash|
502
- value.each { |k, v| hash[k] = _to_hash(v) }
503
- end
504
- elsif value.respond_to? :to_hash
505
- value.to_hash
506
- else
507
- value
508
- end
509
- end
510
-
511
- end
512
-
513
- end