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,222 +1,222 @@
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
-
26
- class DocumentPagesResponse
27
- # Response status code.
28
- attr_accessor :code
29
-
30
- # Response status.
31
- attr_accessor :status
32
-
33
- attr_accessor :pages
34
-
35
-
36
- # Attribute mapping from ruby-style variable name to JSON key.
37
- def self.attribute_map
38
- {
39
- :'code' => :'Code',
40
- :'status' => :'Status',
41
- :'pages' => :'Pages'
42
- }
43
- end
44
-
45
- # Attribute type mapping.
46
- def self.swagger_types
47
- {
48
- :'code' => :'HttpStatusCode',
49
- :'status' => :'String',
50
- :'pages' => :'Pages'
51
- }
52
- end
53
-
54
- # Initializes the object
55
- # @param [Hash] attributes Model attributes in the form of hash
56
- def initialize(attributes = {})
57
- return unless attributes.is_a?(Hash)
58
-
59
- # convert string to symbol for hash key
60
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
61
-
62
- if attributes.has_key?(:'Code')
63
- self.code = attributes[:'Code']
64
- end
65
-
66
- if attributes.has_key?(:'Status')
67
- self.status = attributes[:'Status']
68
- end
69
-
70
- if attributes.has_key?(:'Pages')
71
- self.pages = attributes[:'Pages']
72
- end
73
-
74
- end
75
-
76
- # Show invalid properties with the reasons. Usually used together with valid?
77
- # @return Array for valid properies with the reasons
78
- def list_invalid_properties
79
- invalid_properties = Array.new
80
- if @code.nil?
81
- invalid_properties.push("invalid value for 'code', code cannot be nil.")
82
- end
83
-
84
- return invalid_properties
85
- end
86
-
87
- # Check to see if the all the properties in the model are valid
88
- # @return true if the model is valid
89
- def valid?
90
- return false if @code.nil?
91
- return true
92
- end
93
-
94
- # Checks equality by comparing each attribute.
95
- # @param [Object] Object to be compared
96
- def ==(o)
97
- return true if self.equal?(o)
98
- self.class == o.class &&
99
- code == o.code &&
100
- status == o.status &&
101
- pages == o.pages
102
- end
103
-
104
- # @see the `==` method
105
- # @param [Object] Object to be compared
106
- def eql?(o)
107
- self == o
108
- end
109
-
110
- # Calculates hash code according to all attributes.
111
- # @return [Fixnum] Hash code
112
- def hash
113
- [code, status, pages].hash
114
- end
115
-
116
- # Builds the object from hash
117
- # @param [Hash] attributes Model attributes in the form of hash
118
- # @return [Object] Returns the model itself
119
- def build_from_hash(attributes)
120
- return nil unless attributes.is_a?(Hash)
121
- self.class.swagger_types.each_pair do |key, type|
122
- if type =~ /\AArray<(.*)>/i
123
- # check to ensure the input is an array given that the the attribute
124
- # is documented as an array but the input is not
125
- if attributes[self.class.attribute_map[key]].is_a?(Array)
126
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
127
- end
128
- elsif !attributes[self.class.attribute_map[key]].nil?
129
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
130
- end # or else data not found in attributes(hash), not an issue as the data can be optional
131
- end
132
-
133
- self
134
- end
135
-
136
- # Deserializes the data based on type
137
- # @param string type Data type
138
- # @param string value Value to be deserialized
139
- # @return [Object] Deserialized data
140
- def _deserialize(type, value)
141
- case type.to_sym
142
- when :DateTime
143
- DateTime.parse(value)
144
- when :Date
145
- Date.parse(value)
146
- when :String
147
- value.to_s
148
- when :Integer
149
- value.to_i
150
- when :Float
151
- value.to_f
152
- when :BOOLEAN
153
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
154
- true
155
- else
156
- false
157
- end
158
- when :Object
159
- # generic object (usually a Hash), return directly
160
- value
161
- when /\AArray<(?<inner_type>.+)>\z/
162
- inner_type = Regexp.last_match[:inner_type]
163
- value.map { |v| _deserialize(inner_type, v) }
164
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
165
- k_type = Regexp.last_match[:k_type]
166
- v_type = Regexp.last_match[:v_type]
167
- {}.tap do |hash|
168
- value.each do |k, v|
169
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
170
- end
171
- end
172
- else # model
173
- temp_model = AsposePdfCloud.const_get(type).new
174
- temp_model.build_from_hash(value)
175
- end
176
- end
177
-
178
- # Returns the string representation of the object
179
- # @return [String] String presentation of the object
180
- def to_s
181
- to_hash.to_s
182
- end
183
-
184
- # to_body is an alias to to_hash (backward compatibility)
185
- # @return [Hash] Returns the object in the form of hash
186
- def to_body
187
- to_hash
188
- end
189
-
190
- # Returns the object in the form of hash
191
- # @return [Hash] Returns the object in the form of hash
192
- def to_hash
193
- hash = {}
194
- self.class.attribute_map.each_pair do |attr, param|
195
- value = self.send(attr)
196
- next if value.nil?
197
- hash[param] = _to_hash(value)
198
- end
199
- hash
200
- end
201
-
202
- # Outputs non-array value in the form of hash
203
- # For object, use to_hash. Otherwise, just return the value
204
- # @param [Object] value Any valid value
205
- # @return [Hash] Returns the value in the form of hash
206
- def _to_hash(value)
207
- if value.is_a?(Array)
208
- value.compact.map{ |v| _to_hash(v) }
209
- elsif value.is_a?(Hash)
210
- {}.tap do |hash|
211
- value.each { |k, v| hash[k] = _to_hash(v) }
212
- end
213
- elsif value.respond_to? :to_hash
214
- value.to_hash
215
- else
216
- value
217
- end
218
- end
219
-
220
- end
221
-
222
- 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
+
26
+ class DocumentPagesResponse
27
+ # Response status code.
28
+ attr_accessor :code
29
+
30
+ # Response status.
31
+ attr_accessor :status
32
+
33
+ attr_accessor :pages
34
+
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'code' => :'Code',
40
+ :'status' => :'Status',
41
+ :'pages' => :'Pages'
42
+ }
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.swagger_types
47
+ {
48
+ :'code' => :'HttpStatusCode',
49
+ :'status' => :'String',
50
+ :'pages' => :'Pages'
51
+ }
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ return unless attributes.is_a?(Hash)
58
+
59
+ # convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
61
+
62
+ if attributes.has_key?(:'Code')
63
+ self.code = attributes[:'Code']
64
+ end
65
+
66
+ if attributes.has_key?(:'Status')
67
+ self.status = attributes[:'Status']
68
+ end
69
+
70
+ if attributes.has_key?(:'Pages')
71
+ self.pages = attributes[:'Pages']
72
+ end
73
+
74
+ end
75
+
76
+ # Show invalid properties with the reasons. Usually used together with valid?
77
+ # @return Array for valid properies with the reasons
78
+ def list_invalid_properties
79
+ invalid_properties = Array.new
80
+ if @code.nil?
81
+ invalid_properties.push("invalid value for 'code', code cannot be nil.")
82
+ end
83
+
84
+ return invalid_properties
85
+ end
86
+
87
+ # Check to see if the all the properties in the model are valid
88
+ # @return true if the model is valid
89
+ def valid?
90
+ return false if @code.nil?
91
+ return true
92
+ end
93
+
94
+ # Checks equality by comparing each attribute.
95
+ # @param [Object] Object to be compared
96
+ def ==(o)
97
+ return true if self.equal?(o)
98
+ self.class == o.class &&
99
+ code == o.code &&
100
+ status == o.status &&
101
+ pages == o.pages
102
+ end
103
+
104
+ # @see the `==` method
105
+ # @param [Object] Object to be compared
106
+ def eql?(o)
107
+ self == o
108
+ end
109
+
110
+ # Calculates hash code according to all attributes.
111
+ # @return [Fixnum] Hash code
112
+ def hash
113
+ [code, status, pages].hash
114
+ end
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def build_from_hash(attributes)
120
+ return nil unless attributes.is_a?(Hash)
121
+ self.class.swagger_types.each_pair do |key, type|
122
+ if type =~ /\AArray<(.*)>/i
123
+ # check to ensure the input is an array given that the the attribute
124
+ # is documented as an array but the input is not
125
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
126
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
127
+ end
128
+ elsif !attributes[self.class.attribute_map[key]].nil?
129
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
130
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
131
+ end
132
+
133
+ self
134
+ end
135
+
136
+ # Deserializes the data based on type
137
+ # @param string type Data type
138
+ # @param string value Value to be deserialized
139
+ # @return [Object] Deserialized data
140
+ def _deserialize(type, value)
141
+ case type.to_sym
142
+ when :DateTime
143
+ DateTime.parse(value)
144
+ when :Date
145
+ Date.parse(value)
146
+ when :String
147
+ value.to_s
148
+ when :Integer
149
+ value.to_i
150
+ when :Float
151
+ value.to_f
152
+ when :BOOLEAN
153
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
154
+ true
155
+ else
156
+ false
157
+ end
158
+ when :Object
159
+ # generic object (usually a Hash), return directly
160
+ value
161
+ when /\AArray<(?<inner_type>.+)>\z/
162
+ inner_type = Regexp.last_match[:inner_type]
163
+ value.map { |v| _deserialize(inner_type, v) }
164
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
165
+ k_type = Regexp.last_match[:k_type]
166
+ v_type = Regexp.last_match[:v_type]
167
+ {}.tap do |hash|
168
+ value.each do |k, v|
169
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
170
+ end
171
+ end
172
+ else # model
173
+ temp_model = AsposePdfCloud.const_get(type).new
174
+ temp_model.build_from_hash(value)
175
+ end
176
+ end
177
+
178
+ # Returns the string representation of the object
179
+ # @return [String] String presentation of the object
180
+ def to_s
181
+ to_hash.to_s
182
+ end
183
+
184
+ # to_body is an alias to to_hash (backward compatibility)
185
+ # @return [Hash] Returns the object in the form of hash
186
+ def to_body
187
+ to_hash
188
+ end
189
+
190
+ # Returns the object in the form of hash
191
+ # @return [Hash] Returns the object in the form of hash
192
+ def to_hash
193
+ hash = {}
194
+ self.class.attribute_map.each_pair do |attr, param|
195
+ value = self.send(attr)
196
+ next if value.nil?
197
+ hash[param] = _to_hash(value)
198
+ end
199
+ hash
200
+ end
201
+
202
+ # Outputs non-array value in the form of hash
203
+ # For object, use to_hash. Otherwise, just return the value
204
+ # @param [Object] value Any valid value
205
+ # @return [Hash] Returns the value in the form of hash
206
+ def _to_hash(value)
207
+ if value.is_a?(Array)
208
+ value.compact.map{ |v| _to_hash(v) }
209
+ elsif value.is_a?(Hash)
210
+ {}.tap do |hash|
211
+ value.each { |k, v| hash[k] = _to_hash(v) }
212
+ end
213
+ elsif value.respond_to? :to_hash
214
+ value.to_hash
215
+ else
216
+ value
217
+ end
218
+ end
219
+
220
+ end
221
+
222
+ end
@@ -1,298 +1,298 @@
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
- # Represents the privileges for accessing Pdf file./>.
26
- class DocumentPrivilege
27
- # Sets the permission which allow print or not. true is allow and false or not set is forbidden.
28
- attr_accessor :allow_print
29
-
30
- # Sets the permission which allow degraded printing or not. true is allow and false or not set is forbidden.
31
- attr_accessor :allow_degraded_printing
32
-
33
- # Sets the permission which allow modify contents or not. true is allow and false or not set is forbidden.
34
- attr_accessor :allow_modify_contents
35
-
36
- # Sets the permission which allow copy or not. true is allow and false or not set is forbidden.
37
- attr_accessor :allow_copy
38
-
39
- # Sets the permission which allow modify annotations or not. true is allow and false or not set is forbidden.
40
- attr_accessor :allow_modify_annotations
41
-
42
- # Sets the permission which allow fill in forms or not. true is allow and false or not set is forbidden.
43
- attr_accessor :allow_fill_in
44
-
45
- # Sets the permission which allow screen readers or not. true is allow and false or not set is forbidden.
46
- attr_accessor :allow_screen_readers
47
-
48
- # Sets the permission which allow assembly or not. true is allow and false or not set is forbidden.
49
- attr_accessor :allow_assembly
50
-
51
- # Sets the print level of document's privilege. Just as the Adobe Professional's Printing Allowed settings. 0: None. 1: Low Resolution (150 dpi). 2: High Resolution.
52
- attr_accessor :print_allow_level
53
-
54
- # Sets the change level of document's privilege. Just as the Adobe Professional's Changes Allowed settings. 0: None. 1: Inserting, Deleting and Rotating pages. 2: Filling in form fields and signing existing signature fields. 3: Commenting, filling in form fields, and signing existing signature fields. 4: Any except extracting pages.
55
- attr_accessor :change_allow_level
56
-
57
- # Sets the copy level of document's privilege. Just as the Adobe Professional's permission settings. 0: None. 1: Enable text access for screen reader devices for the visually impaired. 2: Enable copying of text, images and other content.
58
- attr_accessor :copy_allow_level
59
-
60
-
61
- # Attribute mapping from ruby-style variable name to JSON key.
62
- def self.attribute_map
63
- {
64
- :'allow_print' => :'AllowPrint',
65
- :'allow_degraded_printing' => :'AllowDegradedPrinting',
66
- :'allow_modify_contents' => :'AllowModifyContents',
67
- :'allow_copy' => :'AllowCopy',
68
- :'allow_modify_annotations' => :'AllowModifyAnnotations',
69
- :'allow_fill_in' => :'AllowFillIn',
70
- :'allow_screen_readers' => :'AllowScreenReaders',
71
- :'allow_assembly' => :'AllowAssembly',
72
- :'print_allow_level' => :'PrintAllowLevel',
73
- :'change_allow_level' => :'ChangeAllowLevel',
74
- :'copy_allow_level' => :'CopyAllowLevel'
75
- }
76
- end
77
-
78
- # Attribute type mapping.
79
- def self.swagger_types
80
- {
81
- :'allow_print' => :'BOOLEAN',
82
- :'allow_degraded_printing' => :'BOOLEAN',
83
- :'allow_modify_contents' => :'BOOLEAN',
84
- :'allow_copy' => :'BOOLEAN',
85
- :'allow_modify_annotations' => :'BOOLEAN',
86
- :'allow_fill_in' => :'BOOLEAN',
87
- :'allow_screen_readers' => :'BOOLEAN',
88
- :'allow_assembly' => :'BOOLEAN',
89
- :'print_allow_level' => :'Integer',
90
- :'change_allow_level' => :'Integer',
91
- :'copy_allow_level' => :'Integer'
92
- }
93
- end
94
-
95
- # Initializes the object
96
- # @param [Hash] attributes Model attributes in the form of hash
97
- def initialize(attributes = {})
98
- return unless attributes.is_a?(Hash)
99
-
100
- # convert string to symbol for hash key
101
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
102
-
103
- if attributes.has_key?(:'AllowPrint')
104
- self.allow_print = attributes[:'AllowPrint']
105
- end
106
-
107
- if attributes.has_key?(:'AllowDegradedPrinting')
108
- self.allow_degraded_printing = attributes[:'AllowDegradedPrinting']
109
- end
110
-
111
- if attributes.has_key?(:'AllowModifyContents')
112
- self.allow_modify_contents = attributes[:'AllowModifyContents']
113
- end
114
-
115
- if attributes.has_key?(:'AllowCopy')
116
- self.allow_copy = attributes[:'AllowCopy']
117
- end
118
-
119
- if attributes.has_key?(:'AllowModifyAnnotations')
120
- self.allow_modify_annotations = attributes[:'AllowModifyAnnotations']
121
- end
122
-
123
- if attributes.has_key?(:'AllowFillIn')
124
- self.allow_fill_in = attributes[:'AllowFillIn']
125
- end
126
-
127
- if attributes.has_key?(:'AllowScreenReaders')
128
- self.allow_screen_readers = attributes[:'AllowScreenReaders']
129
- end
130
-
131
- if attributes.has_key?(:'AllowAssembly')
132
- self.allow_assembly = attributes[:'AllowAssembly']
133
- end
134
-
135
- if attributes.has_key?(:'PrintAllowLevel')
136
- self.print_allow_level = attributes[:'PrintAllowLevel']
137
- end
138
-
139
- if attributes.has_key?(:'ChangeAllowLevel')
140
- self.change_allow_level = attributes[:'ChangeAllowLevel']
141
- end
142
-
143
- if attributes.has_key?(:'CopyAllowLevel')
144
- self.copy_allow_level = attributes[:'CopyAllowLevel']
145
- end
146
-
147
- end
148
-
149
- # Show invalid properties with the reasons. Usually used together with valid?
150
- # @return Array for valid properies with the reasons
151
- def list_invalid_properties
152
- invalid_properties = Array.new
153
- return invalid_properties
154
- end
155
-
156
- # Check to see if the all the properties in the model are valid
157
- # @return true if the model is valid
158
- def valid?
159
- return true
160
- end
161
-
162
- # Checks equality by comparing each attribute.
163
- # @param [Object] Object to be compared
164
- def ==(o)
165
- return true if self.equal?(o)
166
- self.class == o.class &&
167
- allow_print == o.allow_print &&
168
- allow_degraded_printing == o.allow_degraded_printing &&
169
- allow_modify_contents == o.allow_modify_contents &&
170
- allow_copy == o.allow_copy &&
171
- allow_modify_annotations == o.allow_modify_annotations &&
172
- allow_fill_in == o.allow_fill_in &&
173
- allow_screen_readers == o.allow_screen_readers &&
174
- allow_assembly == o.allow_assembly &&
175
- print_allow_level == o.print_allow_level &&
176
- change_allow_level == o.change_allow_level &&
177
- copy_allow_level == o.copy_allow_level
178
- end
179
-
180
- # @see the `==` method
181
- # @param [Object] Object to be compared
182
- def eql?(o)
183
- self == o
184
- end
185
-
186
- # Calculates hash code according to all attributes.
187
- # @return [Fixnum] Hash code
188
- def hash
189
- [allow_print, allow_degraded_printing, allow_modify_contents, allow_copy, allow_modify_annotations, allow_fill_in, allow_screen_readers, allow_assembly, print_allow_level, change_allow_level, copy_allow_level].hash
190
- end
191
-
192
- # Builds the object from hash
193
- # @param [Hash] attributes Model attributes in the form of hash
194
- # @return [Object] Returns the model itself
195
- def build_from_hash(attributes)
196
- return nil unless attributes.is_a?(Hash)
197
- self.class.swagger_types.each_pair do |key, type|
198
- if type =~ /\AArray<(.*)>/i
199
- # check to ensure the input is an array given that the the attribute
200
- # is documented as an array but the input is not
201
- if attributes[self.class.attribute_map[key]].is_a?(Array)
202
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
203
- end
204
- elsif !attributes[self.class.attribute_map[key]].nil?
205
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
206
- end # or else data not found in attributes(hash), not an issue as the data can be optional
207
- end
208
-
209
- self
210
- end
211
-
212
- # Deserializes the data based on type
213
- # @param string type Data type
214
- # @param string value Value to be deserialized
215
- # @return [Object] Deserialized data
216
- def _deserialize(type, value)
217
- case type.to_sym
218
- when :DateTime
219
- DateTime.parse(value)
220
- when :Date
221
- Date.parse(value)
222
- when :String
223
- value.to_s
224
- when :Integer
225
- value.to_i
226
- when :Float
227
- value.to_f
228
- when :BOOLEAN
229
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
230
- true
231
- else
232
- false
233
- end
234
- when :Object
235
- # generic object (usually a Hash), return directly
236
- value
237
- when /\AArray<(?<inner_type>.+)>\z/
238
- inner_type = Regexp.last_match[:inner_type]
239
- value.map { |v| _deserialize(inner_type, v) }
240
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
241
- k_type = Regexp.last_match[:k_type]
242
- v_type = Regexp.last_match[:v_type]
243
- {}.tap do |hash|
244
- value.each do |k, v|
245
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
246
- end
247
- end
248
- else # model
249
- temp_model = AsposePdfCloud.const_get(type).new
250
- temp_model.build_from_hash(value)
251
- end
252
- end
253
-
254
- # Returns the string representation of the object
255
- # @return [String] String presentation of the object
256
- def to_s
257
- to_hash.to_s
258
- end
259
-
260
- # to_body is an alias to to_hash (backward compatibility)
261
- # @return [Hash] Returns the object in the form of hash
262
- def to_body
263
- to_hash
264
- end
265
-
266
- # Returns the object in the form of hash
267
- # @return [Hash] Returns the object in the form of hash
268
- def to_hash
269
- hash = {}
270
- self.class.attribute_map.each_pair do |attr, param|
271
- value = self.send(attr)
272
- next if value.nil?
273
- hash[param] = _to_hash(value)
274
- end
275
- hash
276
- end
277
-
278
- # Outputs non-array value in the form of hash
279
- # For object, use to_hash. Otherwise, just return the value
280
- # @param [Object] value Any valid value
281
- # @return [Hash] Returns the value in the form of hash
282
- def _to_hash(value)
283
- if value.is_a?(Array)
284
- value.compact.map{ |v| _to_hash(v) }
285
- elsif value.is_a?(Hash)
286
- {}.tap do |hash|
287
- value.each { |k, v| hash[k] = _to_hash(v) }
288
- end
289
- elsif value.respond_to? :to_hash
290
- value.to_hash
291
- else
292
- value
293
- end
294
- end
295
-
296
- end
297
-
298
- 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
+ # Represents the privileges for accessing Pdf file./>.
26
+ class DocumentPrivilege
27
+ # Sets the permission which allow print or not. true is allow and false or not set is forbidden.
28
+ attr_accessor :allow_print
29
+
30
+ # Sets the permission which allow degraded printing or not. true is allow and false or not set is forbidden.
31
+ attr_accessor :allow_degraded_printing
32
+
33
+ # Sets the permission which allow modify contents or not. true is allow and false or not set is forbidden.
34
+ attr_accessor :allow_modify_contents
35
+
36
+ # Sets the permission which allow copy or not. true is allow and false or not set is forbidden.
37
+ attr_accessor :allow_copy
38
+
39
+ # Sets the permission which allow modify annotations or not. true is allow and false or not set is forbidden.
40
+ attr_accessor :allow_modify_annotations
41
+
42
+ # Sets the permission which allow fill in forms or not. true is allow and false or not set is forbidden.
43
+ attr_accessor :allow_fill_in
44
+
45
+ # Sets the permission which allow screen readers or not. true is allow and false or not set is forbidden.
46
+ attr_accessor :allow_screen_readers
47
+
48
+ # Sets the permission which allow assembly or not. true is allow and false or not set is forbidden.
49
+ attr_accessor :allow_assembly
50
+
51
+ # Sets the print level of document's privilege. Just as the Adobe Professional's Printing Allowed settings. 0: None. 1: Low Resolution (150 dpi). 2: High Resolution.
52
+ attr_accessor :print_allow_level
53
+
54
+ # Sets the change level of document's privilege. Just as the Adobe Professional's Changes Allowed settings. 0: None. 1: Inserting, Deleting and Rotating pages. 2: Filling in form fields and signing existing signature fields. 3: Commenting, filling in form fields, and signing existing signature fields. 4: Any except extracting pages.
55
+ attr_accessor :change_allow_level
56
+
57
+ # Sets the copy level of document's privilege. Just as the Adobe Professional's permission settings. 0: None. 1: Enable text access for screen reader devices for the visually impaired. 2: Enable copying of text, images and other content.
58
+ attr_accessor :copy_allow_level
59
+
60
+
61
+ # Attribute mapping from ruby-style variable name to JSON key.
62
+ def self.attribute_map
63
+ {
64
+ :'allow_print' => :'AllowPrint',
65
+ :'allow_degraded_printing' => :'AllowDegradedPrinting',
66
+ :'allow_modify_contents' => :'AllowModifyContents',
67
+ :'allow_copy' => :'AllowCopy',
68
+ :'allow_modify_annotations' => :'AllowModifyAnnotations',
69
+ :'allow_fill_in' => :'AllowFillIn',
70
+ :'allow_screen_readers' => :'AllowScreenReaders',
71
+ :'allow_assembly' => :'AllowAssembly',
72
+ :'print_allow_level' => :'PrintAllowLevel',
73
+ :'change_allow_level' => :'ChangeAllowLevel',
74
+ :'copy_allow_level' => :'CopyAllowLevel'
75
+ }
76
+ end
77
+
78
+ # Attribute type mapping.
79
+ def self.swagger_types
80
+ {
81
+ :'allow_print' => :'BOOLEAN',
82
+ :'allow_degraded_printing' => :'BOOLEAN',
83
+ :'allow_modify_contents' => :'BOOLEAN',
84
+ :'allow_copy' => :'BOOLEAN',
85
+ :'allow_modify_annotations' => :'BOOLEAN',
86
+ :'allow_fill_in' => :'BOOLEAN',
87
+ :'allow_screen_readers' => :'BOOLEAN',
88
+ :'allow_assembly' => :'BOOLEAN',
89
+ :'print_allow_level' => :'Integer',
90
+ :'change_allow_level' => :'Integer',
91
+ :'copy_allow_level' => :'Integer'
92
+ }
93
+ end
94
+
95
+ # Initializes the object
96
+ # @param [Hash] attributes Model attributes in the form of hash
97
+ def initialize(attributes = {})
98
+ return unless attributes.is_a?(Hash)
99
+
100
+ # convert string to symbol for hash key
101
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
102
+
103
+ if attributes.has_key?(:'AllowPrint')
104
+ self.allow_print = attributes[:'AllowPrint']
105
+ end
106
+
107
+ if attributes.has_key?(:'AllowDegradedPrinting')
108
+ self.allow_degraded_printing = attributes[:'AllowDegradedPrinting']
109
+ end
110
+
111
+ if attributes.has_key?(:'AllowModifyContents')
112
+ self.allow_modify_contents = attributes[:'AllowModifyContents']
113
+ end
114
+
115
+ if attributes.has_key?(:'AllowCopy')
116
+ self.allow_copy = attributes[:'AllowCopy']
117
+ end
118
+
119
+ if attributes.has_key?(:'AllowModifyAnnotations')
120
+ self.allow_modify_annotations = attributes[:'AllowModifyAnnotations']
121
+ end
122
+
123
+ if attributes.has_key?(:'AllowFillIn')
124
+ self.allow_fill_in = attributes[:'AllowFillIn']
125
+ end
126
+
127
+ if attributes.has_key?(:'AllowScreenReaders')
128
+ self.allow_screen_readers = attributes[:'AllowScreenReaders']
129
+ end
130
+
131
+ if attributes.has_key?(:'AllowAssembly')
132
+ self.allow_assembly = attributes[:'AllowAssembly']
133
+ end
134
+
135
+ if attributes.has_key?(:'PrintAllowLevel')
136
+ self.print_allow_level = attributes[:'PrintAllowLevel']
137
+ end
138
+
139
+ if attributes.has_key?(:'ChangeAllowLevel')
140
+ self.change_allow_level = attributes[:'ChangeAllowLevel']
141
+ end
142
+
143
+ if attributes.has_key?(:'CopyAllowLevel')
144
+ self.copy_allow_level = attributes[:'CopyAllowLevel']
145
+ end
146
+
147
+ end
148
+
149
+ # Show invalid properties with the reasons. Usually used together with valid?
150
+ # @return Array for valid properies with the reasons
151
+ def list_invalid_properties
152
+ invalid_properties = Array.new
153
+ return invalid_properties
154
+ end
155
+
156
+ # Check to see if the all the properties in the model are valid
157
+ # @return true if the model is valid
158
+ def valid?
159
+ return true
160
+ end
161
+
162
+ # Checks equality by comparing each attribute.
163
+ # @param [Object] Object to be compared
164
+ def ==(o)
165
+ return true if self.equal?(o)
166
+ self.class == o.class &&
167
+ allow_print == o.allow_print &&
168
+ allow_degraded_printing == o.allow_degraded_printing &&
169
+ allow_modify_contents == o.allow_modify_contents &&
170
+ allow_copy == o.allow_copy &&
171
+ allow_modify_annotations == o.allow_modify_annotations &&
172
+ allow_fill_in == o.allow_fill_in &&
173
+ allow_screen_readers == o.allow_screen_readers &&
174
+ allow_assembly == o.allow_assembly &&
175
+ print_allow_level == o.print_allow_level &&
176
+ change_allow_level == o.change_allow_level &&
177
+ copy_allow_level == o.copy_allow_level
178
+ end
179
+
180
+ # @see the `==` method
181
+ # @param [Object] Object to be compared
182
+ def eql?(o)
183
+ self == o
184
+ end
185
+
186
+ # Calculates hash code according to all attributes.
187
+ # @return [Fixnum] Hash code
188
+ def hash
189
+ [allow_print, allow_degraded_printing, allow_modify_contents, allow_copy, allow_modify_annotations, allow_fill_in, allow_screen_readers, allow_assembly, print_allow_level, change_allow_level, copy_allow_level].hash
190
+ end
191
+
192
+ # Builds the object from hash
193
+ # @param [Hash] attributes Model attributes in the form of hash
194
+ # @return [Object] Returns the model itself
195
+ def build_from_hash(attributes)
196
+ return nil unless attributes.is_a?(Hash)
197
+ self.class.swagger_types.each_pair do |key, type|
198
+ if type =~ /\AArray<(.*)>/i
199
+ # check to ensure the input is an array given that the the attribute
200
+ # is documented as an array but the input is not
201
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
202
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
203
+ end
204
+ elsif !attributes[self.class.attribute_map[key]].nil?
205
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
206
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
207
+ end
208
+
209
+ self
210
+ end
211
+
212
+ # Deserializes the data based on type
213
+ # @param string type Data type
214
+ # @param string value Value to be deserialized
215
+ # @return [Object] Deserialized data
216
+ def _deserialize(type, value)
217
+ case type.to_sym
218
+ when :DateTime
219
+ DateTime.parse(value)
220
+ when :Date
221
+ Date.parse(value)
222
+ when :String
223
+ value.to_s
224
+ when :Integer
225
+ value.to_i
226
+ when :Float
227
+ value.to_f
228
+ when :BOOLEAN
229
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
230
+ true
231
+ else
232
+ false
233
+ end
234
+ when :Object
235
+ # generic object (usually a Hash), return directly
236
+ value
237
+ when /\AArray<(?<inner_type>.+)>\z/
238
+ inner_type = Regexp.last_match[:inner_type]
239
+ value.map { |v| _deserialize(inner_type, v) }
240
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
241
+ k_type = Regexp.last_match[:k_type]
242
+ v_type = Regexp.last_match[:v_type]
243
+ {}.tap do |hash|
244
+ value.each do |k, v|
245
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
246
+ end
247
+ end
248
+ else # model
249
+ temp_model = AsposePdfCloud.const_get(type).new
250
+ temp_model.build_from_hash(value)
251
+ end
252
+ end
253
+
254
+ # Returns the string representation of the object
255
+ # @return [String] String presentation of the object
256
+ def to_s
257
+ to_hash.to_s
258
+ end
259
+
260
+ # to_body is an alias to to_hash (backward compatibility)
261
+ # @return [Hash] Returns the object in the form of hash
262
+ def to_body
263
+ to_hash
264
+ end
265
+
266
+ # Returns the object in the form of hash
267
+ # @return [Hash] Returns the object in the form of hash
268
+ def to_hash
269
+ hash = {}
270
+ self.class.attribute_map.each_pair do |attr, param|
271
+ value = self.send(attr)
272
+ next if value.nil?
273
+ hash[param] = _to_hash(value)
274
+ end
275
+ hash
276
+ end
277
+
278
+ # Outputs non-array value in the form of hash
279
+ # For object, use to_hash. Otherwise, just return the value
280
+ # @param [Object] value Any valid value
281
+ # @return [Hash] Returns the value in the form of hash
282
+ def _to_hash(value)
283
+ if value.is_a?(Array)
284
+ value.compact.map{ |v| _to_hash(v) }
285
+ elsif value.is_a?(Hash)
286
+ {}.tap do |hash|
287
+ value.each { |k, v| hash[k] = _to_hash(v) }
288
+ end
289
+ elsif value.respond_to? :to_hash
290
+ value.to_hash
291
+ else
292
+ value
293
+ end
294
+ end
295
+
296
+ end
297
+
298
+ end