aspose_pdf_cloud 1.0.2 → 18.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,4 +1,25 @@
|
|
|
1
|
-
|
|
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
|
+
module AsposePdfCloud
|
|
2
23
|
class ApiError < StandardError
|
|
3
24
|
attr_reader :code, :response_headers, :response_body
|
|
4
25
|
|
|
@@ -9,12 +30,14 @@ module AsposePDFCloud
|
|
|
9
30
|
# ApiError.new(:code => 404, :message => "Not Found")
|
|
10
31
|
def initialize(arg = nil)
|
|
11
32
|
if arg.is_a? Hash
|
|
33
|
+
if arg.key?(:message) || arg.key?('message')
|
|
34
|
+
super(arg[:message] || arg['message'])
|
|
35
|
+
else
|
|
36
|
+
super arg
|
|
37
|
+
end
|
|
38
|
+
|
|
12
39
|
arg.each do |k, v|
|
|
13
|
-
|
|
14
|
-
super v
|
|
15
|
-
else
|
|
16
|
-
instance_variable_set "@#{k}", v
|
|
17
|
-
end
|
|
40
|
+
instance_variable_set "@#{k}", v
|
|
18
41
|
end
|
|
19
42
|
else
|
|
20
43
|
super arg
|
|
@@ -1,14 +1,28 @@
|
|
|
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
|
+
|
|
1
22
|
require 'uri'
|
|
2
|
-
require 'singleton'
|
|
3
23
|
|
|
4
|
-
module
|
|
24
|
+
module AsposePdfCloud
|
|
5
25
|
class Configuration
|
|
6
|
-
|
|
7
|
-
include Singleton
|
|
8
|
-
|
|
9
|
-
# Default api client
|
|
10
|
-
attr_accessor :api_client
|
|
11
|
-
|
|
12
26
|
# Defines url scheme
|
|
13
27
|
attr_accessor :scheme
|
|
14
28
|
|
|
@@ -17,32 +31,22 @@ module AsposePDFCloud
|
|
|
17
31
|
|
|
18
32
|
# Defines url base path
|
|
19
33
|
attr_accessor :base_path
|
|
20
|
-
|
|
21
|
-
#
|
|
34
|
+
|
|
35
|
+
# Auth types
|
|
36
|
+
AUTH_TYPE_O_AUTH_2 = 'OAuth2'
|
|
37
|
+
|
|
38
|
+
AUTH_TYPE_REQUEST_SIGNATURE = 'RequestSignature'
|
|
39
|
+
|
|
40
|
+
# Defines authentication type.
|
|
22
41
|
#
|
|
23
|
-
# @return [
|
|
24
|
-
|
|
25
|
-
# @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
|
|
26
|
-
# config.api_key['api_key'] = 'xxx'
|
|
27
|
-
attr_accessor :api_key
|
|
42
|
+
# @return [AUTH_TYPE_O_AUTH_2, AUTH_TYPE_REQUEST_SIGNATURE]
|
|
43
|
+
attr_accessor :auth_type
|
|
28
44
|
|
|
29
|
-
# Defines
|
|
30
|
-
|
|
31
|
-
# @return [Hash] key: parameter name, value: API key prefix
|
|
32
|
-
#
|
|
33
|
-
# @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
|
|
34
|
-
# config.api_key_prefix['api_key'] = 'Token'
|
|
35
|
-
attr_accessor :api_key_prefix
|
|
45
|
+
# Defines the access token (Bearer) used with OAuth2.
|
|
46
|
+
attr_accessor :access_token
|
|
36
47
|
|
|
37
|
-
# Defines the
|
|
38
|
-
|
|
39
|
-
# @return [String]
|
|
40
|
-
attr_accessor :username
|
|
41
|
-
|
|
42
|
-
# Defines the password used with HTTP basic authentication.
|
|
43
|
-
#
|
|
44
|
-
# @return [String]
|
|
45
|
-
attr_accessor :password
|
|
48
|
+
# Defines the refresh token (Bearer) used with OAuth2.
|
|
49
|
+
attr_accessor :refresh_token
|
|
46
50
|
|
|
47
51
|
# Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
|
|
48
52
|
# details will be logged with `logger.debug` (see the `logger` attribute).
|
|
@@ -64,7 +68,16 @@ module AsposePDFCloud
|
|
|
64
68
|
# @return [String]
|
|
65
69
|
attr_accessor :temp_folder_path
|
|
66
70
|
|
|
67
|
-
|
|
71
|
+
# The time limit for HTTP request in seconds.
|
|
72
|
+
# Default to 0 (never times out).
|
|
73
|
+
attr_accessor :timeout
|
|
74
|
+
|
|
75
|
+
# Set this to false to skip client side validation in the operation.
|
|
76
|
+
# Default to true.
|
|
77
|
+
# @return [true, false]
|
|
78
|
+
attr_accessor :client_side_validation
|
|
79
|
+
|
|
80
|
+
### TLS/SSL setting
|
|
68
81
|
# Set this to false to skip verifying SSL certificate when calling API from https server.
|
|
69
82
|
# Default to true.
|
|
70
83
|
#
|
|
@@ -73,6 +86,16 @@ module AsposePDFCloud
|
|
|
73
86
|
# @return [true, false]
|
|
74
87
|
attr_accessor :verify_ssl
|
|
75
88
|
|
|
89
|
+
### TLS/SSL setting
|
|
90
|
+
# Set this to false to skip verifying SSL host name
|
|
91
|
+
# Default to true.
|
|
92
|
+
#
|
|
93
|
+
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
|
94
|
+
#
|
|
95
|
+
# @return [true, false]
|
|
96
|
+
attr_accessor :verify_ssl_host
|
|
97
|
+
|
|
98
|
+
### TLS/SSL setting
|
|
76
99
|
# Set this to customize the certificate file to verify the peer.
|
|
77
100
|
#
|
|
78
101
|
# @return [String] the path to the certificate file
|
|
@@ -81,44 +104,52 @@ module AsposePDFCloud
|
|
|
81
104
|
# https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
|
|
82
105
|
attr_accessor :ssl_ca_cert
|
|
83
106
|
|
|
107
|
+
### TLS/SSL setting
|
|
84
108
|
# Client certificate file (for client certificate)
|
|
85
109
|
attr_accessor :cert_file
|
|
86
110
|
|
|
111
|
+
### TLS/SSL setting
|
|
87
112
|
# Client private key file (for client certificate)
|
|
88
113
|
attr_accessor :key_file
|
|
89
114
|
|
|
115
|
+
# Set this to customize parameters encoding of array parameter with multi collectionFormat.
|
|
116
|
+
# Default to nil.
|
|
117
|
+
#
|
|
118
|
+
# @see The params_encoding option of Ethon. Related source code:
|
|
119
|
+
# https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
|
|
120
|
+
attr_accessor :params_encoding
|
|
121
|
+
|
|
90
122
|
attr_accessor :inject_format
|
|
91
123
|
|
|
92
124
|
attr_accessor :force_ending_format
|
|
93
125
|
|
|
94
|
-
class << self
|
|
95
|
-
def method_missing(method_name, *args, &block)
|
|
96
|
-
config = Configuration.instance
|
|
97
|
-
if config.respond_to?(method_name)
|
|
98
|
-
config.send(method_name, *args, &block)
|
|
99
|
-
else
|
|
100
|
-
super
|
|
101
|
-
end
|
|
102
|
-
end
|
|
103
|
-
end
|
|
104
|
-
|
|
105
126
|
def initialize
|
|
106
|
-
@scheme = '
|
|
127
|
+
@scheme = 'https'
|
|
107
128
|
@host = 'api.aspose.cloud'
|
|
108
129
|
@base_path = '/v1.1'
|
|
109
|
-
@
|
|
110
|
-
@
|
|
130
|
+
@timeout = 0
|
|
131
|
+
@client_side_validation = true
|
|
111
132
|
@verify_ssl = true
|
|
133
|
+
@verify_ssl_host = true
|
|
134
|
+
@params_encoding = nil
|
|
112
135
|
@cert_file = nil
|
|
113
136
|
@key_file = nil
|
|
114
137
|
@debugging = false
|
|
115
138
|
@inject_format = false
|
|
116
139
|
@force_ending_format = false
|
|
117
140
|
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
|
141
|
+
@auth_type = AUTH_TYPE_O_AUTH_2
|
|
142
|
+
|
|
143
|
+
yield(self) if block_given?
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# The default Configuration object.
|
|
147
|
+
def self.default
|
|
148
|
+
@@default ||= Configuration.new
|
|
118
149
|
end
|
|
119
150
|
|
|
120
|
-
def
|
|
121
|
-
|
|
151
|
+
def configure
|
|
152
|
+
yield(self) if block_given?
|
|
122
153
|
end
|
|
123
154
|
|
|
124
155
|
def scheme=(scheme)
|
|
@@ -142,24 +173,16 @@ module AsposePDFCloud
|
|
|
142
173
|
URI.encode(url)
|
|
143
174
|
end
|
|
144
175
|
|
|
145
|
-
# Gets API key (with prefix if set).
|
|
146
|
-
# @param [String] param_name the parameter name of API key auth
|
|
147
|
-
def api_key_with_prefix(param_name)
|
|
148
|
-
if @api_key_prefix[param_name]
|
|
149
|
-
"#{@api_key_prefix[param_name]} #{@api_key[param_name]}"
|
|
150
|
-
else
|
|
151
|
-
@api_key[param_name]
|
|
152
|
-
end
|
|
153
|
-
end
|
|
154
|
-
|
|
155
|
-
# Gets Basic Auth token string
|
|
156
|
-
def basic_auth_token
|
|
157
|
-
'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
|
|
158
|
-
end
|
|
159
|
-
|
|
160
176
|
# Returns Auth Settings hash for api client.
|
|
161
177
|
def auth_settings
|
|
162
178
|
{
|
|
179
|
+
'oauth' =>
|
|
180
|
+
{
|
|
181
|
+
type: 'oauth2',
|
|
182
|
+
in: 'header',
|
|
183
|
+
key: 'Authorization',
|
|
184
|
+
value: "Bearer #{access_token}"
|
|
185
|
+
},
|
|
163
186
|
}
|
|
164
187
|
end
|
|
165
188
|
end
|
|
@@ -1,87 +1,260 @@
|
|
|
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
|
+
# Provides annotation.
|
|
26
|
+
class Annotation
|
|
27
|
+
# Link to the document.
|
|
28
|
+
attr_accessor :links
|
|
29
|
+
|
|
30
|
+
# Get the annotation color.
|
|
31
|
+
attr_accessor :color
|
|
32
|
+
|
|
33
|
+
# Get the annotation content.
|
|
34
|
+
attr_accessor :contents
|
|
35
|
+
|
|
36
|
+
# The date and time when the annotation was created.
|
|
37
|
+
attr_accessor :creation_date
|
|
38
|
+
|
|
39
|
+
# Get the annotation subject.
|
|
40
|
+
attr_accessor :subject
|
|
41
|
+
|
|
42
|
+
# Get the annotation title.
|
|
43
|
+
attr_accessor :title
|
|
44
|
+
|
|
45
|
+
# The date and time when the annotation was last modified.
|
|
46
|
+
attr_accessor :modified
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
6
50
|
def self.attribute_map
|
|
7
51
|
{
|
|
8
|
-
|
|
9
|
-
#
|
|
52
|
+
:'links' => :'Links',
|
|
10
53
|
:'color' => :'Color',
|
|
11
|
-
|
|
12
|
-
#
|
|
13
54
|
:'contents' => :'Contents',
|
|
14
|
-
|
|
15
|
-
#
|
|
16
55
|
:'creation_date' => :'CreationDate',
|
|
17
|
-
|
|
18
|
-
#
|
|
19
56
|
:'subject' => :'Subject',
|
|
20
|
-
|
|
21
|
-
#
|
|
22
57
|
:'title' => :'Title',
|
|
23
|
-
|
|
24
|
-
#
|
|
25
|
-
:'modified' => :'Modified',
|
|
26
|
-
|
|
27
|
-
#
|
|
28
|
-
:'links' => :'Links'
|
|
29
|
-
|
|
58
|
+
:'modified' => :'Modified'
|
|
30
59
|
}
|
|
31
60
|
end
|
|
32
61
|
|
|
33
|
-
#
|
|
62
|
+
# Attribute type mapping.
|
|
34
63
|
def self.swagger_types
|
|
35
64
|
{
|
|
65
|
+
:'links' => :'Array<Link>',
|
|
36
66
|
:'color' => :'Color',
|
|
37
67
|
:'contents' => :'String',
|
|
38
68
|
:'creation_date' => :'String',
|
|
39
69
|
:'subject' => :'String',
|
|
40
70
|
:'title' => :'String',
|
|
41
|
-
:'modified' => :'String'
|
|
42
|
-
:'links' => :'Array<Link>'
|
|
43
|
-
|
|
71
|
+
:'modified' => :'String'
|
|
44
72
|
}
|
|
45
73
|
end
|
|
46
74
|
|
|
75
|
+
# Initializes the object
|
|
76
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
47
77
|
def initialize(attributes = {})
|
|
48
|
-
return
|
|
78
|
+
return unless attributes.is_a?(Hash)
|
|
49
79
|
|
|
50
80
|
# convert string to symbol for hash key
|
|
51
|
-
attributes = attributes.
|
|
81
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
|
82
|
+
|
|
83
|
+
if attributes.has_key?(:'Links')
|
|
84
|
+
if (value = attributes[:'Links']).is_a?(Array)
|
|
85
|
+
self.links = value
|
|
86
|
+
end
|
|
87
|
+
end
|
|
52
88
|
|
|
53
|
-
|
|
54
|
-
if attributes[:'Color']
|
|
89
|
+
if attributes.has_key?(:'Color')
|
|
55
90
|
self.color = attributes[:'Color']
|
|
56
91
|
end
|
|
57
|
-
|
|
58
|
-
if attributes
|
|
92
|
+
|
|
93
|
+
if attributes.has_key?(:'Contents')
|
|
59
94
|
self.contents = attributes[:'Contents']
|
|
60
95
|
end
|
|
61
|
-
|
|
62
|
-
if attributes
|
|
96
|
+
|
|
97
|
+
if attributes.has_key?(:'CreationDate')
|
|
63
98
|
self.creation_date = attributes[:'CreationDate']
|
|
64
99
|
end
|
|
65
|
-
|
|
66
|
-
if attributes
|
|
100
|
+
|
|
101
|
+
if attributes.has_key?(:'Subject')
|
|
67
102
|
self.subject = attributes[:'Subject']
|
|
68
103
|
end
|
|
69
|
-
|
|
70
|
-
if attributes
|
|
104
|
+
|
|
105
|
+
if attributes.has_key?(:'Title')
|
|
71
106
|
self.title = attributes[:'Title']
|
|
72
107
|
end
|
|
73
|
-
|
|
74
|
-
if attributes
|
|
108
|
+
|
|
109
|
+
if attributes.has_key?(:'Modified')
|
|
75
110
|
self.modified = attributes[:'Modified']
|
|
76
111
|
end
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
112
|
+
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
116
|
+
# @return Array for valid properies with the reasons
|
|
117
|
+
def list_invalid_properties
|
|
118
|
+
invalid_properties = Array.new
|
|
119
|
+
return invalid_properties
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# Check to see if the all the properties in the model are valid
|
|
123
|
+
# @return true if the model is valid
|
|
124
|
+
def valid?
|
|
125
|
+
return true
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Checks equality by comparing each attribute.
|
|
129
|
+
# @param [Object] Object to be compared
|
|
130
|
+
def ==(o)
|
|
131
|
+
return true if self.equal?(o)
|
|
132
|
+
self.class == o.class &&
|
|
133
|
+
links == o.links &&
|
|
134
|
+
color == o.color &&
|
|
135
|
+
contents == o.contents &&
|
|
136
|
+
creation_date == o.creation_date &&
|
|
137
|
+
subject == o.subject &&
|
|
138
|
+
title == o.title &&
|
|
139
|
+
modified == o.modified
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# @see the `==` method
|
|
143
|
+
# @param [Object] Object to be compared
|
|
144
|
+
def eql?(o)
|
|
145
|
+
self == o
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
# Calculates hash code according to all attributes.
|
|
149
|
+
# @return [Fixnum] Hash code
|
|
150
|
+
def hash
|
|
151
|
+
[links, color, contents, creation_date, subject, title, modified].hash
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
# Builds the object from hash
|
|
155
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
156
|
+
# @return [Object] Returns the model itself
|
|
157
|
+
def build_from_hash(attributes)
|
|
158
|
+
return nil unless attributes.is_a?(Hash)
|
|
159
|
+
self.class.swagger_types.each_pair do |key, type|
|
|
160
|
+
if type =~ /\AArray<(.*)>/i
|
|
161
|
+
# check to ensure the input is an array given that the the attribute
|
|
162
|
+
# is documented as an array but the input is not
|
|
163
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
164
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
|
165
|
+
end
|
|
166
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
167
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
168
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
self
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# Deserializes the data based on type
|
|
175
|
+
# @param string type Data type
|
|
176
|
+
# @param string value Value to be deserialized
|
|
177
|
+
# @return [Object] Deserialized data
|
|
178
|
+
def _deserialize(type, value)
|
|
179
|
+
case type.to_sym
|
|
180
|
+
when :DateTime
|
|
181
|
+
DateTime.parse(value)
|
|
182
|
+
when :Date
|
|
183
|
+
Date.parse(value)
|
|
184
|
+
when :String
|
|
185
|
+
value.to_s
|
|
186
|
+
when :Integer
|
|
187
|
+
value.to_i
|
|
188
|
+
when :Float
|
|
189
|
+
value.to_f
|
|
190
|
+
when :BOOLEAN
|
|
191
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
192
|
+
true
|
|
193
|
+
else
|
|
194
|
+
false
|
|
81
195
|
end
|
|
196
|
+
when :Object
|
|
197
|
+
# generic object (usually a Hash), return directly
|
|
198
|
+
value
|
|
199
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
200
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
201
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
202
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
203
|
+
k_type = Regexp.last_match[:k_type]
|
|
204
|
+
v_type = Regexp.last_match[:v_type]
|
|
205
|
+
{}.tap do |hash|
|
|
206
|
+
value.each do |k, v|
|
|
207
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
208
|
+
end
|
|
209
|
+
end
|
|
210
|
+
else # model
|
|
211
|
+
temp_model = AsposePdfCloud.const_get(type).new
|
|
212
|
+
temp_model.build_from_hash(value)
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
# Returns the string representation of the object
|
|
217
|
+
# @return [String] String presentation of the object
|
|
218
|
+
def to_s
|
|
219
|
+
to_hash.to_s
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
223
|
+
# @return [Hash] Returns the object in the form of hash
|
|
224
|
+
def to_body
|
|
225
|
+
to_hash
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
# Returns the object in the form of hash
|
|
229
|
+
# @return [Hash] Returns the object in the form of hash
|
|
230
|
+
def to_hash
|
|
231
|
+
hash = {}
|
|
232
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
233
|
+
value = self.send(attr)
|
|
234
|
+
next if value.nil?
|
|
235
|
+
hash[param] = _to_hash(value)
|
|
236
|
+
end
|
|
237
|
+
hash
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
# Outputs non-array value in the form of hash
|
|
241
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
242
|
+
# @param [Object] value Any valid value
|
|
243
|
+
# @return [Hash] Returns the value in the form of hash
|
|
244
|
+
def _to_hash(value)
|
|
245
|
+
if value.is_a?(Array)
|
|
246
|
+
value.compact.map{ |v| _to_hash(v) }
|
|
247
|
+
elsif value.is_a?(Hash)
|
|
248
|
+
{}.tap do |hash|
|
|
249
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
250
|
+
end
|
|
251
|
+
elsif value.respond_to? :to_hash
|
|
252
|
+
value.to_hash
|
|
253
|
+
else
|
|
254
|
+
value
|
|
82
255
|
end
|
|
83
|
-
|
|
84
256
|
end
|
|
85
257
|
|
|
86
258
|
end
|
|
259
|
+
|
|
87
260
|
end
|