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,300 @@
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
@@ -0,0 +1,513 @@
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