aspose_pdf_cloud 1.0.2 → 18.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +42 -0
- data/.swagger-codegen-ignore +58 -0
- data/.swagger-codegen/VERSION +1 -0
- data/LICENSE +21 -22
- data/README.md +51 -43
- data/aspose_pdf_cloud.gemspec +32 -8
- data/lib/aspose_pdf_cloud.rb +93 -58
- data/lib/aspose_pdf_cloud/api/pdf_api.rb +2624 -1916
- data/lib/aspose_pdf_cloud/api_client.rb +280 -92
- data/lib/aspose_pdf_cloud/api_error.rb +29 -6
- data/lib/aspose_pdf_cloud/configuration.rb +86 -63
- data/lib/aspose_pdf_cloud/models/annotation.rb +218 -45
- data/lib/aspose_pdf_cloud/models/annotation_response.rb +195 -34
- data/lib/aspose_pdf_cloud/models/annotations.rb +187 -25
- data/lib/aspose_pdf_cloud/models/annotations_response.rb +195 -34
- data/lib/aspose_pdf_cloud/models/append_document.rb +198 -23
- data/lib/aspose_pdf_cloud/models/attachment.rb +224 -49
- data/lib/aspose_pdf_cloud/models/attachment_response.rb +195 -34
- data/lib/aspose_pdf_cloud/models/attachments.rb +187 -25
- data/lib/aspose_pdf_cloud/models/attachments_response.rb +195 -34
- data/lib/aspose_pdf_cloud/models/bookmarks.rb +187 -25
- data/lib/aspose_pdf_cloud/models/bookmarks_response.rb +195 -34
- data/lib/aspose_pdf_cloud/models/color.rb +214 -31
- data/lib/aspose_pdf_cloud/models/document.rb +194 -29
- data/lib/aspose_pdf_cloud/models/document_pages_response.rb +195 -34
- data/lib/aspose_pdf_cloud/models/document_properties.rb +187 -25
- data/lib/aspose_pdf_cloud/models/document_properties_response.rb +195 -34
- data/lib/aspose_pdf_cloud/models/document_property.rb +197 -33
- data/lib/aspose_pdf_cloud/models/document_property_response.rb +195 -34
- data/lib/aspose_pdf_cloud/models/document_response.rb +206 -34
- data/lib/aspose_pdf_cloud/models/document_text_replace_response.rb +203 -41
- data/lib/aspose_pdf_cloud/models/field.rb +213 -42
- data/lib/aspose_pdf_cloud/models/field_response.rb +195 -34
- data/lib/aspose_pdf_cloud/models/field_type.rb +44 -0
- data/lib/aspose_pdf_cloud/models/fields.rb +187 -25
- data/lib/aspose_pdf_cloud/models/fields_response.rb +195 -34
- data/lib/aspose_pdf_cloud/models/font_styles.rb +43 -0
- data/lib/aspose_pdf_cloud/models/horizontal_alignment.rb +44 -0
- data/lib/aspose_pdf_cloud/models/http_status_code.rb +87 -0
- data/lib/aspose_pdf_cloud/models/image.rb +194 -29
- data/lib/aspose_pdf_cloud/models/image_response.rb +195 -34
- data/lib/aspose_pdf_cloud/models/images.rb +187 -25
- data/lib/aspose_pdf_cloud/models/images_list_request.rb +205 -0
- data/lib/aspose_pdf_cloud/models/images_response.rb +195 -34
- data/lib/aspose_pdf_cloud/models/line_spacing.rb +43 -0
- data/lib/aspose_pdf_cloud/models/link.rb +194 -27
- data/lib/aspose_pdf_cloud/models/link_action_type.rb +46 -0
- data/lib/aspose_pdf_cloud/models/link_annotation.rb +204 -39
- data/lib/aspose_pdf_cloud/models/link_annotation_response.rb +195 -34
- data/lib/aspose_pdf_cloud/models/link_annotations.rb +187 -25
- data/lib/aspose_pdf_cloud/models/link_annotations_response.rb +195 -34
- data/lib/aspose_pdf_cloud/models/link_element.rb +175 -14
- data/lib/aspose_pdf_cloud/models/link_highlighting_mode.rb +45 -0
- data/lib/aspose_pdf_cloud/models/merge_documents.rb +175 -14
- data/lib/aspose_pdf_cloud/models/optimize_options.rb +293 -0
- data/lib/aspose_pdf_cloud/models/page.rb +198 -33
- data/lib/aspose_pdf_cloud/models/page_text_replace_response.rb +203 -41
- data/lib/aspose_pdf_cloud/models/page_word_count.rb +192 -19
- data/lib/aspose_pdf_cloud/models/pages.rb +187 -25
- data/lib/aspose_pdf_cloud/models/paragraph.rb +303 -0
- data/lib/aspose_pdf_cloud/models/rectangle.rb +210 -27
- data/lib/aspose_pdf_cloud/models/rotation.rb +44 -0
- data/lib/aspose_pdf_cloud/models/saa_spose_response.rb +213 -0
- data/lib/aspose_pdf_cloud/models/segment.rb +206 -0
- data/lib/aspose_pdf_cloud/models/signature.rb +278 -54
- data/lib/aspose_pdf_cloud/models/signature_type.rb +42 -0
- data/lib/aspose_pdf_cloud/models/split_result.rb +175 -14
- data/lib/aspose_pdf_cloud/models/split_result_document.rb +206 -37
- data/lib/aspose_pdf_cloud/models/split_result_response.rb +196 -34
- data/lib/aspose_pdf_cloud/models/stamp.rb +312 -104
- data/lib/aspose_pdf_cloud/models/stamp_type.rb +44 -0
- data/lib/aspose_pdf_cloud/models/text_format.rb +197 -33
- data/lib/aspose_pdf_cloud/models/text_format_response.rb +195 -34
- data/lib/aspose_pdf_cloud/models/text_horizontal_alignment.rb +47 -0
- data/lib/aspose_pdf_cloud/models/text_item.rb +192 -29
- data/lib/aspose_pdf_cloud/models/text_item_response.rb +195 -34
- data/lib/aspose_pdf_cloud/models/text_items.rb +187 -25
- data/lib/aspose_pdf_cloud/models/text_items_response.rb +195 -34
- data/lib/aspose_pdf_cloud/models/text_line.rb +210 -0
- data/lib/aspose_pdf_cloud/models/text_rect.rb +220 -0
- data/lib/aspose_pdf_cloud/models/text_rects.rb +199 -0
- data/lib/aspose_pdf_cloud/models/text_rects_response.rb +222 -0
- data/lib/aspose_pdf_cloud/models/text_replace.rb +225 -25
- data/lib/aspose_pdf_cloud/models/text_replace_list_request.rb +209 -16
- data/lib/aspose_pdf_cloud/models/text_replace_request.rb +262 -0
- data/lib/aspose_pdf_cloud/models/text_replace_response.rb +222 -0
- data/lib/aspose_pdf_cloud/models/text_state.rb +211 -32
- data/lib/aspose_pdf_cloud/models/tiff_export_options.rb +266 -75
- data/lib/aspose_pdf_cloud/models/vertical_alignment.rb +45 -0
- data/lib/aspose_pdf_cloud/models/word_count.rb +174 -14
- data/lib/aspose_pdf_cloud/models/word_count_response.rb +196 -34
- data/lib/aspose_pdf_cloud/models/wrap_mode.rb +44 -0
- data/lib/aspose_pdf_cloud/version.rb +23 -2
- data/test/pdf_tests.rb +1268 -623
- data/test_data/33539.jpg +0 -0
- data/test_data/44781.jpg +0 -0
- data/test_data/4pages.pdf +0 -0
- data/test_data/BlankWithSignature.pdf +0 -0
- data/test_data/Hello_world.pdf +0 -0
- data/test_data/HtmlExample1.html +27 -0
- data/test_data/Koala.jpg +0 -0
- data/test_data/PdfWithAcroForm.pdf +321 -0
- data/test_data/PdfWithAnnotations.pdf +720 -1
- data/test_data/PdfWithBookmarks.pdf +0 -0
- data/test_data/PdfWithEmbeddedFiles.pdf +0 -0
- data/test_data/PdfWithImages2.pdf +0 -0
- data/test_data/PdfWithLinks.pdf +0 -0
- data/test_data/Penguins.jpg +0 -0
- data/test_data/butterfly.jpg +0 -0
- data/test_data/marketing.pdf +0 -0
- data/test_data/rusdoc.pdf +0 -0
- data/test_data/test1234.pfx +0 -0
- metadata +54 -13
- data/lib/aspose_pdf_cloud/models/barcode_response_list.rb +0 -45
- data/lib/aspose_pdf_cloud/models/base_object.rb +0 -86
- data/lib/aspose_pdf_cloud/models/base_response.rb +0 -61
- data/lib/aspose_pdf_cloud/models/page_response.rb +0 -61
@@ -0,0 +1,210 @@
|
|
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
|
+
# A line of text to be inserted into .
|
26
|
+
class TextLine
|
27
|
+
# Line's horizontal alignment
|
28
|
+
attr_accessor :horizontal_alignment
|
29
|
+
|
30
|
+
# Segments that form the line. Every segment has its own formatting.
|
31
|
+
attr_accessor :segments
|
32
|
+
|
33
|
+
|
34
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
35
|
+
def self.attribute_map
|
36
|
+
{
|
37
|
+
:'horizontal_alignment' => :'HorizontalAlignment',
|
38
|
+
:'segments' => :'Segments'
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
# Attribute type mapping.
|
43
|
+
def self.swagger_types
|
44
|
+
{
|
45
|
+
:'horizontal_alignment' => :'TextHorizontalAlignment',
|
46
|
+
:'segments' => :'Array<Segment>'
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
# Initializes the object
|
51
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
52
|
+
def initialize(attributes = {})
|
53
|
+
return unless attributes.is_a?(Hash)
|
54
|
+
|
55
|
+
# convert string to symbol for hash key
|
56
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
57
|
+
|
58
|
+
if attributes.has_key?(:'HorizontalAlignment')
|
59
|
+
self.horizontal_alignment = attributes[:'HorizontalAlignment']
|
60
|
+
end
|
61
|
+
|
62
|
+
if attributes.has_key?(:'Segments')
|
63
|
+
if (value = attributes[:'Segments']).is_a?(Array)
|
64
|
+
self.segments = value
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
71
|
+
# @return Array for valid properies with the reasons
|
72
|
+
def list_invalid_properties
|
73
|
+
invalid_properties = Array.new
|
74
|
+
return invalid_properties
|
75
|
+
end
|
76
|
+
|
77
|
+
# Check to see if the all the properties in the model are valid
|
78
|
+
# @return true if the model is valid
|
79
|
+
def valid?
|
80
|
+
return true
|
81
|
+
end
|
82
|
+
|
83
|
+
# Checks equality by comparing each attribute.
|
84
|
+
# @param [Object] Object to be compared
|
85
|
+
def ==(o)
|
86
|
+
return true if self.equal?(o)
|
87
|
+
self.class == o.class &&
|
88
|
+
horizontal_alignment == o.horizontal_alignment &&
|
89
|
+
segments == o.segments
|
90
|
+
end
|
91
|
+
|
92
|
+
# @see the `==` method
|
93
|
+
# @param [Object] Object to be compared
|
94
|
+
def eql?(o)
|
95
|
+
self == o
|
96
|
+
end
|
97
|
+
|
98
|
+
# Calculates hash code according to all attributes.
|
99
|
+
# @return [Fixnum] Hash code
|
100
|
+
def hash
|
101
|
+
[horizontal_alignment, segments].hash
|
102
|
+
end
|
103
|
+
|
104
|
+
# Builds the object from hash
|
105
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
106
|
+
# @return [Object] Returns the model itself
|
107
|
+
def build_from_hash(attributes)
|
108
|
+
return nil unless attributes.is_a?(Hash)
|
109
|
+
self.class.swagger_types.each_pair do |key, type|
|
110
|
+
if type =~ /\AArray<(.*)>/i
|
111
|
+
# check to ensure the input is an array given that the the attribute
|
112
|
+
# is documented as an array but the input is not
|
113
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
114
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
115
|
+
end
|
116
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
117
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
118
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
119
|
+
end
|
120
|
+
|
121
|
+
self
|
122
|
+
end
|
123
|
+
|
124
|
+
# Deserializes the data based on type
|
125
|
+
# @param string type Data type
|
126
|
+
# @param string value Value to be deserialized
|
127
|
+
# @return [Object] Deserialized data
|
128
|
+
def _deserialize(type, value)
|
129
|
+
case type.to_sym
|
130
|
+
when :DateTime
|
131
|
+
DateTime.parse(value)
|
132
|
+
when :Date
|
133
|
+
Date.parse(value)
|
134
|
+
when :String
|
135
|
+
value.to_s
|
136
|
+
when :Integer
|
137
|
+
value.to_i
|
138
|
+
when :Float
|
139
|
+
value.to_f
|
140
|
+
when :BOOLEAN
|
141
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
142
|
+
true
|
143
|
+
else
|
144
|
+
false
|
145
|
+
end
|
146
|
+
when :Object
|
147
|
+
# generic object (usually a Hash), return directly
|
148
|
+
value
|
149
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
150
|
+
inner_type = Regexp.last_match[:inner_type]
|
151
|
+
value.map { |v| _deserialize(inner_type, v) }
|
152
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
153
|
+
k_type = Regexp.last_match[:k_type]
|
154
|
+
v_type = Regexp.last_match[:v_type]
|
155
|
+
{}.tap do |hash|
|
156
|
+
value.each do |k, v|
|
157
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
else # model
|
161
|
+
temp_model = AsposePdfCloud.const_get(type).new
|
162
|
+
temp_model.build_from_hash(value)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
# Returns the string representation of the object
|
167
|
+
# @return [String] String presentation of the object
|
168
|
+
def to_s
|
169
|
+
to_hash.to_s
|
170
|
+
end
|
171
|
+
|
172
|
+
# to_body is an alias to to_hash (backward compatibility)
|
173
|
+
# @return [Hash] Returns the object in the form of hash
|
174
|
+
def to_body
|
175
|
+
to_hash
|
176
|
+
end
|
177
|
+
|
178
|
+
# Returns the object in the form of hash
|
179
|
+
# @return [Hash] Returns the object in the form of hash
|
180
|
+
def to_hash
|
181
|
+
hash = {}
|
182
|
+
self.class.attribute_map.each_pair do |attr, param|
|
183
|
+
value = self.send(attr)
|
184
|
+
next if value.nil?
|
185
|
+
hash[param] = _to_hash(value)
|
186
|
+
end
|
187
|
+
hash
|
188
|
+
end
|
189
|
+
|
190
|
+
# Outputs non-array value in the form of hash
|
191
|
+
# For object, use to_hash. Otherwise, just return the value
|
192
|
+
# @param [Object] value Any valid value
|
193
|
+
# @return [Hash] Returns the value in the form of hash
|
194
|
+
def _to_hash(value)
|
195
|
+
if value.is_a?(Array)
|
196
|
+
value.compact.map{ |v| _to_hash(v) }
|
197
|
+
elsif value.is_a?(Hash)
|
198
|
+
{}.tap do |hash|
|
199
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
200
|
+
end
|
201
|
+
elsif value.respond_to? :to_hash
|
202
|
+
value.to_hash
|
203
|
+
else
|
204
|
+
value
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
end
|
209
|
+
|
210
|
+
end
|
@@ -0,0 +1,220 @@
|
|
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 text DTO.
|
26
|
+
class TextRect
|
27
|
+
attr_accessor :text
|
28
|
+
|
29
|
+
attr_accessor :page
|
30
|
+
|
31
|
+
attr_accessor :rect
|
32
|
+
|
33
|
+
|
34
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
35
|
+
def self.attribute_map
|
36
|
+
{
|
37
|
+
:'text' => :'Text',
|
38
|
+
:'page' => :'Page',
|
39
|
+
:'rect' => :'Rect'
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
# Attribute type mapping.
|
44
|
+
def self.swagger_types
|
45
|
+
{
|
46
|
+
:'text' => :'String',
|
47
|
+
:'page' => :'Integer',
|
48
|
+
:'rect' => :'Rectangle'
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
# Initializes the object
|
53
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
54
|
+
def initialize(attributes = {})
|
55
|
+
return unless attributes.is_a?(Hash)
|
56
|
+
|
57
|
+
# convert string to symbol for hash key
|
58
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
59
|
+
|
60
|
+
if attributes.has_key?(:'Text')
|
61
|
+
self.text = attributes[:'Text']
|
62
|
+
end
|
63
|
+
|
64
|
+
if attributes.has_key?(:'Page')
|
65
|
+
self.page = attributes[:'Page']
|
66
|
+
end
|
67
|
+
|
68
|
+
if attributes.has_key?(:'Rect')
|
69
|
+
self.rect = attributes[:'Rect']
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
75
|
+
# @return Array for valid properies with the reasons
|
76
|
+
def list_invalid_properties
|
77
|
+
invalid_properties = Array.new
|
78
|
+
if @page.nil?
|
79
|
+
invalid_properties.push("invalid value for 'page', page cannot be nil.")
|
80
|
+
end
|
81
|
+
|
82
|
+
return invalid_properties
|
83
|
+
end
|
84
|
+
|
85
|
+
# Check to see if the all the properties in the model are valid
|
86
|
+
# @return true if the model is valid
|
87
|
+
def valid?
|
88
|
+
return false if @page.nil?
|
89
|
+
return true
|
90
|
+
end
|
91
|
+
|
92
|
+
# Checks equality by comparing each attribute.
|
93
|
+
# @param [Object] Object to be compared
|
94
|
+
def ==(o)
|
95
|
+
return true if self.equal?(o)
|
96
|
+
self.class == o.class &&
|
97
|
+
text == o.text &&
|
98
|
+
page == o.page &&
|
99
|
+
rect == o.rect
|
100
|
+
end
|
101
|
+
|
102
|
+
# @see the `==` method
|
103
|
+
# @param [Object] Object to be compared
|
104
|
+
def eql?(o)
|
105
|
+
self == o
|
106
|
+
end
|
107
|
+
|
108
|
+
# Calculates hash code according to all attributes.
|
109
|
+
# @return [Fixnum] Hash code
|
110
|
+
def hash
|
111
|
+
[text, page, rect].hash
|
112
|
+
end
|
113
|
+
|
114
|
+
# Builds the object from hash
|
115
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
116
|
+
# @return [Object] Returns the model itself
|
117
|
+
def build_from_hash(attributes)
|
118
|
+
return nil unless attributes.is_a?(Hash)
|
119
|
+
self.class.swagger_types.each_pair do |key, type|
|
120
|
+
if type =~ /\AArray<(.*)>/i
|
121
|
+
# check to ensure the input is an array given that the the attribute
|
122
|
+
# is documented as an array but the input is not
|
123
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
124
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
125
|
+
end
|
126
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
127
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
128
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
129
|
+
end
|
130
|
+
|
131
|
+
self
|
132
|
+
end
|
133
|
+
|
134
|
+
# Deserializes the data based on type
|
135
|
+
# @param string type Data type
|
136
|
+
# @param string value Value to be deserialized
|
137
|
+
# @return [Object] Deserialized data
|
138
|
+
def _deserialize(type, value)
|
139
|
+
case type.to_sym
|
140
|
+
when :DateTime
|
141
|
+
DateTime.parse(value)
|
142
|
+
when :Date
|
143
|
+
Date.parse(value)
|
144
|
+
when :String
|
145
|
+
value.to_s
|
146
|
+
when :Integer
|
147
|
+
value.to_i
|
148
|
+
when :Float
|
149
|
+
value.to_f
|
150
|
+
when :BOOLEAN
|
151
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
152
|
+
true
|
153
|
+
else
|
154
|
+
false
|
155
|
+
end
|
156
|
+
when :Object
|
157
|
+
# generic object (usually a Hash), return directly
|
158
|
+
value
|
159
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
160
|
+
inner_type = Regexp.last_match[:inner_type]
|
161
|
+
value.map { |v| _deserialize(inner_type, v) }
|
162
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
163
|
+
k_type = Regexp.last_match[:k_type]
|
164
|
+
v_type = Regexp.last_match[:v_type]
|
165
|
+
{}.tap do |hash|
|
166
|
+
value.each do |k, v|
|
167
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
168
|
+
end
|
169
|
+
end
|
170
|
+
else # model
|
171
|
+
temp_model = AsposePdfCloud.const_get(type).new
|
172
|
+
temp_model.build_from_hash(value)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
# Returns the string representation of the object
|
177
|
+
# @return [String] String presentation of the object
|
178
|
+
def to_s
|
179
|
+
to_hash.to_s
|
180
|
+
end
|
181
|
+
|
182
|
+
# to_body is an alias to to_hash (backward compatibility)
|
183
|
+
# @return [Hash] Returns the object in the form of hash
|
184
|
+
def to_body
|
185
|
+
to_hash
|
186
|
+
end
|
187
|
+
|
188
|
+
# Returns the object in the form of hash
|
189
|
+
# @return [Hash] Returns the object in the form of hash
|
190
|
+
def to_hash
|
191
|
+
hash = {}
|
192
|
+
self.class.attribute_map.each_pair do |attr, param|
|
193
|
+
value = self.send(attr)
|
194
|
+
next if value.nil?
|
195
|
+
hash[param] = _to_hash(value)
|
196
|
+
end
|
197
|
+
hash
|
198
|
+
end
|
199
|
+
|
200
|
+
# Outputs non-array value in the form of hash
|
201
|
+
# For object, use to_hash. Otherwise, just return the value
|
202
|
+
# @param [Object] value Any valid value
|
203
|
+
# @return [Hash] Returns the value in the form of hash
|
204
|
+
def _to_hash(value)
|
205
|
+
if value.is_a?(Array)
|
206
|
+
value.compact.map{ |v| _to_hash(v) }
|
207
|
+
elsif value.is_a?(Hash)
|
208
|
+
{}.tap do |hash|
|
209
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
210
|
+
end
|
211
|
+
elsif value.respond_to? :to_hash
|
212
|
+
value.to_hash
|
213
|
+
else
|
214
|
+
value
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
end
|
219
|
+
|
220
|
+
end
|
@@ -0,0 +1,199 @@
|
|
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 text items DTO.
|
26
|
+
class TextRects
|
27
|
+
attr_accessor :list
|
28
|
+
|
29
|
+
|
30
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
31
|
+
def self.attribute_map
|
32
|
+
{
|
33
|
+
:'list' => :'List'
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
# Attribute type mapping.
|
38
|
+
def self.swagger_types
|
39
|
+
{
|
40
|
+
:'list' => :'Array<TextRect>'
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
# Initializes the object
|
45
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
46
|
+
def initialize(attributes = {})
|
47
|
+
return unless attributes.is_a?(Hash)
|
48
|
+
|
49
|
+
# convert string to symbol for hash key
|
50
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
51
|
+
|
52
|
+
if attributes.has_key?(:'List')
|
53
|
+
if (value = attributes[:'List']).is_a?(Array)
|
54
|
+
self.list = value
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
61
|
+
# @return Array for valid properies with the reasons
|
62
|
+
def list_invalid_properties
|
63
|
+
invalid_properties = Array.new
|
64
|
+
return invalid_properties
|
65
|
+
end
|
66
|
+
|
67
|
+
# Check to see if the all the properties in the model are valid
|
68
|
+
# @return true if the model is valid
|
69
|
+
def valid?
|
70
|
+
return true
|
71
|
+
end
|
72
|
+
|
73
|
+
# Checks equality by comparing each attribute.
|
74
|
+
# @param [Object] Object to be compared
|
75
|
+
def ==(o)
|
76
|
+
return true if self.equal?(o)
|
77
|
+
self.class == o.class &&
|
78
|
+
list == o.list
|
79
|
+
end
|
80
|
+
|
81
|
+
# @see the `==` method
|
82
|
+
# @param [Object] Object to be compared
|
83
|
+
def eql?(o)
|
84
|
+
self == o
|
85
|
+
end
|
86
|
+
|
87
|
+
# Calculates hash code according to all attributes.
|
88
|
+
# @return [Fixnum] Hash code
|
89
|
+
def hash
|
90
|
+
[list].hash
|
91
|
+
end
|
92
|
+
|
93
|
+
# Builds the object from hash
|
94
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
95
|
+
# @return [Object] Returns the model itself
|
96
|
+
def build_from_hash(attributes)
|
97
|
+
return nil unless attributes.is_a?(Hash)
|
98
|
+
self.class.swagger_types.each_pair do |key, type|
|
99
|
+
if type =~ /\AArray<(.*)>/i
|
100
|
+
# check to ensure the input is an array given that the the attribute
|
101
|
+
# is documented as an array but the input is not
|
102
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
103
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
104
|
+
end
|
105
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
106
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
107
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
108
|
+
end
|
109
|
+
|
110
|
+
self
|
111
|
+
end
|
112
|
+
|
113
|
+
# Deserializes the data based on type
|
114
|
+
# @param string type Data type
|
115
|
+
# @param string value Value to be deserialized
|
116
|
+
# @return [Object] Deserialized data
|
117
|
+
def _deserialize(type, value)
|
118
|
+
case type.to_sym
|
119
|
+
when :DateTime
|
120
|
+
DateTime.parse(value)
|
121
|
+
when :Date
|
122
|
+
Date.parse(value)
|
123
|
+
when :String
|
124
|
+
value.to_s
|
125
|
+
when :Integer
|
126
|
+
value.to_i
|
127
|
+
when :Float
|
128
|
+
value.to_f
|
129
|
+
when :BOOLEAN
|
130
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
131
|
+
true
|
132
|
+
else
|
133
|
+
false
|
134
|
+
end
|
135
|
+
when :Object
|
136
|
+
# generic object (usually a Hash), return directly
|
137
|
+
value
|
138
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
139
|
+
inner_type = Regexp.last_match[:inner_type]
|
140
|
+
value.map { |v| _deserialize(inner_type, v) }
|
141
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
142
|
+
k_type = Regexp.last_match[:k_type]
|
143
|
+
v_type = Regexp.last_match[:v_type]
|
144
|
+
{}.tap do |hash|
|
145
|
+
value.each do |k, v|
|
146
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
else # model
|
150
|
+
temp_model = AsposePdfCloud.const_get(type).new
|
151
|
+
temp_model.build_from_hash(value)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
# Returns the string representation of the object
|
156
|
+
# @return [String] String presentation of the object
|
157
|
+
def to_s
|
158
|
+
to_hash.to_s
|
159
|
+
end
|
160
|
+
|
161
|
+
# to_body is an alias to to_hash (backward compatibility)
|
162
|
+
# @return [Hash] Returns the object in the form of hash
|
163
|
+
def to_body
|
164
|
+
to_hash
|
165
|
+
end
|
166
|
+
|
167
|
+
# Returns the object in the form of hash
|
168
|
+
# @return [Hash] Returns the object in the form of hash
|
169
|
+
def to_hash
|
170
|
+
hash = {}
|
171
|
+
self.class.attribute_map.each_pair do |attr, param|
|
172
|
+
value = self.send(attr)
|
173
|
+
next if value.nil?
|
174
|
+
hash[param] = _to_hash(value)
|
175
|
+
end
|
176
|
+
hash
|
177
|
+
end
|
178
|
+
|
179
|
+
# Outputs non-array value in the form of hash
|
180
|
+
# For object, use to_hash. Otherwise, just return the value
|
181
|
+
# @param [Object] value Any valid value
|
182
|
+
# @return [Hash] Returns the value in the form of hash
|
183
|
+
def _to_hash(value)
|
184
|
+
if value.is_a?(Array)
|
185
|
+
value.compact.map{ |v| _to_hash(v) }
|
186
|
+
elsif value.is_a?(Hash)
|
187
|
+
{}.tap do |hash|
|
188
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
189
|
+
end
|
190
|
+
elsif value.respond_to? :to_hash
|
191
|
+
value.to_hash
|
192
|
+
else
|
193
|
+
value
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
end
|
198
|
+
|
199
|
+
end
|