aspose_pdf_cloud 18.6.0 → 18.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +4 -4
  4. data/aspose_pdf_cloud.gemspec +49 -49
  5. data/lib/aspose_pdf_cloud.rb +145 -145
  6. data/lib/aspose_pdf_cloud/api/pdf_api.rb +11705 -10569
  7. data/lib/aspose_pdf_cloud/api_client.rb +60 -6
  8. data/lib/aspose_pdf_cloud/api_error.rb +47 -47
  9. data/lib/aspose_pdf_cloud/configuration.rb +185 -185
  10. data/lib/aspose_pdf_cloud/models/annotation.rb +260 -260
  11. data/lib/aspose_pdf_cloud/models/annotation_response.rb +222 -222
  12. data/lib/aspose_pdf_cloud/models/annotations.rb +211 -211
  13. data/lib/aspose_pdf_cloud/models/annotations_response.rb +222 -222
  14. data/lib/aspose_pdf_cloud/models/antialiasing_processing_type.rb +43 -43
  15. data/lib/aspose_pdf_cloud/models/append_document.rb +228 -228
  16. data/lib/aspose_pdf_cloud/models/attachment.rb +270 -270
  17. data/lib/aspose_pdf_cloud/models/attachment_response.rb +222 -222
  18. data/lib/aspose_pdf_cloud/models/attachments.rb +211 -211
  19. data/lib/aspose_pdf_cloud/models/attachments_response.rb +222 -222
  20. data/lib/aspose_pdf_cloud/models/color.rb +244 -244
  21. data/lib/aspose_pdf_cloud/models/color_depth.rb +45 -45
  22. data/lib/aspose_pdf_cloud/models/compression_type.rb +46 -46
  23. data/lib/aspose_pdf_cloud/models/doc_format.rb +43 -43
  24. data/lib/aspose_pdf_cloud/models/doc_recognition_mode.rb +43 -43
  25. data/lib/aspose_pdf_cloud/models/document.rb +220 -220
  26. data/lib/aspose_pdf_cloud/models/document_pages_response.rb +222 -222
  27. data/lib/aspose_pdf_cloud/models/document_privilege.rb +298 -298
  28. data/lib/aspose_pdf_cloud/models/document_properties.rb +211 -211
  29. data/lib/aspose_pdf_cloud/models/document_properties_response.rb +222 -222
  30. data/lib/aspose_pdf_cloud/models/document_property.rb +227 -227
  31. data/lib/aspose_pdf_cloud/models/document_property_response.rb +222 -222
  32. data/lib/aspose_pdf_cloud/models/document_response.rb +233 -233
  33. data/lib/aspose_pdf_cloud/models/document_text_replace_response.rb +231 -231
  34. data/lib/aspose_pdf_cloud/models/epub_recognition_mode.rb +44 -44
  35. data/lib/aspose_pdf_cloud/models/field.rb +254 -254
  36. data/lib/aspose_pdf_cloud/models/field_response.rb +222 -222
  37. data/lib/aspose_pdf_cloud/models/field_type.rb +1 -1
  38. data/lib/aspose_pdf_cloud/models/fields.rb +211 -211
  39. data/lib/aspose_pdf_cloud/models/fields_response.rb +222 -222
  40. data/lib/aspose_pdf_cloud/models/font_encoding_rules.rb +43 -43
  41. data/lib/aspose_pdf_cloud/models/font_saving_modes.rb +45 -45
  42. data/lib/aspose_pdf_cloud/models/font_styles.rb +1 -1
  43. data/lib/aspose_pdf_cloud/models/horizontal_alignment.rb +1 -1
  44. data/lib/aspose_pdf_cloud/models/html_document_type.rb +43 -43
  45. data/lib/aspose_pdf_cloud/models/html_markup_generation_modes.rb +43 -43
  46. data/lib/aspose_pdf_cloud/models/http_status_code.rb +1 -1
  47. data/lib/aspose_pdf_cloud/models/image.rb +220 -220
  48. data/lib/aspose_pdf_cloud/models/image_response.rb +222 -222
  49. data/lib/aspose_pdf_cloud/models/image_src_type.rb +43 -43
  50. data/lib/aspose_pdf_cloud/models/image_template.rb +281 -281
  51. data/lib/aspose_pdf_cloud/models/image_templates_request.rb +230 -230
  52. data/lib/aspose_pdf_cloud/models/images.rb +211 -211
  53. data/lib/aspose_pdf_cloud/models/images_list_request.rb +205 -205
  54. data/lib/aspose_pdf_cloud/models/images_response.rb +222 -222
  55. data/lib/aspose_pdf_cloud/models/letters_positioning_methods.rb +43 -43
  56. data/lib/aspose_pdf_cloud/models/line_spacing.rb +43 -43
  57. data/lib/aspose_pdf_cloud/models/link.rb +228 -228
  58. data/lib/aspose_pdf_cloud/models/link_action_type.rb +1 -1
  59. data/lib/aspose_pdf_cloud/models/link_annotation.rb +236 -236
  60. data/lib/aspose_pdf_cloud/models/link_annotation_response.rb +222 -222
  61. data/lib/aspose_pdf_cloud/models/link_annotations.rb +211 -211
  62. data/lib/aspose_pdf_cloud/models/link_annotations_response.rb +222 -222
  63. data/lib/aspose_pdf_cloud/models/link_element.rb +200 -200
  64. data/lib/aspose_pdf_cloud/models/link_highlighting_mode.rb +1 -1
  65. data/lib/aspose_pdf_cloud/models/margin_info.rb +244 -244
  66. data/lib/aspose_pdf_cloud/models/merge_documents.rb +200 -200
  67. data/lib/aspose_pdf_cloud/models/optimize_options.rb +293 -293
  68. data/lib/aspose_pdf_cloud/models/page.rb +228 -228
  69. data/lib/aspose_pdf_cloud/models/page_text_replace_response.rb +231 -231
  70. data/lib/aspose_pdf_cloud/models/page_word_count.rb +218 -218
  71. data/lib/aspose_pdf_cloud/models/pages.rb +211 -211
  72. data/lib/aspose_pdf_cloud/models/paragraph.rb +303 -303
  73. data/lib/aspose_pdf_cloud/models/parts_embedding_modes.rb +44 -44
  74. data/lib/aspose_pdf_cloud/models/pdf_a_type.rb +43 -43
  75. data/lib/aspose_pdf_cloud/models/raster_images_saving_modes.rb +44 -44
  76. data/lib/aspose_pdf_cloud/models/rectangle.rb +244 -244
  77. data/lib/aspose_pdf_cloud/models/rotation.rb +1 -1
  78. data/lib/aspose_pdf_cloud/models/saa_spose_response.rb +213 -213
  79. data/lib/aspose_pdf_cloud/models/segment.rb +206 -206
  80. data/lib/aspose_pdf_cloud/models/shape_type.rb +44 -44
  81. data/lib/aspose_pdf_cloud/models/signature.rb +333 -333
  82. data/lib/aspose_pdf_cloud/models/signature_type.rb +1 -1
  83. data/lib/aspose_pdf_cloud/models/signature_verify_response.rb +223 -223
  84. data/lib/aspose_pdf_cloud/models/split_result.rb +200 -200
  85. data/lib/aspose_pdf_cloud/models/split_result_document.rb +238 -238
  86. data/lib/aspose_pdf_cloud/models/split_result_response.rb +223 -223
  87. data/lib/aspose_pdf_cloud/models/stamp.rb +413 -413
  88. data/lib/aspose_pdf_cloud/models/stamp_type.rb +1 -1
  89. data/lib/aspose_pdf_cloud/models/text_format.rb +227 -227
  90. data/lib/aspose_pdf_cloud/models/text_format_response.rb +222 -222
  91. data/lib/aspose_pdf_cloud/models/text_horizontal_alignment.rb +47 -47
  92. data/lib/aspose_pdf_cloud/models/text_item.rb +218 -218
  93. data/lib/aspose_pdf_cloud/models/text_item_response.rb +222 -222
  94. data/lib/aspose_pdf_cloud/models/text_items.rb +211 -211
  95. data/lib/aspose_pdf_cloud/models/text_items_response.rb +222 -222
  96. data/lib/aspose_pdf_cloud/models/text_line.rb +210 -210
  97. data/lib/aspose_pdf_cloud/models/text_rect.rb +220 -220
  98. data/lib/aspose_pdf_cloud/models/text_rects.rb +199 -199
  99. data/lib/aspose_pdf_cloud/models/text_rects_response.rb +222 -222
  100. data/lib/aspose_pdf_cloud/models/text_replace.rb +253 -253
  101. data/lib/aspose_pdf_cloud/models/text_replace_list_request.rb +232 -232
  102. data/lib/aspose_pdf_cloud/models/text_replace_request.rb +262 -262
  103. data/lib/aspose_pdf_cloud/models/text_replace_response.rb +222 -222
  104. data/lib/aspose_pdf_cloud/models/text_state.rb +248 -248
  105. data/lib/aspose_pdf_cloud/models/tiff_export_options.rb +348 -348
  106. data/lib/aspose_pdf_cloud/models/vertical_alignment.rb +45 -45
  107. data/lib/aspose_pdf_cloud/models/word_count.rb +199 -199
  108. data/lib/aspose_pdf_cloud/models/word_count_response.rb +223 -223
  109. data/lib/aspose_pdf_cloud/models/wrap_mode.rb +44 -44
  110. data/lib/aspose_pdf_cloud/version.rb +24 -24
  111. data/test/pdf_tests.rb +3 -3
  112. data/test_data/.gitattributes +1 -0
  113. data/test_data/TexExample.tex +304 -304
  114. metadata +13 -12
@@ -1,253 +1,253 @@
1
- =begin
2
- --------------------------------------------------------------------------------------------------------------------
3
- Copyright (c) 2018 Aspose.Pdf for Cloud
4
- Permission is hereby granted, free of charge, to any person obtaining a copy
5
- of this software and associated documentation files (the "Software"), to deal
6
- in the Software without restriction, including without limitation the rights
7
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- copies of the Software, and to permit persons to whom the Software is
9
- furnished to do so, subject to the following conditions:
10
- The above copyright notice and this permission notice shall be included in all
11
- copies or substantial portions of the Software.
12
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
- SOFTWARE.
19
- --------------------------------------------------------------------------------------------------------------------
20
- =end
21
-
22
- require 'date'
23
-
24
- module AsposePdfCloud
25
- # Single text replacement setting.
26
- class TextReplace
27
- # Original text.
28
- attr_accessor :old_value
29
-
30
- # New text.
31
- attr_accessor :new_value
32
-
33
- # Gets or sets a value indicating whether search text is regular expression.
34
- attr_accessor :regex
35
-
36
- # Text properties of a new text.
37
- attr_accessor :text_state
38
-
39
- # Rectangle area where searched original text.
40
- attr_accessor :rect
41
-
42
-
43
- # Attribute mapping from ruby-style variable name to JSON key.
44
- def self.attribute_map
45
- {
46
- :'old_value' => :'OldValue',
47
- :'new_value' => :'NewValue',
48
- :'regex' => :'Regex',
49
- :'text_state' => :'TextState',
50
- :'rect' => :'Rect'
51
- }
52
- end
53
-
54
- # Attribute type mapping.
55
- def self.swagger_types
56
- {
57
- :'old_value' => :'String',
58
- :'new_value' => :'String',
59
- :'regex' => :'BOOLEAN',
60
- :'text_state' => :'TextState',
61
- :'rect' => :'Rectangle'
62
- }
63
- end
64
-
65
- # Initializes the object
66
- # @param [Hash] attributes Model attributes in the form of hash
67
- def initialize(attributes = {})
68
- return unless attributes.is_a?(Hash)
69
-
70
- # convert string to symbol for hash key
71
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
72
-
73
- if attributes.has_key?(:'OldValue')
74
- self.old_value = attributes[:'OldValue']
75
- end
76
-
77
- if attributes.has_key?(:'NewValue')
78
- self.new_value = attributes[:'NewValue']
79
- end
80
-
81
- if attributes.has_key?(:'Regex')
82
- self.regex = attributes[:'Regex']
83
- end
84
-
85
- if attributes.has_key?(:'TextState')
86
- self.text_state = attributes[:'TextState']
87
- end
88
-
89
- if attributes.has_key?(:'Rect')
90
- self.rect = attributes[:'Rect']
91
- end
92
-
93
- end
94
-
95
- # Show invalid properties with the reasons. Usually used together with valid?
96
- # @return Array for valid properies with the reasons
97
- def list_invalid_properties
98
- invalid_properties = Array.new
99
- if @old_value.nil?
100
- invalid_properties.push("invalid value for 'old_value', old_value cannot be nil.")
101
- end
102
-
103
- if @new_value.nil?
104
- invalid_properties.push("invalid value for 'new_value', new_value cannot be nil.")
105
- end
106
-
107
- if @regex.nil?
108
- invalid_properties.push("invalid value for 'regex', regex cannot be nil.")
109
- end
110
-
111
- return invalid_properties
112
- end
113
-
114
- # Check to see if the all the properties in the model are valid
115
- # @return true if the model is valid
116
- def valid?
117
- return false if @old_value.nil?
118
- return false if @new_value.nil?
119
- return false if @regex.nil?
120
- return true
121
- end
122
-
123
- # Checks equality by comparing each attribute.
124
- # @param [Object] Object to be compared
125
- def ==(o)
126
- return true if self.equal?(o)
127
- self.class == o.class &&
128
- old_value == o.old_value &&
129
- new_value == o.new_value &&
130
- regex == o.regex &&
131
- text_state == o.text_state &&
132
- rect == o.rect
133
- end
134
-
135
- # @see the `==` method
136
- # @param [Object] Object to be compared
137
- def eql?(o)
138
- self == o
139
- end
140
-
141
- # Calculates hash code according to all attributes.
142
- # @return [Fixnum] Hash code
143
- def hash
144
- [old_value, new_value, regex, text_state, rect].hash
145
- end
146
-
147
- # Builds the object from hash
148
- # @param [Hash] attributes Model attributes in the form of hash
149
- # @return [Object] Returns the model itself
150
- def build_from_hash(attributes)
151
- return nil unless attributes.is_a?(Hash)
152
- self.class.swagger_types.each_pair do |key, type|
153
- if type =~ /\AArray<(.*)>/i
154
- # check to ensure the input is an array given that the the attribute
155
- # is documented as an array but the input is not
156
- if attributes[self.class.attribute_map[key]].is_a?(Array)
157
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
158
- end
159
- elsif !attributes[self.class.attribute_map[key]].nil?
160
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
161
- end # or else data not found in attributes(hash), not an issue as the data can be optional
162
- end
163
-
164
- self
165
- end
166
-
167
- # Deserializes the data based on type
168
- # @param string type Data type
169
- # @param string value Value to be deserialized
170
- # @return [Object] Deserialized data
171
- def _deserialize(type, value)
172
- case type.to_sym
173
- when :DateTime
174
- DateTime.parse(value)
175
- when :Date
176
- Date.parse(value)
177
- when :String
178
- value.to_s
179
- when :Integer
180
- value.to_i
181
- when :Float
182
- value.to_f
183
- when :BOOLEAN
184
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
185
- true
186
- else
187
- false
188
- end
189
- when :Object
190
- # generic object (usually a Hash), return directly
191
- value
192
- when /\AArray<(?<inner_type>.+)>\z/
193
- inner_type = Regexp.last_match[:inner_type]
194
- value.map { |v| _deserialize(inner_type, v) }
195
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
196
- k_type = Regexp.last_match[:k_type]
197
- v_type = Regexp.last_match[:v_type]
198
- {}.tap do |hash|
199
- value.each do |k, v|
200
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
201
- end
202
- end
203
- else # model
204
- temp_model = AsposePdfCloud.const_get(type).new
205
- temp_model.build_from_hash(value)
206
- end
207
- end
208
-
209
- # Returns the string representation of the object
210
- # @return [String] String presentation of the object
211
- def to_s
212
- to_hash.to_s
213
- end
214
-
215
- # to_body is an alias to to_hash (backward compatibility)
216
- # @return [Hash] Returns the object in the form of hash
217
- def to_body
218
- to_hash
219
- end
220
-
221
- # Returns the object in the form of hash
222
- # @return [Hash] Returns the object in the form of hash
223
- def to_hash
224
- hash = {}
225
- self.class.attribute_map.each_pair do |attr, param|
226
- value = self.send(attr)
227
- next if value.nil?
228
- hash[param] = _to_hash(value)
229
- end
230
- hash
231
- end
232
-
233
- # Outputs non-array value in the form of hash
234
- # For object, use to_hash. Otherwise, just return the value
235
- # @param [Object] value Any valid value
236
- # @return [Hash] Returns the value in the form of hash
237
- def _to_hash(value)
238
- if value.is_a?(Array)
239
- value.compact.map{ |v| _to_hash(v) }
240
- elsif value.is_a?(Hash)
241
- {}.tap do |hash|
242
- value.each { |k, v| hash[k] = _to_hash(v) }
243
- end
244
- elsif value.respond_to? :to_hash
245
- value.to_hash
246
- else
247
- value
248
- end
249
- end
250
-
251
- end
252
-
253
- end
1
+ =begin
2
+ --------------------------------------------------------------------------------------------------------------------
3
+ Copyright (c) 2018 Aspose.PDF Cloud
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
+ SOFTWARE.
19
+ --------------------------------------------------------------------------------------------------------------------
20
+ =end
21
+
22
+ require 'date'
23
+
24
+ module AsposePdfCloud
25
+ # Single text replacement setting.
26
+ class TextReplace
27
+ # Original text.
28
+ attr_accessor :old_value
29
+
30
+ # New text.
31
+ attr_accessor :new_value
32
+
33
+ # Gets or sets a value indicating whether search text is regular expression.
34
+ attr_accessor :regex
35
+
36
+ # Text properties of a new text.
37
+ attr_accessor :text_state
38
+
39
+ # Rectangle area where searched original text.
40
+ attr_accessor :rect
41
+
42
+
43
+ # Attribute mapping from ruby-style variable name to JSON key.
44
+ def self.attribute_map
45
+ {
46
+ :'old_value' => :'OldValue',
47
+ :'new_value' => :'NewValue',
48
+ :'regex' => :'Regex',
49
+ :'text_state' => :'TextState',
50
+ :'rect' => :'Rect'
51
+ }
52
+ end
53
+
54
+ # Attribute type mapping.
55
+ def self.swagger_types
56
+ {
57
+ :'old_value' => :'String',
58
+ :'new_value' => :'String',
59
+ :'regex' => :'BOOLEAN',
60
+ :'text_state' => :'TextState',
61
+ :'rect' => :'Rectangle'
62
+ }
63
+ end
64
+
65
+ # Initializes the object
66
+ # @param [Hash] attributes Model attributes in the form of hash
67
+ def initialize(attributes = {})
68
+ return unless attributes.is_a?(Hash)
69
+
70
+ # convert string to symbol for hash key
71
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
72
+
73
+ if attributes.has_key?(:'OldValue')
74
+ self.old_value = attributes[:'OldValue']
75
+ end
76
+
77
+ if attributes.has_key?(:'NewValue')
78
+ self.new_value = attributes[:'NewValue']
79
+ end
80
+
81
+ if attributes.has_key?(:'Regex')
82
+ self.regex = attributes[:'Regex']
83
+ end
84
+
85
+ if attributes.has_key?(:'TextState')
86
+ self.text_state = attributes[:'TextState']
87
+ end
88
+
89
+ if attributes.has_key?(:'Rect')
90
+ self.rect = attributes[:'Rect']
91
+ end
92
+
93
+ end
94
+
95
+ # Show invalid properties with the reasons. Usually used together with valid?
96
+ # @return Array for valid properies with the reasons
97
+ def list_invalid_properties
98
+ invalid_properties = Array.new
99
+ if @old_value.nil?
100
+ invalid_properties.push("invalid value for 'old_value', old_value cannot be nil.")
101
+ end
102
+
103
+ if @new_value.nil?
104
+ invalid_properties.push("invalid value for 'new_value', new_value cannot be nil.")
105
+ end
106
+
107
+ if @regex.nil?
108
+ invalid_properties.push("invalid value for 'regex', regex cannot be nil.")
109
+ end
110
+
111
+ return invalid_properties
112
+ end
113
+
114
+ # Check to see if the all the properties in the model are valid
115
+ # @return true if the model is valid
116
+ def valid?
117
+ return false if @old_value.nil?
118
+ return false if @new_value.nil?
119
+ return false if @regex.nil?
120
+ return true
121
+ end
122
+
123
+ # Checks equality by comparing each attribute.
124
+ # @param [Object] Object to be compared
125
+ def ==(o)
126
+ return true if self.equal?(o)
127
+ self.class == o.class &&
128
+ old_value == o.old_value &&
129
+ new_value == o.new_value &&
130
+ regex == o.regex &&
131
+ text_state == o.text_state &&
132
+ rect == o.rect
133
+ end
134
+
135
+ # @see the `==` method
136
+ # @param [Object] Object to be compared
137
+ def eql?(o)
138
+ self == o
139
+ end
140
+
141
+ # Calculates hash code according to all attributes.
142
+ # @return [Fixnum] Hash code
143
+ def hash
144
+ [old_value, new_value, regex, text_state, rect].hash
145
+ end
146
+
147
+ # Builds the object from hash
148
+ # @param [Hash] attributes Model attributes in the form of hash
149
+ # @return [Object] Returns the model itself
150
+ def build_from_hash(attributes)
151
+ return nil unless attributes.is_a?(Hash)
152
+ self.class.swagger_types.each_pair do |key, type|
153
+ if type =~ /\AArray<(.*)>/i
154
+ # check to ensure the input is an array given that the the attribute
155
+ # is documented as an array but the input is not
156
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
157
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
158
+ end
159
+ elsif !attributes[self.class.attribute_map[key]].nil?
160
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
161
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
162
+ end
163
+
164
+ self
165
+ end
166
+
167
+ # Deserializes the data based on type
168
+ # @param string type Data type
169
+ # @param string value Value to be deserialized
170
+ # @return [Object] Deserialized data
171
+ def _deserialize(type, value)
172
+ case type.to_sym
173
+ when :DateTime
174
+ DateTime.parse(value)
175
+ when :Date
176
+ Date.parse(value)
177
+ when :String
178
+ value.to_s
179
+ when :Integer
180
+ value.to_i
181
+ when :Float
182
+ value.to_f
183
+ when :BOOLEAN
184
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
185
+ true
186
+ else
187
+ false
188
+ end
189
+ when :Object
190
+ # generic object (usually a Hash), return directly
191
+ value
192
+ when /\AArray<(?<inner_type>.+)>\z/
193
+ inner_type = Regexp.last_match[:inner_type]
194
+ value.map { |v| _deserialize(inner_type, v) }
195
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
196
+ k_type = Regexp.last_match[:k_type]
197
+ v_type = Regexp.last_match[:v_type]
198
+ {}.tap do |hash|
199
+ value.each do |k, v|
200
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
201
+ end
202
+ end
203
+ else # model
204
+ temp_model = AsposePdfCloud.const_get(type).new
205
+ temp_model.build_from_hash(value)
206
+ end
207
+ end
208
+
209
+ # Returns the string representation of the object
210
+ # @return [String] String presentation of the object
211
+ def to_s
212
+ to_hash.to_s
213
+ end
214
+
215
+ # to_body is an alias to to_hash (backward compatibility)
216
+ # @return [Hash] Returns the object in the form of hash
217
+ def to_body
218
+ to_hash
219
+ end
220
+
221
+ # Returns the object in the form of hash
222
+ # @return [Hash] Returns the object in the form of hash
223
+ def to_hash
224
+ hash = {}
225
+ self.class.attribute_map.each_pair do |attr, param|
226
+ value = self.send(attr)
227
+ next if value.nil?
228
+ hash[param] = _to_hash(value)
229
+ end
230
+ hash
231
+ end
232
+
233
+ # Outputs non-array value in the form of hash
234
+ # For object, use to_hash. Otherwise, just return the value
235
+ # @param [Object] value Any valid value
236
+ # @return [Hash] Returns the value in the form of hash
237
+ def _to_hash(value)
238
+ if value.is_a?(Array)
239
+ value.compact.map{ |v| _to_hash(v) }
240
+ elsif value.is_a?(Hash)
241
+ {}.tap do |hash|
242
+ value.each { |k, v| hash[k] = _to_hash(v) }
243
+ end
244
+ elsif value.respond_to? :to_hash
245
+ value.to_hash
246
+ else
247
+ value
248
+ end
249
+ end
250
+
251
+ end
252
+
253
+ end