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,39 +1,199 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
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
|
+
# Number of words per document pages.
|
26
|
+
class WordCount
|
4
27
|
attr_accessor :list
|
5
|
-
|
28
|
+
|
29
|
+
|
30
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
6
31
|
def self.attribute_map
|
7
32
|
{
|
8
|
-
|
9
|
-
#
|
10
33
|
:'list' => :'List'
|
11
|
-
|
12
34
|
}
|
13
35
|
end
|
14
36
|
|
15
|
-
#
|
37
|
+
# Attribute type mapping.
|
16
38
|
def self.swagger_types
|
17
39
|
{
|
18
40
|
:'list' => :'Array<PageWordCount>'
|
19
|
-
|
20
41
|
}
|
21
42
|
end
|
22
43
|
|
44
|
+
# Initializes the object
|
45
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
23
46
|
def initialize(attributes = {})
|
24
|
-
return
|
47
|
+
return unless attributes.is_a?(Hash)
|
25
48
|
|
26
49
|
# convert string to symbol for hash key
|
27
|
-
attributes = attributes.
|
50
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
28
51
|
|
29
|
-
|
30
|
-
if attributes[:'List']
|
52
|
+
if attributes.has_key?(:'List')
|
31
53
|
if (value = attributes[:'List']).is_a?(Array)
|
32
54
|
self.list = value
|
33
55
|
end
|
34
56
|
end
|
35
|
-
|
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
|
36
195
|
end
|
37
196
|
|
38
197
|
end
|
198
|
+
|
39
199
|
end
|
@@ -1,61 +1,223 @@
|
|
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
|
+
# Number of words per document pages.
|
26
|
+
class WordCountResponse
|
27
|
+
# Response status code.
|
28
|
+
attr_accessor :code
|
29
|
+
|
30
|
+
# Response status.
|
31
|
+
attr_accessor :status
|
32
|
+
|
33
|
+
# with words per page info.
|
34
|
+
attr_accessor :words_per_page
|
35
|
+
|
36
|
+
|
37
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
6
38
|
def self.attribute_map
|
7
39
|
{
|
8
|
-
|
9
|
-
#
|
10
|
-
:'words_per_page' => :'WordsPerPage',
|
11
|
-
|
12
|
-
#
|
40
|
+
:'code' => :'Code',
|
13
41
|
:'status' => :'Status',
|
14
|
-
|
15
|
-
#
|
16
|
-
:'code' => :'Code'
|
17
|
-
|
42
|
+
:'words_per_page' => :'WordsPerPage'
|
18
43
|
}
|
19
44
|
end
|
20
45
|
|
21
|
-
#
|
46
|
+
# Attribute type mapping.
|
22
47
|
def self.swagger_types
|
23
48
|
{
|
24
|
-
:'
|
49
|
+
:'code' => :'HttpStatusCode',
|
25
50
|
:'status' => :'String',
|
26
|
-
:'
|
27
|
-
|
51
|
+
:'words_per_page' => :'WordCount'
|
28
52
|
}
|
29
53
|
end
|
30
54
|
|
55
|
+
# Initializes the object
|
56
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
31
57
|
def initialize(attributes = {})
|
32
|
-
return
|
58
|
+
return unless attributes.is_a?(Hash)
|
33
59
|
|
34
60
|
# convert string to symbol for hash key
|
35
|
-
attributes = attributes.
|
61
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
36
62
|
|
37
|
-
|
38
|
-
|
39
|
-
self.words_per_page = attributes[:'WordsPerPage']
|
63
|
+
if attributes.has_key?(:'Code')
|
64
|
+
self.code = attributes[:'Code']
|
40
65
|
end
|
41
|
-
|
42
|
-
if attributes
|
66
|
+
|
67
|
+
if attributes.has_key?(:'Status')
|
43
68
|
self.status = attributes[:'Status']
|
44
69
|
end
|
45
|
-
|
46
|
-
if attributes
|
47
|
-
self.
|
70
|
+
|
71
|
+
if attributes.has_key?(:'WordsPerPage')
|
72
|
+
self.words_per_page = attributes[:'WordsPerPage']
|
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
|
+
words_per_page == o.words_per_page
|
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, words_per_page].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)
|
48
199
|
end
|
49
|
-
|
200
|
+
hash
|
50
201
|
end
|
51
202
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
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
|
56
218
|
end
|
57
|
-
@status = status
|
58
219
|
end
|
59
220
|
|
60
221
|
end
|
222
|
+
|
61
223
|
end
|