aspose_pdf_cloud 18.7.0 → 18.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/aspose_pdf_cloud.gemspec +53 -49
  3. data/lib/aspose_pdf_cloud.rb +150 -145
  4. data/lib/aspose_pdf_cloud/api/pdf_api.rb +12907 -11705
  5. data/lib/aspose_pdf_cloud/api_client.rb +2 -2
  6. data/lib/aspose_pdf_cloud/api_error.rb +47 -47
  7. data/lib/aspose_pdf_cloud/configuration.rb +175 -185
  8. data/lib/aspose_pdf_cloud/models/annotation.rb +332 -260
  9. data/lib/aspose_pdf_cloud/models/annotation_flags.rb +52 -0
  10. data/lib/aspose_pdf_cloud/models/annotation_info.rb +342 -0
  11. data/lib/aspose_pdf_cloud/models/annotation_state.rb +49 -0
  12. data/lib/aspose_pdf_cloud/models/annotation_type.rb +69 -0
  13. data/lib/aspose_pdf_cloud/models/{annotations.rb → annotations_info.rb} +211 -211
  14. data/lib/aspose_pdf_cloud/models/{annotations_response.rb → annotations_info_response.rb} +222 -222
  15. data/lib/aspose_pdf_cloud/models/antialiasing_processing_type.rb +43 -43
  16. data/lib/aspose_pdf_cloud/models/append_document.rb +233 -228
  17. data/lib/aspose_pdf_cloud/models/{saa_spose_response.rb → aspose_response.rb} +213 -213
  18. data/lib/aspose_pdf_cloud/models/attachment.rb +270 -270
  19. data/lib/aspose_pdf_cloud/models/attachment_response.rb +222 -222
  20. data/lib/aspose_pdf_cloud/models/attachments.rb +211 -211
  21. data/lib/aspose_pdf_cloud/models/attachments_response.rb +222 -222
  22. data/lib/aspose_pdf_cloud/models/color.rb +244 -244
  23. data/lib/aspose_pdf_cloud/models/color_depth.rb +45 -45
  24. data/lib/aspose_pdf_cloud/models/compression_type.rb +46 -46
  25. data/lib/aspose_pdf_cloud/models/doc_format.rb +43 -43
  26. data/lib/aspose_pdf_cloud/models/doc_recognition_mode.rb +43 -43
  27. data/lib/aspose_pdf_cloud/models/document.rb +220 -220
  28. data/lib/aspose_pdf_cloud/models/{text_item_response.rb → document_page_response.rb} +222 -222
  29. data/lib/aspose_pdf_cloud/models/document_pages_response.rb +222 -222
  30. data/lib/aspose_pdf_cloud/models/document_privilege.rb +298 -298
  31. data/lib/aspose_pdf_cloud/models/document_properties.rb +211 -211
  32. data/lib/aspose_pdf_cloud/models/document_properties_response.rb +222 -222
  33. data/lib/aspose_pdf_cloud/models/document_property.rb +227 -227
  34. data/lib/aspose_pdf_cloud/models/document_property_response.rb +222 -222
  35. data/lib/aspose_pdf_cloud/models/document_response.rb +233 -233
  36. data/lib/aspose_pdf_cloud/models/epub_recognition_mode.rb +44 -44
  37. data/lib/aspose_pdf_cloud/models/field.rb +254 -254
  38. data/lib/aspose_pdf_cloud/models/field_response.rb +222 -222
  39. data/lib/aspose_pdf_cloud/models/field_type.rb +45 -44
  40. data/lib/aspose_pdf_cloud/models/fields.rb +211 -211
  41. data/lib/aspose_pdf_cloud/models/fields_response.rb +222 -222
  42. data/lib/aspose_pdf_cloud/models/font_encoding_rules.rb +43 -43
  43. data/lib/aspose_pdf_cloud/models/font_saving_modes.rb +45 -45
  44. data/lib/aspose_pdf_cloud/models/font_styles.rb +45 -43
  45. data/lib/aspose_pdf_cloud/models/free_text_annotation.rb +382 -0
  46. data/lib/aspose_pdf_cloud/models/{annotation_response.rb → free_text_annotation_response.rb} +222 -222
  47. data/lib/aspose_pdf_cloud/models/{text_items.rb → free_text_annotations.rb} +211 -211
  48. data/lib/aspose_pdf_cloud/models/{text_items_response.rb → free_text_annotations_response.rb} +222 -222
  49. data/lib/aspose_pdf_cloud/models/free_text_intent.rb +44 -0
  50. data/lib/aspose_pdf_cloud/models/horizontal_alignment.rb +45 -44
  51. data/lib/aspose_pdf_cloud/models/html_document_type.rb +43 -43
  52. data/lib/aspose_pdf_cloud/models/html_markup_generation_modes.rb +43 -43
  53. data/lib/aspose_pdf_cloud/models/image.rb +250 -220
  54. data/lib/aspose_pdf_cloud/models/image_response.rb +222 -222
  55. data/lib/aspose_pdf_cloud/models/image_src_type.rb +43 -43
  56. data/lib/aspose_pdf_cloud/models/image_template.rb +281 -281
  57. data/lib/aspose_pdf_cloud/models/image_templates_request.rb +230 -230
  58. data/lib/aspose_pdf_cloud/models/images.rb +211 -211
  59. data/lib/aspose_pdf_cloud/models/images_response.rb +222 -222
  60. data/lib/aspose_pdf_cloud/models/justification.rb +44 -0
  61. data/lib/aspose_pdf_cloud/models/letters_positioning_methods.rb +43 -43
  62. data/lib/aspose_pdf_cloud/models/line_spacing.rb +43 -43
  63. data/lib/aspose_pdf_cloud/models/link.rb +228 -228
  64. data/lib/aspose_pdf_cloud/models/link_action_type.rb +47 -46
  65. data/lib/aspose_pdf_cloud/models/link_annotation.rb +254 -236
  66. data/lib/aspose_pdf_cloud/models/link_annotation_response.rb +222 -222
  67. data/lib/aspose_pdf_cloud/models/link_annotations.rb +211 -211
  68. data/lib/aspose_pdf_cloud/models/link_annotations_response.rb +222 -222
  69. data/lib/aspose_pdf_cloud/models/link_element.rb +200 -200
  70. data/lib/aspose_pdf_cloud/models/link_highlighting_mode.rb +46 -45
  71. data/lib/aspose_pdf_cloud/models/margin_info.rb +244 -244
  72. data/lib/aspose_pdf_cloud/models/markup_annotation.rb +342 -0
  73. data/lib/aspose_pdf_cloud/models/merge_documents.rb +205 -200
  74. data/lib/aspose_pdf_cloud/models/optimize_options.rb +293 -293
  75. data/lib/aspose_pdf_cloud/models/page.rb +228 -228
  76. data/lib/aspose_pdf_cloud/models/page_word_count.rb +218 -218
  77. data/lib/aspose_pdf_cloud/models/pages.rb +211 -211
  78. data/lib/aspose_pdf_cloud/models/paragraph.rb +303 -303
  79. data/lib/aspose_pdf_cloud/models/parts_embedding_modes.rb +44 -44
  80. data/lib/aspose_pdf_cloud/models/pdf_a_type.rb +43 -43
  81. data/lib/aspose_pdf_cloud/models/raster_images_saving_modes.rb +44 -44
  82. data/lib/aspose_pdf_cloud/models/{document_text_replace_response.rb → rectangle_pdf.rb} +244 -231
  83. data/lib/aspose_pdf_cloud/models/rotation.rb +45 -44
  84. data/lib/aspose_pdf_cloud/models/segment.rb +211 -206
  85. data/lib/aspose_pdf_cloud/models/shape_type.rb +44 -44
  86. data/lib/aspose_pdf_cloud/models/signature.rb +338 -333
  87. data/lib/aspose_pdf_cloud/models/signature_type.rb +44 -42
  88. data/lib/aspose_pdf_cloud/models/signature_verify_response.rb +223 -223
  89. data/lib/aspose_pdf_cloud/models/split_result.rb +200 -200
  90. data/lib/aspose_pdf_cloud/models/split_result_document.rb +238 -238
  91. data/lib/aspose_pdf_cloud/models/split_result_response.rb +223 -223
  92. data/lib/aspose_pdf_cloud/models/stamp.rb +413 -413
  93. data/lib/aspose_pdf_cloud/models/stamp_type.rb +45 -44
  94. data/lib/aspose_pdf_cloud/models/{tiff_export_options.rb → text_annotation.rb} +382 -348
  95. data/lib/aspose_pdf_cloud/models/text_annotation_response.rb +222 -0
  96. data/lib/aspose_pdf_cloud/models/{text_item.rb → text_annotations.rb} +211 -218
  97. data/lib/aspose_pdf_cloud/models/text_annotations_response.rb +222 -0
  98. data/lib/aspose_pdf_cloud/models/text_horizontal_alignment.rb +47 -47
  99. data/lib/aspose_pdf_cloud/models/text_icon.rb +52 -0
  100. data/lib/aspose_pdf_cloud/models/text_line.rb +215 -210
  101. data/lib/aspose_pdf_cloud/models/text_rect.rb +220 -220
  102. data/lib/aspose_pdf_cloud/models/text_rects.rb +199 -199
  103. data/lib/aspose_pdf_cloud/models/text_rects_response.rb +222 -222
  104. data/lib/aspose_pdf_cloud/models/text_replace.rb +253 -253
  105. data/lib/aspose_pdf_cloud/models/text_replace_list_request.rb +232 -232
  106. data/lib/aspose_pdf_cloud/models/text_replace_response.rb +222 -222
  107. data/lib/aspose_pdf_cloud/models/text_state.rb +248 -248
  108. data/lib/aspose_pdf_cloud/models/{text_format.rb → text_style.rb} +233 -227
  109. data/lib/aspose_pdf_cloud/models/vertical_alignment.rb +45 -45
  110. data/lib/aspose_pdf_cloud/models/word_count.rb +199 -199
  111. data/lib/aspose_pdf_cloud/models/word_count_response.rb +223 -223
  112. data/lib/aspose_pdf_cloud/models/wrap_mode.rb +44 -44
  113. data/lib/aspose_pdf_cloud/version.rb +24 -24
  114. data/test/pdf_tests.rb +1496 -1325
  115. data/test_data/TexExample.tex +304 -304
  116. metadata +24 -21
  117. data/.gitignore +0 -46
  118. data/.swagger-codegen-ignore +0 -58
  119. data/lib/aspose_pdf_cloud/models/http_status_code.rb +0 -87
  120. data/lib/aspose_pdf_cloud/models/images_list_request.rb +0 -205
  121. data/lib/aspose_pdf_cloud/models/page_text_replace_response.rb +0 -231
  122. data/lib/aspose_pdf_cloud/models/rectangle.rb +0 -244
  123. data/lib/aspose_pdf_cloud/models/text_format_response.rb +0 -222
  124. data/lib/aspose_pdf_cloud/models/text_replace_request.rb +0 -262
@@ -1,223 +1,223 @@
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 split result object.
26
- class SplitResultResponse
27
- # Response status code.
28
- attr_accessor :code
29
-
30
- # Response status.
31
- attr_accessor :status
32
-
33
- # Gets or sets the splitting result.
34
- attr_accessor :result
35
-
36
-
37
- # Attribute mapping from ruby-style variable name to JSON key.
38
- def self.attribute_map
39
- {
40
- :'code' => :'Code',
41
- :'status' => :'Status',
42
- :'result' => :'Result'
43
- }
44
- end
45
-
46
- # Attribute type mapping.
47
- def self.swagger_types
48
- {
49
- :'code' => :'HttpStatusCode',
50
- :'status' => :'String',
51
- :'result' => :'SplitResult'
52
- }
53
- end
54
-
55
- # Initializes the object
56
- # @param [Hash] attributes Model attributes in the form of hash
57
- def initialize(attributes = {})
58
- return unless attributes.is_a?(Hash)
59
-
60
- # convert string to symbol for hash key
61
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
62
-
63
- if attributes.has_key?(:'Code')
64
- self.code = attributes[:'Code']
65
- end
66
-
67
- if attributes.has_key?(:'Status')
68
- self.status = attributes[:'Status']
69
- end
70
-
71
- if attributes.has_key?(:'Result')
72
- self.result = attributes[:'Result']
73
- end
74
-
75
- end
76
-
77
- # Show invalid properties with the reasons. Usually used together with valid?
78
- # @return Array for valid properies with the reasons
79
- def list_invalid_properties
80
- invalid_properties = Array.new
81
- if @code.nil?
82
- invalid_properties.push("invalid value for 'code', code cannot be nil.")
83
- end
84
-
85
- return invalid_properties
86
- end
87
-
88
- # Check to see if the all the properties in the model are valid
89
- # @return true if the model is valid
90
- def valid?
91
- return false if @code.nil?
92
- return true
93
- end
94
-
95
- # Checks equality by comparing each attribute.
96
- # @param [Object] Object to be compared
97
- def ==(o)
98
- return true if self.equal?(o)
99
- self.class == o.class &&
100
- code == o.code &&
101
- status == o.status &&
102
- result == o.result
103
- end
104
-
105
- # @see the `==` method
106
- # @param [Object] Object to be compared
107
- def eql?(o)
108
- self == o
109
- end
110
-
111
- # Calculates hash code according to all attributes.
112
- # @return [Fixnum] Hash code
113
- def hash
114
- [code, status, result].hash
115
- end
116
-
117
- # Builds the object from hash
118
- # @param [Hash] attributes Model attributes in the form of hash
119
- # @return [Object] Returns the model itself
120
- def build_from_hash(attributes)
121
- return nil unless attributes.is_a?(Hash)
122
- self.class.swagger_types.each_pair do |key, type|
123
- if type =~ /\AArray<(.*)>/i
124
- # check to ensure the input is an array given that the the attribute
125
- # is documented as an array but the input is not
126
- if attributes[self.class.attribute_map[key]].is_a?(Array)
127
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
128
- end
129
- elsif !attributes[self.class.attribute_map[key]].nil?
130
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
131
- end # or else data not found in attributes(hash), not an issue as the data can be optional
132
- end
133
-
134
- self
135
- end
136
-
137
- # Deserializes the data based on type
138
- # @param string type Data type
139
- # @param string value Value to be deserialized
140
- # @return [Object] Deserialized data
141
- def _deserialize(type, value)
142
- case type.to_sym
143
- when :DateTime
144
- DateTime.parse(value)
145
- when :Date
146
- Date.parse(value)
147
- when :String
148
- value.to_s
149
- when :Integer
150
- value.to_i
151
- when :Float
152
- value.to_f
153
- when :BOOLEAN
154
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
155
- true
156
- else
157
- false
158
- end
159
- when :Object
160
- # generic object (usually a Hash), return directly
161
- value
162
- when /\AArray<(?<inner_type>.+)>\z/
163
- inner_type = Regexp.last_match[:inner_type]
164
- value.map { |v| _deserialize(inner_type, v) }
165
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
166
- k_type = Regexp.last_match[:k_type]
167
- v_type = Regexp.last_match[:v_type]
168
- {}.tap do |hash|
169
- value.each do |k, v|
170
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
171
- end
172
- end
173
- else # model
174
- temp_model = AsposePdfCloud.const_get(type).new
175
- temp_model.build_from_hash(value)
176
- end
177
- end
178
-
179
- # Returns the string representation of the object
180
- # @return [String] String presentation of the object
181
- def to_s
182
- to_hash.to_s
183
- end
184
-
185
- # to_body is an alias to to_hash (backward compatibility)
186
- # @return [Hash] Returns the object in the form of hash
187
- def to_body
188
- to_hash
189
- end
190
-
191
- # Returns the object in the form of hash
192
- # @return [Hash] Returns the object in the form of hash
193
- def to_hash
194
- hash = {}
195
- self.class.attribute_map.each_pair do |attr, param|
196
- value = self.send(attr)
197
- next if value.nil?
198
- hash[param] = _to_hash(value)
199
- end
200
- hash
201
- end
202
-
203
- # Outputs non-array value in the form of hash
204
- # For object, use to_hash. Otherwise, just return the value
205
- # @param [Object] value Any valid value
206
- # @return [Hash] Returns the value in the form of hash
207
- def _to_hash(value)
208
- if value.is_a?(Array)
209
- value.compact.map{ |v| _to_hash(v) }
210
- elsif value.is_a?(Hash)
211
- {}.tap do |hash|
212
- value.each { |k, v| hash[k] = _to_hash(v) }
213
- end
214
- elsif value.respond_to? :to_hash
215
- value.to_hash
216
- else
217
- value
218
- end
219
- end
220
-
221
- end
222
-
223
- 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 split result object.
26
+ class SplitResultResponse
27
+ # Response status code.
28
+ attr_accessor :code
29
+
30
+ # Response status.
31
+ attr_accessor :status
32
+
33
+ # Gets or sets the splitting result.
34
+ attr_accessor :result
35
+
36
+
37
+ # Attribute mapping from ruby-style variable name to JSON key.
38
+ def self.attribute_map
39
+ {
40
+ :'code' => :'Code',
41
+ :'status' => :'Status',
42
+ :'result' => :'Result'
43
+ }
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.swagger_types
48
+ {
49
+ :'code' => :'Integer',
50
+ :'status' => :'String',
51
+ :'result' => :'SplitResult'
52
+ }
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ return unless attributes.is_a?(Hash)
59
+
60
+ # convert string to symbol for hash key
61
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
62
+
63
+ if attributes.has_key?(:'Code')
64
+ self.code = attributes[:'Code']
65
+ end
66
+
67
+ if attributes.has_key?(:'Status')
68
+ self.status = attributes[:'Status']
69
+ end
70
+
71
+ if attributes.has_key?(:'Result')
72
+ self.result = attributes[:'Result']
73
+ end
74
+
75
+ end
76
+
77
+ # Show invalid properties with the reasons. Usually used together with valid?
78
+ # @return Array for valid properies with the reasons
79
+ def list_invalid_properties
80
+ invalid_properties = Array.new
81
+ if @code.nil?
82
+ invalid_properties.push("invalid value for 'code', code cannot be nil.")
83
+ end
84
+
85
+ return invalid_properties
86
+ end
87
+
88
+ # Check to see if the all the properties in the model are valid
89
+ # @return true if the model is valid
90
+ def valid?
91
+ return false if @code.nil?
92
+ return true
93
+ end
94
+
95
+ # Checks equality by comparing each attribute.
96
+ # @param [Object] Object to be compared
97
+ def ==(o)
98
+ return true if self.equal?(o)
99
+ self.class == o.class &&
100
+ code == o.code &&
101
+ status == o.status &&
102
+ result == o.result
103
+ end
104
+
105
+ # @see the `==` method
106
+ # @param [Object] Object to be compared
107
+ def eql?(o)
108
+ self == o
109
+ end
110
+
111
+ # Calculates hash code according to all attributes.
112
+ # @return [Fixnum] Hash code
113
+ def hash
114
+ [code, status, result].hash
115
+ end
116
+
117
+ # Builds the object from hash
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ # @return [Object] Returns the model itself
120
+ def build_from_hash(attributes)
121
+ return nil unless attributes.is_a?(Hash)
122
+ self.class.swagger_types.each_pair do |key, type|
123
+ if type =~ /\AArray<(.*)>/i
124
+ # check to ensure the input is an array given that the the attribute
125
+ # is documented as an array but the input is not
126
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
127
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
128
+ end
129
+ elsif !attributes[self.class.attribute_map[key]].nil?
130
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
131
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
132
+ end
133
+
134
+ self
135
+ end
136
+
137
+ # Deserializes the data based on type
138
+ # @param string type Data type
139
+ # @param string value Value to be deserialized
140
+ # @return [Object] Deserialized data
141
+ def _deserialize(type, value)
142
+ case type.to_sym
143
+ when :DateTime
144
+ DateTime.parse(value)
145
+ when :Date
146
+ Date.parse(value)
147
+ when :String
148
+ value.to_s
149
+ when :Integer
150
+ value.to_i
151
+ when :Float
152
+ value.to_f
153
+ when :BOOLEAN
154
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
155
+ true
156
+ else
157
+ false
158
+ end
159
+ when :Object
160
+ # generic object (usually a Hash), return directly
161
+ value
162
+ when /\AArray<(?<inner_type>.+)>\z/
163
+ inner_type = Regexp.last_match[:inner_type]
164
+ value.map { |v| _deserialize(inner_type, v) }
165
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
166
+ k_type = Regexp.last_match[:k_type]
167
+ v_type = Regexp.last_match[:v_type]
168
+ {}.tap do |hash|
169
+ value.each do |k, v|
170
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
171
+ end
172
+ end
173
+ else # model
174
+ temp_model = AsposePdfCloud.const_get(type).new
175
+ temp_model.build_from_hash(value)
176
+ end
177
+ end
178
+
179
+ # Returns the string representation of the object
180
+ # @return [String] String presentation of the object
181
+ def to_s
182
+ to_hash.to_s
183
+ end
184
+
185
+ # to_body is an alias to to_hash (backward compatibility)
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_body
188
+ to_hash
189
+ end
190
+
191
+ # Returns the object in the form of hash
192
+ # @return [Hash] Returns the object in the form of hash
193
+ def to_hash
194
+ hash = {}
195
+ self.class.attribute_map.each_pair do |attr, param|
196
+ value = self.send(attr)
197
+ next if value.nil?
198
+ hash[param] = _to_hash(value)
199
+ end
200
+ hash
201
+ end
202
+
203
+ # Outputs non-array value in the form of hash
204
+ # For object, use to_hash. Otherwise, just return the value
205
+ # @param [Object] value Any valid value
206
+ # @return [Hash] Returns the value in the form of hash
207
+ def _to_hash(value)
208
+ if value.is_a?(Array)
209
+ value.compact.map{ |v| _to_hash(v) }
210
+ elsif value.is_a?(Hash)
211
+ {}.tap do |hash|
212
+ value.each { |k, v| hash[k] = _to_hash(v) }
213
+ end
214
+ elsif value.respond_to? :to_hash
215
+ value.to_hash
216
+ else
217
+ value
218
+ end
219
+ end
220
+
221
+ end
222
+
223
+ end
@@ -1,413 +1,413 @@
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 Pdf stamps.
26
- class Stamp
27
- # Gets the stamp type.
28
- attr_accessor :type
29
-
30
- # Sets or gets a bool value that indicates the content is stamped as background. If the value is true, the stamp content is layed at the bottom. By defalt, the value is false, the stamp content is layed at the top.
31
- attr_accessor :background
32
-
33
- # Gets or sets bottom margin of stamp.
34
- attr_accessor :bottom_margin
35
-
36
- # Gets or sets Horizontal alignment of stamp on the page.
37
- attr_accessor :horizontal_alignment
38
-
39
- # Gets or sets left margin of stamp.
40
- attr_accessor :left_margin
41
-
42
- # Gets or sets a value to indicate the stamp opacity. The value is from 0.0 to 1.0. By default the value is 1.0.
43
- attr_accessor :opacity
44
-
45
- # Gets or sets right margin of stamp.
46
- attr_accessor :right_margin
47
-
48
- # Sets or gets the rotation of stamp content according values. Note. This property is for set angles which are multiples of 90 degrees (0, 90, 180, 270 degrees). To set arbitrary angle use RotateAngle property. If angle set by ArbitraryAngle is not multiple of 90 then Rotate property returns Rotation.None.
49
- attr_accessor :rotate
50
-
51
- # Gets or sets rotate angle of stamp in degrees. This property allows to set arbitrary rotate angle.
52
- attr_accessor :rotate_angle
53
-
54
- # Gets or sets top margin of stamp.
55
- attr_accessor :top_margin
56
-
57
- # Gets or sets vertical alignment of stamp on page.
58
- attr_accessor :vertical_alignment
59
-
60
- # Horizontal stamp coordinate, starting from the left.
61
- attr_accessor :x_indent
62
-
63
- # Vertical stamp coordinate, starting from the bottom.
64
- attr_accessor :y_indent
65
-
66
- # Zooming factor of the stamp. Allows to scale stamp.
67
- attr_accessor :zoom
68
-
69
- # Alignment of the text inside the stamp.
70
- attr_accessor :text_alignment
71
-
72
- # Gets or sets string value which is used as stamp on the page.
73
- attr_accessor :value
74
-
75
- # Gets text properties of the stamp. See for details.
76
- attr_accessor :text_state
77
-
78
- # Gets or sets the file name.
79
- attr_accessor :file_name
80
-
81
- # Gets or sets image width. Setting this property allos to scal image horizontally.
82
- attr_accessor :width
83
-
84
- # Gets or sets image height. Setting this image allows to scale image vertically.
85
- attr_accessor :height
86
-
87
- # Gets or sets the index of the page.
88
- attr_accessor :page_index
89
-
90
- # Gets or sets value of the number of starting page. Other pages will be numbered starting from this value.
91
- attr_accessor :starting_number
92
-
93
-
94
- # Attribute mapping from ruby-style variable name to JSON key.
95
- def self.attribute_map
96
- {
97
- :'type' => :'Type',
98
- :'background' => :'Background',
99
- :'bottom_margin' => :'BottomMargin',
100
- :'horizontal_alignment' => :'HorizontalAlignment',
101
- :'left_margin' => :'LeftMargin',
102
- :'opacity' => :'Opacity',
103
- :'right_margin' => :'RightMargin',
104
- :'rotate' => :'Rotate',
105
- :'rotate_angle' => :'RotateAngle',
106
- :'top_margin' => :'TopMargin',
107
- :'vertical_alignment' => :'VerticalAlignment',
108
- :'x_indent' => :'XIndent',
109
- :'y_indent' => :'YIndent',
110
- :'zoom' => :'Zoom',
111
- :'text_alignment' => :'TextAlignment',
112
- :'value' => :'Value',
113
- :'text_state' => :'TextState',
114
- :'file_name' => :'FileName',
115
- :'width' => :'Width',
116
- :'height' => :'Height',
117
- :'page_index' => :'PageIndex',
118
- :'starting_number' => :'StartingNumber'
119
- }
120
- end
121
-
122
- # Attribute type mapping.
123
- def self.swagger_types
124
- {
125
- :'type' => :'StampType',
126
- :'background' => :'BOOLEAN',
127
- :'bottom_margin' => :'Float',
128
- :'horizontal_alignment' => :'HorizontalAlignment',
129
- :'left_margin' => :'Float',
130
- :'opacity' => :'Float',
131
- :'right_margin' => :'Float',
132
- :'rotate' => :'Rotation',
133
- :'rotate_angle' => :'Float',
134
- :'top_margin' => :'Float',
135
- :'vertical_alignment' => :'VerticalAlignment',
136
- :'x_indent' => :'Float',
137
- :'y_indent' => :'Float',
138
- :'zoom' => :'Float',
139
- :'text_alignment' => :'HorizontalAlignment',
140
- :'value' => :'String',
141
- :'text_state' => :'TextState',
142
- :'file_name' => :'String',
143
- :'width' => :'Float',
144
- :'height' => :'Float',
145
- :'page_index' => :'Integer',
146
- :'starting_number' => :'Integer'
147
- }
148
- end
149
-
150
- # Initializes the object
151
- # @param [Hash] attributes Model attributes in the form of hash
152
- def initialize(attributes = {})
153
- return unless attributes.is_a?(Hash)
154
-
155
- # convert string to symbol for hash key
156
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
157
-
158
- if attributes.has_key?(:'Type')
159
- self.type = attributes[:'Type']
160
- end
161
-
162
- if attributes.has_key?(:'Background')
163
- self.background = attributes[:'Background']
164
- end
165
-
166
- if attributes.has_key?(:'BottomMargin')
167
- self.bottom_margin = attributes[:'BottomMargin']
168
- end
169
-
170
- if attributes.has_key?(:'HorizontalAlignment')
171
- self.horizontal_alignment = attributes[:'HorizontalAlignment']
172
- end
173
-
174
- if attributes.has_key?(:'LeftMargin')
175
- self.left_margin = attributes[:'LeftMargin']
176
- end
177
-
178
- if attributes.has_key?(:'Opacity')
179
- self.opacity = attributes[:'Opacity']
180
- end
181
-
182
- if attributes.has_key?(:'RightMargin')
183
- self.right_margin = attributes[:'RightMargin']
184
- end
185
-
186
- if attributes.has_key?(:'Rotate')
187
- self.rotate = attributes[:'Rotate']
188
- end
189
-
190
- if attributes.has_key?(:'RotateAngle')
191
- self.rotate_angle = attributes[:'RotateAngle']
192
- end
193
-
194
- if attributes.has_key?(:'TopMargin')
195
- self.top_margin = attributes[:'TopMargin']
196
- end
197
-
198
- if attributes.has_key?(:'VerticalAlignment')
199
- self.vertical_alignment = attributes[:'VerticalAlignment']
200
- end
201
-
202
- if attributes.has_key?(:'XIndent')
203
- self.x_indent = attributes[:'XIndent']
204
- end
205
-
206
- if attributes.has_key?(:'YIndent')
207
- self.y_indent = attributes[:'YIndent']
208
- end
209
-
210
- if attributes.has_key?(:'Zoom')
211
- self.zoom = attributes[:'Zoom']
212
- end
213
-
214
- if attributes.has_key?(:'TextAlignment')
215
- self.text_alignment = attributes[:'TextAlignment']
216
- end
217
-
218
- if attributes.has_key?(:'Value')
219
- self.value = attributes[:'Value']
220
- end
221
-
222
- if attributes.has_key?(:'TextState')
223
- self.text_state = attributes[:'TextState']
224
- end
225
-
226
- if attributes.has_key?(:'FileName')
227
- self.file_name = attributes[:'FileName']
228
- end
229
-
230
- if attributes.has_key?(:'Width')
231
- self.width = attributes[:'Width']
232
- end
233
-
234
- if attributes.has_key?(:'Height')
235
- self.height = attributes[:'Height']
236
- end
237
-
238
- if attributes.has_key?(:'PageIndex')
239
- self.page_index = attributes[:'PageIndex']
240
- end
241
-
242
- if attributes.has_key?(:'StartingNumber')
243
- self.starting_number = attributes[:'StartingNumber']
244
- end
245
-
246
- end
247
-
248
- # Show invalid properties with the reasons. Usually used together with valid?
249
- # @return Array for valid properies with the reasons
250
- def list_invalid_properties
251
- invalid_properties = Array.new
252
- if @type.nil?
253
- invalid_properties.push("invalid value for 'type', type cannot be nil.")
254
- end
255
-
256
- return invalid_properties
257
- end
258
-
259
- # Check to see if the all the properties in the model are valid
260
- # @return true if the model is valid
261
- def valid?
262
- return false if @type.nil?
263
- return true
264
- end
265
-
266
- # Checks equality by comparing each attribute.
267
- # @param [Object] Object to be compared
268
- def ==(o)
269
- return true if self.equal?(o)
270
- self.class == o.class &&
271
- type == o.type &&
272
- background == o.background &&
273
- bottom_margin == o.bottom_margin &&
274
- horizontal_alignment == o.horizontal_alignment &&
275
- left_margin == o.left_margin &&
276
- opacity == o.opacity &&
277
- right_margin == o.right_margin &&
278
- rotate == o.rotate &&
279
- rotate_angle == o.rotate_angle &&
280
- top_margin == o.top_margin &&
281
- vertical_alignment == o.vertical_alignment &&
282
- x_indent == o.x_indent &&
283
- y_indent == o.y_indent &&
284
- zoom == o.zoom &&
285
- text_alignment == o.text_alignment &&
286
- value == o.value &&
287
- text_state == o.text_state &&
288
- file_name == o.file_name &&
289
- width == o.width &&
290
- height == o.height &&
291
- page_index == o.page_index &&
292
- starting_number == o.starting_number
293
- end
294
-
295
- # @see the `==` method
296
- # @param [Object] Object to be compared
297
- def eql?(o)
298
- self == o
299
- end
300
-
301
- # Calculates hash code according to all attributes.
302
- # @return [Fixnum] Hash code
303
- def hash
304
- [type, background, bottom_margin, horizontal_alignment, left_margin, opacity, right_margin, rotate, rotate_angle, top_margin, vertical_alignment, x_indent, y_indent, zoom, text_alignment, value, text_state, file_name, width, height, page_index, starting_number].hash
305
- end
306
-
307
- # Builds the object from hash
308
- # @param [Hash] attributes Model attributes in the form of hash
309
- # @return [Object] Returns the model itself
310
- def build_from_hash(attributes)
311
- return nil unless attributes.is_a?(Hash)
312
- self.class.swagger_types.each_pair do |key, type|
313
- if type =~ /\AArray<(.*)>/i
314
- # check to ensure the input is an array given that the the attribute
315
- # is documented as an array but the input is not
316
- if attributes[self.class.attribute_map[key]].is_a?(Array)
317
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
318
- end
319
- elsif !attributes[self.class.attribute_map[key]].nil?
320
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
321
- end # or else data not found in attributes(hash), not an issue as the data can be optional
322
- end
323
-
324
- self
325
- end
326
-
327
- # Deserializes the data based on type
328
- # @param string type Data type
329
- # @param string value Value to be deserialized
330
- # @return [Object] Deserialized data
331
- def _deserialize(type, value)
332
- case type.to_sym
333
- when :DateTime
334
- DateTime.parse(value)
335
- when :Date
336
- Date.parse(value)
337
- when :String
338
- value.to_s
339
- when :Integer
340
- value.to_i
341
- when :Float
342
- value.to_f
343
- when :BOOLEAN
344
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
345
- true
346
- else
347
- false
348
- end
349
- when :Object
350
- # generic object (usually a Hash), return directly
351
- value
352
- when /\AArray<(?<inner_type>.+)>\z/
353
- inner_type = Regexp.last_match[:inner_type]
354
- value.map { |v| _deserialize(inner_type, v) }
355
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
356
- k_type = Regexp.last_match[:k_type]
357
- v_type = Regexp.last_match[:v_type]
358
- {}.tap do |hash|
359
- value.each do |k, v|
360
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
361
- end
362
- end
363
- else # model
364
- temp_model = AsposePdfCloud.const_get(type).new
365
- temp_model.build_from_hash(value)
366
- end
367
- end
368
-
369
- # Returns the string representation of the object
370
- # @return [String] String presentation of the object
371
- def to_s
372
- to_hash.to_s
373
- end
374
-
375
- # to_body is an alias to to_hash (backward compatibility)
376
- # @return [Hash] Returns the object in the form of hash
377
- def to_body
378
- to_hash
379
- end
380
-
381
- # Returns the object in the form of hash
382
- # @return [Hash] Returns the object in the form of hash
383
- def to_hash
384
- hash = {}
385
- self.class.attribute_map.each_pair do |attr, param|
386
- value = self.send(attr)
387
- next if value.nil?
388
- hash[param] = _to_hash(value)
389
- end
390
- hash
391
- end
392
-
393
- # Outputs non-array value in the form of hash
394
- # For object, use to_hash. Otherwise, just return the value
395
- # @param [Object] value Any valid value
396
- # @return [Hash] Returns the value in the form of hash
397
- def _to_hash(value)
398
- if value.is_a?(Array)
399
- value.compact.map{ |v| _to_hash(v) }
400
- elsif value.is_a?(Hash)
401
- {}.tap do |hash|
402
- value.each { |k, v| hash[k] = _to_hash(v) }
403
- end
404
- elsif value.respond_to? :to_hash
405
- value.to_hash
406
- else
407
- value
408
- end
409
- end
410
-
411
- end
412
-
413
- 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 Pdf stamps.
26
+ class Stamp
27
+ # Gets the stamp type.
28
+ attr_accessor :type
29
+
30
+ # Sets or gets a bool value that indicates the content is stamped as background. If the value is true, the stamp content is layed at the bottom. By defalt, the value is false, the stamp content is layed at the top.
31
+ attr_accessor :background
32
+
33
+ # Gets or sets bottom margin of stamp.
34
+ attr_accessor :bottom_margin
35
+
36
+ # Gets or sets Horizontal alignment of stamp on the page.
37
+ attr_accessor :horizontal_alignment
38
+
39
+ # Gets or sets left margin of stamp.
40
+ attr_accessor :left_margin
41
+
42
+ # Gets or sets a value to indicate the stamp opacity. The value is from 0.0 to 1.0. By default the value is 1.0.
43
+ attr_accessor :opacity
44
+
45
+ # Gets or sets right margin of stamp.
46
+ attr_accessor :right_margin
47
+
48
+ # Sets or gets the rotation of stamp content according values. Note. This property is for set angles which are multiples of 90 degrees (0, 90, 180, 270 degrees). To set arbitrary angle use RotateAngle property. If angle set by ArbitraryAngle is not multiple of 90 then Rotate property returns Rotation.None.
49
+ attr_accessor :rotate
50
+
51
+ # Gets or sets rotate angle of stamp in degrees. This property allows to set arbitrary rotate angle.
52
+ attr_accessor :rotate_angle
53
+
54
+ # Gets or sets top margin of stamp.
55
+ attr_accessor :top_margin
56
+
57
+ # Gets or sets vertical alignment of stamp on page.
58
+ attr_accessor :vertical_alignment
59
+
60
+ # Horizontal stamp coordinate, starting from the left.
61
+ attr_accessor :x_indent
62
+
63
+ # Vertical stamp coordinate, starting from the bottom.
64
+ attr_accessor :y_indent
65
+
66
+ # Zooming factor of the stamp. Allows to scale stamp.
67
+ attr_accessor :zoom
68
+
69
+ # Alignment of the text inside the stamp.
70
+ attr_accessor :text_alignment
71
+
72
+ # Gets or sets string value which is used as stamp on the page.
73
+ attr_accessor :value
74
+
75
+ # Gets text properties of the stamp. See for details.
76
+ attr_accessor :text_state
77
+
78
+ # Gets or sets the file name.
79
+ attr_accessor :file_name
80
+
81
+ # Gets or sets image width. Setting this property allos to scal image horizontally.
82
+ attr_accessor :width
83
+
84
+ # Gets or sets image height. Setting this image allows to scale image vertically.
85
+ attr_accessor :height
86
+
87
+ # Gets or sets the index of the page.
88
+ attr_accessor :page_index
89
+
90
+ # Gets or sets value of the number of starting page. Other pages will be numbered starting from this value.
91
+ attr_accessor :starting_number
92
+
93
+
94
+ # Attribute mapping from ruby-style variable name to JSON key.
95
+ def self.attribute_map
96
+ {
97
+ :'type' => :'Type',
98
+ :'background' => :'Background',
99
+ :'bottom_margin' => :'BottomMargin',
100
+ :'horizontal_alignment' => :'HorizontalAlignment',
101
+ :'left_margin' => :'LeftMargin',
102
+ :'opacity' => :'Opacity',
103
+ :'right_margin' => :'RightMargin',
104
+ :'rotate' => :'Rotate',
105
+ :'rotate_angle' => :'RotateAngle',
106
+ :'top_margin' => :'TopMargin',
107
+ :'vertical_alignment' => :'VerticalAlignment',
108
+ :'x_indent' => :'XIndent',
109
+ :'y_indent' => :'YIndent',
110
+ :'zoom' => :'Zoom',
111
+ :'text_alignment' => :'TextAlignment',
112
+ :'value' => :'Value',
113
+ :'text_state' => :'TextState',
114
+ :'file_name' => :'FileName',
115
+ :'width' => :'Width',
116
+ :'height' => :'Height',
117
+ :'page_index' => :'PageIndex',
118
+ :'starting_number' => :'StartingNumber'
119
+ }
120
+ end
121
+
122
+ # Attribute type mapping.
123
+ def self.swagger_types
124
+ {
125
+ :'type' => :'StampType',
126
+ :'background' => :'BOOLEAN',
127
+ :'bottom_margin' => :'Float',
128
+ :'horizontal_alignment' => :'HorizontalAlignment',
129
+ :'left_margin' => :'Float',
130
+ :'opacity' => :'Float',
131
+ :'right_margin' => :'Float',
132
+ :'rotate' => :'Rotation',
133
+ :'rotate_angle' => :'Float',
134
+ :'top_margin' => :'Float',
135
+ :'vertical_alignment' => :'VerticalAlignment',
136
+ :'x_indent' => :'Float',
137
+ :'y_indent' => :'Float',
138
+ :'zoom' => :'Float',
139
+ :'text_alignment' => :'HorizontalAlignment',
140
+ :'value' => :'String',
141
+ :'text_state' => :'TextState',
142
+ :'file_name' => :'String',
143
+ :'width' => :'Float',
144
+ :'height' => :'Float',
145
+ :'page_index' => :'Integer',
146
+ :'starting_number' => :'Integer'
147
+ }
148
+ end
149
+
150
+ # Initializes the object
151
+ # @param [Hash] attributes Model attributes in the form of hash
152
+ def initialize(attributes = {})
153
+ return unless attributes.is_a?(Hash)
154
+
155
+ # convert string to symbol for hash key
156
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
157
+
158
+ if attributes.has_key?(:'Type')
159
+ self.type = attributes[:'Type']
160
+ end
161
+
162
+ if attributes.has_key?(:'Background')
163
+ self.background = attributes[:'Background']
164
+ end
165
+
166
+ if attributes.has_key?(:'BottomMargin')
167
+ self.bottom_margin = attributes[:'BottomMargin']
168
+ end
169
+
170
+ if attributes.has_key?(:'HorizontalAlignment')
171
+ self.horizontal_alignment = attributes[:'HorizontalAlignment']
172
+ end
173
+
174
+ if attributes.has_key?(:'LeftMargin')
175
+ self.left_margin = attributes[:'LeftMargin']
176
+ end
177
+
178
+ if attributes.has_key?(:'Opacity')
179
+ self.opacity = attributes[:'Opacity']
180
+ end
181
+
182
+ if attributes.has_key?(:'RightMargin')
183
+ self.right_margin = attributes[:'RightMargin']
184
+ end
185
+
186
+ if attributes.has_key?(:'Rotate')
187
+ self.rotate = attributes[:'Rotate']
188
+ end
189
+
190
+ if attributes.has_key?(:'RotateAngle')
191
+ self.rotate_angle = attributes[:'RotateAngle']
192
+ end
193
+
194
+ if attributes.has_key?(:'TopMargin')
195
+ self.top_margin = attributes[:'TopMargin']
196
+ end
197
+
198
+ if attributes.has_key?(:'VerticalAlignment')
199
+ self.vertical_alignment = attributes[:'VerticalAlignment']
200
+ end
201
+
202
+ if attributes.has_key?(:'XIndent')
203
+ self.x_indent = attributes[:'XIndent']
204
+ end
205
+
206
+ if attributes.has_key?(:'YIndent')
207
+ self.y_indent = attributes[:'YIndent']
208
+ end
209
+
210
+ if attributes.has_key?(:'Zoom')
211
+ self.zoom = attributes[:'Zoom']
212
+ end
213
+
214
+ if attributes.has_key?(:'TextAlignment')
215
+ self.text_alignment = attributes[:'TextAlignment']
216
+ end
217
+
218
+ if attributes.has_key?(:'Value')
219
+ self.value = attributes[:'Value']
220
+ end
221
+
222
+ if attributes.has_key?(:'TextState')
223
+ self.text_state = attributes[:'TextState']
224
+ end
225
+
226
+ if attributes.has_key?(:'FileName')
227
+ self.file_name = attributes[:'FileName']
228
+ end
229
+
230
+ if attributes.has_key?(:'Width')
231
+ self.width = attributes[:'Width']
232
+ end
233
+
234
+ if attributes.has_key?(:'Height')
235
+ self.height = attributes[:'Height']
236
+ end
237
+
238
+ if attributes.has_key?(:'PageIndex')
239
+ self.page_index = attributes[:'PageIndex']
240
+ end
241
+
242
+ if attributes.has_key?(:'StartingNumber')
243
+ self.starting_number = attributes[:'StartingNumber']
244
+ end
245
+
246
+ end
247
+
248
+ # Show invalid properties with the reasons. Usually used together with valid?
249
+ # @return Array for valid properies with the reasons
250
+ def list_invalid_properties
251
+ invalid_properties = Array.new
252
+ if @type.nil?
253
+ invalid_properties.push("invalid value for 'type', type cannot be nil.")
254
+ end
255
+
256
+ return invalid_properties
257
+ end
258
+
259
+ # Check to see if the all the properties in the model are valid
260
+ # @return true if the model is valid
261
+ def valid?
262
+ return false if @type.nil?
263
+ return true
264
+ end
265
+
266
+ # Checks equality by comparing each attribute.
267
+ # @param [Object] Object to be compared
268
+ def ==(o)
269
+ return true if self.equal?(o)
270
+ self.class == o.class &&
271
+ type == o.type &&
272
+ background == o.background &&
273
+ bottom_margin == o.bottom_margin &&
274
+ horizontal_alignment == o.horizontal_alignment &&
275
+ left_margin == o.left_margin &&
276
+ opacity == o.opacity &&
277
+ right_margin == o.right_margin &&
278
+ rotate == o.rotate &&
279
+ rotate_angle == o.rotate_angle &&
280
+ top_margin == o.top_margin &&
281
+ vertical_alignment == o.vertical_alignment &&
282
+ x_indent == o.x_indent &&
283
+ y_indent == o.y_indent &&
284
+ zoom == o.zoom &&
285
+ text_alignment == o.text_alignment &&
286
+ value == o.value &&
287
+ text_state == o.text_state &&
288
+ file_name == o.file_name &&
289
+ width == o.width &&
290
+ height == o.height &&
291
+ page_index == o.page_index &&
292
+ starting_number == o.starting_number
293
+ end
294
+
295
+ # @see the `==` method
296
+ # @param [Object] Object to be compared
297
+ def eql?(o)
298
+ self == o
299
+ end
300
+
301
+ # Calculates hash code according to all attributes.
302
+ # @return [Fixnum] Hash code
303
+ def hash
304
+ [type, background, bottom_margin, horizontal_alignment, left_margin, opacity, right_margin, rotate, rotate_angle, top_margin, vertical_alignment, x_indent, y_indent, zoom, text_alignment, value, text_state, file_name, width, height, page_index, starting_number].hash
305
+ end
306
+
307
+ # Builds the object from hash
308
+ # @param [Hash] attributes Model attributes in the form of hash
309
+ # @return [Object] Returns the model itself
310
+ def build_from_hash(attributes)
311
+ return nil unless attributes.is_a?(Hash)
312
+ self.class.swagger_types.each_pair do |key, type|
313
+ if type =~ /\AArray<(.*)>/i
314
+ # check to ensure the input is an array given that the the attribute
315
+ # is documented as an array but the input is not
316
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
317
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
318
+ end
319
+ elsif !attributes[self.class.attribute_map[key]].nil?
320
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
321
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
322
+ end
323
+
324
+ self
325
+ end
326
+
327
+ # Deserializes the data based on type
328
+ # @param string type Data type
329
+ # @param string value Value to be deserialized
330
+ # @return [Object] Deserialized data
331
+ def _deserialize(type, value)
332
+ case type.to_sym
333
+ when :DateTime
334
+ DateTime.parse(value)
335
+ when :Date
336
+ Date.parse(value)
337
+ when :String
338
+ value.to_s
339
+ when :Integer
340
+ value.to_i
341
+ when :Float
342
+ value.to_f
343
+ when :BOOLEAN
344
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
345
+ true
346
+ else
347
+ false
348
+ end
349
+ when :Object
350
+ # generic object (usually a Hash), return directly
351
+ value
352
+ when /\AArray<(?<inner_type>.+)>\z/
353
+ inner_type = Regexp.last_match[:inner_type]
354
+ value.map { |v| _deserialize(inner_type, v) }
355
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
356
+ k_type = Regexp.last_match[:k_type]
357
+ v_type = Regexp.last_match[:v_type]
358
+ {}.tap do |hash|
359
+ value.each do |k, v|
360
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
361
+ end
362
+ end
363
+ else # model
364
+ temp_model = AsposePdfCloud.const_get(type).new
365
+ temp_model.build_from_hash(value)
366
+ end
367
+ end
368
+
369
+ # Returns the string representation of the object
370
+ # @return [String] String presentation of the object
371
+ def to_s
372
+ to_hash.to_s
373
+ end
374
+
375
+ # to_body is an alias to to_hash (backward compatibility)
376
+ # @return [Hash] Returns the object in the form of hash
377
+ def to_body
378
+ to_hash
379
+ end
380
+
381
+ # Returns the object in the form of hash
382
+ # @return [Hash] Returns the object in the form of hash
383
+ def to_hash
384
+ hash = {}
385
+ self.class.attribute_map.each_pair do |attr, param|
386
+ value = self.send(attr)
387
+ next if value.nil?
388
+ hash[param] = _to_hash(value)
389
+ end
390
+ hash
391
+ end
392
+
393
+ # Outputs non-array value in the form of hash
394
+ # For object, use to_hash. Otherwise, just return the value
395
+ # @param [Object] value Any valid value
396
+ # @return [Hash] Returns the value in the form of hash
397
+ def _to_hash(value)
398
+ if value.is_a?(Array)
399
+ value.compact.map{ |v| _to_hash(v) }
400
+ elsif value.is_a?(Hash)
401
+ {}.tap do |hash|
402
+ value.each { |k, v| hash[k] = _to_hash(v) }
403
+ end
404
+ elsif value.respond_to? :to_hash
405
+ value.to_hash
406
+ else
407
+ value
408
+ end
409
+ end
410
+
411
+ end
412
+
413
+ end