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
@@ -1,69 +1,231 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
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 DocumentTextReplaceResponse
|
27
|
+
# Response status code.
|
28
|
+
attr_accessor :code
|
29
|
+
|
30
|
+
# Response status.
|
31
|
+
attr_accessor :status
|
32
|
+
|
33
|
+
attr_accessor :matches
|
34
|
+
|
35
|
+
attr_accessor :document
|
36
|
+
|
37
|
+
|
38
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
6
39
|
def self.attribute_map
|
7
40
|
{
|
8
|
-
|
9
|
-
#
|
10
|
-
:'document' => :'Document',
|
11
|
-
|
12
|
-
#
|
13
|
-
:'matches' => :'Matches',
|
14
|
-
|
15
|
-
#
|
41
|
+
:'code' => :'Code',
|
16
42
|
:'status' => :'Status',
|
17
|
-
|
18
|
-
|
19
|
-
:'code' => :'Code'
|
20
|
-
|
43
|
+
:'matches' => :'Matches',
|
44
|
+
:'document' => :'Document'
|
21
45
|
}
|
22
46
|
end
|
23
47
|
|
24
|
-
#
|
48
|
+
# Attribute type mapping.
|
25
49
|
def self.swagger_types
|
26
50
|
{
|
27
|
-
:'
|
28
|
-
:'matches' => :'Integer',
|
51
|
+
:'code' => :'HttpStatusCode',
|
29
52
|
:'status' => :'String',
|
30
|
-
:'
|
31
|
-
|
53
|
+
:'matches' => :'Integer',
|
54
|
+
:'document' => :'Document'
|
32
55
|
}
|
33
56
|
end
|
34
57
|
|
58
|
+
# Initializes the object
|
59
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
35
60
|
def initialize(attributes = {})
|
36
|
-
return
|
61
|
+
return unless attributes.is_a?(Hash)
|
37
62
|
|
38
63
|
# convert string to symbol for hash key
|
39
|
-
attributes = attributes.
|
64
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
40
65
|
|
41
|
-
|
42
|
-
|
43
|
-
|
66
|
+
if attributes.has_key?(:'Code')
|
67
|
+
self.code = attributes[:'Code']
|
68
|
+
end
|
69
|
+
|
70
|
+
if attributes.has_key?(:'Status')
|
71
|
+
self.status = attributes[:'Status']
|
44
72
|
end
|
45
|
-
|
46
|
-
if attributes
|
73
|
+
|
74
|
+
if attributes.has_key?(:'Matches')
|
47
75
|
self.matches = attributes[:'Matches']
|
48
76
|
end
|
49
|
-
|
50
|
-
if attributes
|
51
|
-
self.
|
77
|
+
|
78
|
+
if attributes.has_key?(:'Document')
|
79
|
+
self.document = attributes[:'Document']
|
52
80
|
end
|
53
|
-
|
54
|
-
|
55
|
-
|
81
|
+
|
82
|
+
end
|
83
|
+
|
84
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
85
|
+
# @return Array for valid properies with the reasons
|
86
|
+
def list_invalid_properties
|
87
|
+
invalid_properties = Array.new
|
88
|
+
if @code.nil?
|
89
|
+
invalid_properties.push("invalid value for 'code', code cannot be nil.")
|
56
90
|
end
|
57
|
-
|
91
|
+
|
92
|
+
return invalid_properties
|
93
|
+
end
|
94
|
+
|
95
|
+
# Check to see if the all the properties in the model are valid
|
96
|
+
# @return true if the model is valid
|
97
|
+
def valid?
|
98
|
+
return false if @code.nil?
|
99
|
+
return true
|
100
|
+
end
|
101
|
+
|
102
|
+
# Checks equality by comparing each attribute.
|
103
|
+
# @param [Object] Object to be compared
|
104
|
+
def ==(o)
|
105
|
+
return true if self.equal?(o)
|
106
|
+
self.class == o.class &&
|
107
|
+
code == o.code &&
|
108
|
+
status == o.status &&
|
109
|
+
matches == o.matches &&
|
110
|
+
document == o.document
|
111
|
+
end
|
112
|
+
|
113
|
+
# @see the `==` method
|
114
|
+
# @param [Object] Object to be compared
|
115
|
+
def eql?(o)
|
116
|
+
self == o
|
117
|
+
end
|
118
|
+
|
119
|
+
# Calculates hash code according to all attributes.
|
120
|
+
# @return [Fixnum] Hash code
|
121
|
+
def hash
|
122
|
+
[code, status, matches, document].hash
|
123
|
+
end
|
124
|
+
|
125
|
+
# Builds the object from hash
|
126
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
127
|
+
# @return [Object] Returns the model itself
|
128
|
+
def build_from_hash(attributes)
|
129
|
+
return nil unless attributes.is_a?(Hash)
|
130
|
+
self.class.swagger_types.each_pair do |key, type|
|
131
|
+
if type =~ /\AArray<(.*)>/i
|
132
|
+
# check to ensure the input is an array given that the the attribute
|
133
|
+
# is documented as an array but the input is not
|
134
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
135
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
136
|
+
end
|
137
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
138
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
139
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
140
|
+
end
|
141
|
+
|
142
|
+
self
|
143
|
+
end
|
144
|
+
|
145
|
+
# Deserializes the data based on type
|
146
|
+
# @param string type Data type
|
147
|
+
# @param string value Value to be deserialized
|
148
|
+
# @return [Object] Deserialized data
|
149
|
+
def _deserialize(type, value)
|
150
|
+
case type.to_sym
|
151
|
+
when :DateTime
|
152
|
+
DateTime.parse(value)
|
153
|
+
when :Date
|
154
|
+
Date.parse(value)
|
155
|
+
when :String
|
156
|
+
value.to_s
|
157
|
+
when :Integer
|
158
|
+
value.to_i
|
159
|
+
when :Float
|
160
|
+
value.to_f
|
161
|
+
when :BOOLEAN
|
162
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
163
|
+
true
|
164
|
+
else
|
165
|
+
false
|
166
|
+
end
|
167
|
+
when :Object
|
168
|
+
# generic object (usually a Hash), return directly
|
169
|
+
value
|
170
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
171
|
+
inner_type = Regexp.last_match[:inner_type]
|
172
|
+
value.map { |v| _deserialize(inner_type, v) }
|
173
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
174
|
+
k_type = Regexp.last_match[:k_type]
|
175
|
+
v_type = Regexp.last_match[:v_type]
|
176
|
+
{}.tap do |hash|
|
177
|
+
value.each do |k, v|
|
178
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
else # model
|
182
|
+
temp_model = AsposePdfCloud.const_get(type).new
|
183
|
+
temp_model.build_from_hash(value)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
# Returns the string representation of the object
|
188
|
+
# @return [String] String presentation of the object
|
189
|
+
def to_s
|
190
|
+
to_hash.to_s
|
58
191
|
end
|
59
192
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
193
|
+
# to_body is an alias to to_hash (backward compatibility)
|
194
|
+
# @return [Hash] Returns the object in the form of hash
|
195
|
+
def to_body
|
196
|
+
to_hash
|
197
|
+
end
|
198
|
+
|
199
|
+
# Returns the object in the form of hash
|
200
|
+
# @return [Hash] Returns the object in the form of hash
|
201
|
+
def to_hash
|
202
|
+
hash = {}
|
203
|
+
self.class.attribute_map.each_pair do |attr, param|
|
204
|
+
value = self.send(attr)
|
205
|
+
next if value.nil?
|
206
|
+
hash[param] = _to_hash(value)
|
207
|
+
end
|
208
|
+
hash
|
209
|
+
end
|
210
|
+
|
211
|
+
# Outputs non-array value in the form of hash
|
212
|
+
# For object, use to_hash. Otherwise, just return the value
|
213
|
+
# @param [Object] value Any valid value
|
214
|
+
# @return [Hash] Returns the value in the form of hash
|
215
|
+
def _to_hash(value)
|
216
|
+
if value.is_a?(Array)
|
217
|
+
value.compact.map{ |v| _to_hash(v) }
|
218
|
+
elsif value.is_a?(Hash)
|
219
|
+
{}.tap do |hash|
|
220
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
221
|
+
end
|
222
|
+
elsif value.respond_to? :to_hash
|
223
|
+
value.to_hash
|
224
|
+
else
|
225
|
+
value
|
64
226
|
end
|
65
|
-
@status = status
|
66
227
|
end
|
67
228
|
|
68
229
|
end
|
230
|
+
|
69
231
|
end
|
@@ -1,83 +1,254 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
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 form field.
|
26
|
+
class Field
|
27
|
+
# Link to the document.
|
28
|
+
attr_accessor :links
|
29
|
+
|
30
|
+
# Field name.
|
31
|
+
attr_accessor :name
|
32
|
+
|
33
|
+
# Field type.
|
34
|
+
attr_accessor :type
|
35
|
+
|
36
|
+
# Field values.
|
37
|
+
attr_accessor :values
|
38
|
+
|
39
|
+
# Selected items.
|
40
|
+
attr_accessor :selected_items
|
41
|
+
|
42
|
+
# Field rectangle.
|
43
|
+
attr_accessor :rect
|
44
|
+
|
45
|
+
|
46
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
6
47
|
def self.attribute_map
|
7
48
|
{
|
8
|
-
|
9
|
-
#
|
49
|
+
:'links' => :'Links',
|
10
50
|
:'name' => :'Name',
|
11
|
-
|
12
|
-
#
|
13
51
|
:'type' => :'Type',
|
14
|
-
|
15
|
-
#
|
16
52
|
:'values' => :'Values',
|
17
|
-
|
18
|
-
#
|
19
53
|
:'selected_items' => :'SelectedItems',
|
20
|
-
|
21
|
-
#
|
22
|
-
:'rect' => :'Rect',
|
23
|
-
|
24
|
-
#
|
25
|
-
:'links' => :'Links'
|
26
|
-
|
54
|
+
:'rect' => :'Rect'
|
27
55
|
}
|
28
56
|
end
|
29
57
|
|
30
|
-
#
|
58
|
+
# Attribute type mapping.
|
31
59
|
def self.swagger_types
|
32
60
|
{
|
61
|
+
:'links' => :'Array<Link>',
|
33
62
|
:'name' => :'String',
|
34
|
-
:'type' => :'
|
63
|
+
:'type' => :'FieldType',
|
35
64
|
:'values' => :'Array<String>',
|
36
65
|
:'selected_items' => :'Array<Integer>',
|
37
|
-
:'rect' => :'Rectangle'
|
38
|
-
:'links' => :'Array<Link>'
|
39
|
-
|
66
|
+
:'rect' => :'Rectangle'
|
40
67
|
}
|
41
68
|
end
|
42
69
|
|
70
|
+
# Initializes the object
|
71
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
43
72
|
def initialize(attributes = {})
|
44
|
-
return
|
73
|
+
return unless attributes.is_a?(Hash)
|
45
74
|
|
46
75
|
# convert string to symbol for hash key
|
47
|
-
attributes = attributes.
|
76
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
48
77
|
|
49
|
-
|
50
|
-
|
78
|
+
if attributes.has_key?(:'Links')
|
79
|
+
if (value = attributes[:'Links']).is_a?(Array)
|
80
|
+
self.links = value
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
if attributes.has_key?(:'Name')
|
51
85
|
self.name = attributes[:'Name']
|
52
86
|
end
|
53
|
-
|
54
|
-
if attributes
|
87
|
+
|
88
|
+
if attributes.has_key?(:'Type')
|
55
89
|
self.type = attributes[:'Type']
|
56
90
|
end
|
57
|
-
|
58
|
-
if attributes
|
91
|
+
|
92
|
+
if attributes.has_key?(:'Values')
|
59
93
|
if (value = attributes[:'Values']).is_a?(Array)
|
60
94
|
self.values = value
|
61
95
|
end
|
62
96
|
end
|
63
|
-
|
64
|
-
if attributes
|
97
|
+
|
98
|
+
if attributes.has_key?(:'SelectedItems')
|
65
99
|
if (value = attributes[:'SelectedItems']).is_a?(Array)
|
66
100
|
self.selected_items = value
|
67
101
|
end
|
68
102
|
end
|
69
|
-
|
70
|
-
if attributes
|
103
|
+
|
104
|
+
if attributes.has_key?(:'Rect')
|
71
105
|
self.rect = attributes[:'Rect']
|
72
106
|
end
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
111
|
+
# @return Array for valid properies with the reasons
|
112
|
+
def list_invalid_properties
|
113
|
+
invalid_properties = Array.new
|
114
|
+
return invalid_properties
|
115
|
+
end
|
116
|
+
|
117
|
+
# Check to see if the all the properties in the model are valid
|
118
|
+
# @return true if the model is valid
|
119
|
+
def valid?
|
120
|
+
return true
|
121
|
+
end
|
122
|
+
|
123
|
+
# Checks equality by comparing each attribute.
|
124
|
+
# @param [Object] Object to be compared
|
125
|
+
def ==(o)
|
126
|
+
return true if self.equal?(o)
|
127
|
+
self.class == o.class &&
|
128
|
+
links == o.links &&
|
129
|
+
name == o.name &&
|
130
|
+
type == o.type &&
|
131
|
+
values == o.values &&
|
132
|
+
selected_items == o.selected_items &&
|
133
|
+
rect == o.rect
|
134
|
+
end
|
135
|
+
|
136
|
+
# @see the `==` method
|
137
|
+
# @param [Object] Object to be compared
|
138
|
+
def eql?(o)
|
139
|
+
self == o
|
140
|
+
end
|
141
|
+
|
142
|
+
# Calculates hash code according to all attributes.
|
143
|
+
# @return [Fixnum] Hash code
|
144
|
+
def hash
|
145
|
+
[links, name, type, values, selected_items, rect].hash
|
146
|
+
end
|
147
|
+
|
148
|
+
# Builds the object from hash
|
149
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
150
|
+
# @return [Object] Returns the model itself
|
151
|
+
def build_from_hash(attributes)
|
152
|
+
return nil unless attributes.is_a?(Hash)
|
153
|
+
self.class.swagger_types.each_pair do |key, type|
|
154
|
+
if type =~ /\AArray<(.*)>/i
|
155
|
+
# check to ensure the input is an array given that the the attribute
|
156
|
+
# is documented as an array but the input is not
|
157
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
158
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
159
|
+
end
|
160
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
161
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
162
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
163
|
+
end
|
164
|
+
|
165
|
+
self
|
166
|
+
end
|
167
|
+
|
168
|
+
# Deserializes the data based on type
|
169
|
+
# @param string type Data type
|
170
|
+
# @param string value Value to be deserialized
|
171
|
+
# @return [Object] Deserialized data
|
172
|
+
def _deserialize(type, value)
|
173
|
+
case type.to_sym
|
174
|
+
when :DateTime
|
175
|
+
DateTime.parse(value)
|
176
|
+
when :Date
|
177
|
+
Date.parse(value)
|
178
|
+
when :String
|
179
|
+
value.to_s
|
180
|
+
when :Integer
|
181
|
+
value.to_i
|
182
|
+
when :Float
|
183
|
+
value.to_f
|
184
|
+
when :BOOLEAN
|
185
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
186
|
+
true
|
187
|
+
else
|
188
|
+
false
|
189
|
+
end
|
190
|
+
when :Object
|
191
|
+
# generic object (usually a Hash), return directly
|
192
|
+
value
|
193
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
194
|
+
inner_type = Regexp.last_match[:inner_type]
|
195
|
+
value.map { |v| _deserialize(inner_type, v) }
|
196
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
197
|
+
k_type = Regexp.last_match[:k_type]
|
198
|
+
v_type = Regexp.last_match[:v_type]
|
199
|
+
{}.tap do |hash|
|
200
|
+
value.each do |k, v|
|
201
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
202
|
+
end
|
77
203
|
end
|
204
|
+
else # model
|
205
|
+
temp_model = AsposePdfCloud.const_get(type).new
|
206
|
+
temp_model.build_from_hash(value)
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
# Returns the string representation of the object
|
211
|
+
# @return [String] String presentation of the object
|
212
|
+
def to_s
|
213
|
+
to_hash.to_s
|
214
|
+
end
|
215
|
+
|
216
|
+
# to_body is an alias to to_hash (backward compatibility)
|
217
|
+
# @return [Hash] Returns the object in the form of hash
|
218
|
+
def to_body
|
219
|
+
to_hash
|
220
|
+
end
|
221
|
+
|
222
|
+
# Returns the object in the form of hash
|
223
|
+
# @return [Hash] Returns the object in the form of hash
|
224
|
+
def to_hash
|
225
|
+
hash = {}
|
226
|
+
self.class.attribute_map.each_pair do |attr, param|
|
227
|
+
value = self.send(attr)
|
228
|
+
next if value.nil?
|
229
|
+
hash[param] = _to_hash(value)
|
230
|
+
end
|
231
|
+
hash
|
232
|
+
end
|
233
|
+
|
234
|
+
# Outputs non-array value in the form of hash
|
235
|
+
# For object, use to_hash. Otherwise, just return the value
|
236
|
+
# @param [Object] value Any valid value
|
237
|
+
# @return [Hash] Returns the value in the form of hash
|
238
|
+
def _to_hash(value)
|
239
|
+
if value.is_a?(Array)
|
240
|
+
value.compact.map{ |v| _to_hash(v) }
|
241
|
+
elsif value.is_a?(Hash)
|
242
|
+
{}.tap do |hash|
|
243
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
244
|
+
end
|
245
|
+
elsif value.respond_to? :to_hash
|
246
|
+
value.to_hash
|
247
|
+
else
|
248
|
+
value
|
78
249
|
end
|
79
|
-
|
80
250
|
end
|
81
251
|
|
82
252
|
end
|
253
|
+
|
83
254
|
end
|