groupdocs_conversion_cloud 21.4 → 21.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/groupdocs_conversion_cloud/api/license_api.rb +169 -0
- data/lib/groupdocs_conversion_cloud/api_error.rb +17 -4
- data/lib/groupdocs_conversion_cloud/models/consumption_result.rb +234 -0
- data/lib/groupdocs_conversion_cloud/models/doc_convert_options.rb +56 -4
- data/lib/groupdocs_conversion_cloud/models/docm_convert_options.rb +56 -4
- data/lib/groupdocs_conversion_cloud/models/docx_convert_options.rb +56 -4
- data/lib/groupdocs_conversion_cloud/models/dot_convert_options.rb +56 -4
- data/lib/groupdocs_conversion_cloud/models/dotm_convert_options.rb +56 -4
- data/lib/groupdocs_conversion_cloud/models/dotx_convert_options.rb +56 -4
- data/lib/groupdocs_conversion_cloud/models/odt_convert_options.rb +56 -4
- data/lib/groupdocs_conversion_cloud/models/ott_convert_options.rb +56 -4
- data/lib/groupdocs_conversion_cloud/models/rtf_convert_options.rb +53 -1
- data/lib/groupdocs_conversion_cloud/models/watermark_options.rb +19 -4
- data/lib/groupdocs_conversion_cloud/models/word_processing_convert_options.rb +56 -4
- data/lib/groupdocs_conversion_cloud/version.rb +1 -1
- data/lib/groupdocs_conversion_cloud.rb +2 -0
- metadata +4 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3ea7178d044cf5c299a57d1026b116825411bd5
|
4
|
+
data.tar.gz: e0c80aa65e843db6a08baee1d7a78bd7962965e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf07d6f6d86fd4bbda14bbf3ff7e011ce6cebb35d9cbe525cc9ce7b8bf9cef08bcf730a8f46a862197291a474356ff584b1dc8b57c1ce01567524bfd3e86fa21
|
7
|
+
data.tar.gz: a42a83a0cdf9fe59b382bfd63a0ea20f2e8128cc405872745c9d7e5a1058e8c47e06eca80b59ed77ede106c2563b3c9b7d66d5cda62e2b6aa33569178e69ca96
|
@@ -0,0 +1,169 @@
|
|
1
|
+
# -----------------------------------------------------------------------------------
|
2
|
+
# <copyright company="Aspose Pty Ltd" file="license.rb">
|
3
|
+
# Copyright (c) 2003-2021 Aspose Pty Ltd
|
4
|
+
# </copyright>
|
5
|
+
# <summary>
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the "Software"), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
# </summary>
|
24
|
+
# -----------------------------------------------------------------------------------
|
25
|
+
|
26
|
+
require 'uri'
|
27
|
+
require 'date'
|
28
|
+
|
29
|
+
module GroupDocsConversionCloud
|
30
|
+
#
|
31
|
+
# GroupDocs.Conversion Cloud API
|
32
|
+
#
|
33
|
+
class LicenseApi
|
34
|
+
attr_accessor :config
|
35
|
+
|
36
|
+
#make LicenseApi.new private
|
37
|
+
private_class_method :new
|
38
|
+
|
39
|
+
# Initializes new instance of LicenseApi
|
40
|
+
#
|
41
|
+
# @param [config] Configuration
|
42
|
+
# @return [LicenseApi] New instance of LicenseApi
|
43
|
+
def initialize(config)
|
44
|
+
@config = config
|
45
|
+
@api_client = ApiClient.new(config)
|
46
|
+
@access_token = nil
|
47
|
+
end
|
48
|
+
|
49
|
+
# Initializes new instance of LicenseApi
|
50
|
+
#
|
51
|
+
# @param [app_sid] Application identifier (App SID)
|
52
|
+
# @param [app_key] Application private key (App Key)
|
53
|
+
# @return [LicenseApi] New instance of LicenseApi
|
54
|
+
def self.from_keys(app_sid, app_key)
|
55
|
+
config = Configuration.new(app_sid, app_key)
|
56
|
+
return new(config)
|
57
|
+
end
|
58
|
+
|
59
|
+
# Initializes new instance of LicenseApi
|
60
|
+
#
|
61
|
+
# @param [config] Configuration
|
62
|
+
# @return [LicenseApi] New instance of LicenseApi
|
63
|
+
def self.from_config(config)
|
64
|
+
return new(config)
|
65
|
+
end
|
66
|
+
|
67
|
+
# Get license consumption
|
68
|
+
#
|
69
|
+
# @return [ConsumptionResult]
|
70
|
+
def get_consumption_credit()
|
71
|
+
data, _status_code, _headers = get_consumption_credit_with_http_info()
|
72
|
+
data
|
73
|
+
end
|
74
|
+
|
75
|
+
# Get license consumption
|
76
|
+
#
|
77
|
+
|
78
|
+
# @return [Array<(ConsumptionResult, Fixnum, Hash)>]
|
79
|
+
# ConsumptionResult data, response status code and response headers
|
80
|
+
def get_consumption_credit_with_http_info()
|
81
|
+
|
82
|
+
|
83
|
+
@api_client.config.logger.debug 'Calling API: LicenseApi.get_consumption_credit ...' if @api_client.config.debugging
|
84
|
+
# resource path
|
85
|
+
local_var_path = '/conversion/consumption'
|
86
|
+
|
87
|
+
# query parameters
|
88
|
+
query_params = {}
|
89
|
+
|
90
|
+
# header parameters
|
91
|
+
header_params = {}
|
92
|
+
# HTTP header 'Accept' (if needed)
|
93
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
94
|
+
# HTTP header 'Content-Type'
|
95
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
96
|
+
|
97
|
+
# form parameters
|
98
|
+
form_params = {}
|
99
|
+
|
100
|
+
# http body (model)
|
101
|
+
post_body = nil
|
102
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
103
|
+
header_params: header_params,
|
104
|
+
query_params: query_params,
|
105
|
+
form_params: form_params,
|
106
|
+
body: post_body,
|
107
|
+
access_token: get_access_token,
|
108
|
+
return_type: 'ConsumptionResult')
|
109
|
+
if @api_client.config.debugging
|
110
|
+
@api_client.config.logger.debug "API called:
|
111
|
+
LicenseApi#get_consumption_credit\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
112
|
+
end
|
113
|
+
[data, status_code, headers]
|
114
|
+
end
|
115
|
+
|
116
|
+
#
|
117
|
+
# Helper method to convert first letter to downcase
|
118
|
+
#
|
119
|
+
private def downcase_first_letter(str)
|
120
|
+
value = str[0].downcase + str[1..-1]
|
121
|
+
value
|
122
|
+
end
|
123
|
+
|
124
|
+
#
|
125
|
+
# Retrieves access token
|
126
|
+
#
|
127
|
+
private def get_access_token
|
128
|
+
if @access_token.nil? then
|
129
|
+
request_access_token
|
130
|
+
end
|
131
|
+
|
132
|
+
@access_token
|
133
|
+
end
|
134
|
+
|
135
|
+
#
|
136
|
+
# Gets a access token from server
|
137
|
+
#
|
138
|
+
private def request_access_token
|
139
|
+
auth_config = Configuration.new(@config.app_sid, @config.app_key)
|
140
|
+
auth_config.api_base_url = @config.api_base_url
|
141
|
+
auth_config.debugging = @config.debugging
|
142
|
+
auth_config.logger = @config.logger
|
143
|
+
auth_config.temp_folder_path = @config.temp_folder_path
|
144
|
+
auth_config.client_side_validation = @config.client_side_validation
|
145
|
+
auth_config.api_version = ''
|
146
|
+
|
147
|
+
auth_api_client = ApiClient.new(auth_config)
|
148
|
+
|
149
|
+
request_url = "/connect/token"
|
150
|
+
post_data = "grant_type=client_credentials&client_id=#{@config.app_sid}&client_secret=#{@config.app_key}"
|
151
|
+
|
152
|
+
data, _status_code, _header = auth_api_client.call_api(:POST, request_url, :body => post_data, :return_type => 'Object')
|
153
|
+
|
154
|
+
@access_token = data[:access_token]
|
155
|
+
|
156
|
+
expires_in_seconds = data[:expires_in].to_i - 5 * 60
|
157
|
+
expires_in_days = Rational(expires_in_seconds, 60 * 60 * 24)
|
158
|
+
@access_token_expires_at = DateTime.now + expires_in_days
|
159
|
+
end
|
160
|
+
|
161
|
+
# requires all files inside a directory from current dir
|
162
|
+
# @param _dir can be relative path like '/lib' or "../lib"
|
163
|
+
private def require_all(_dir)
|
164
|
+
Dir[File.expand_path(File.join(File.dirname(File.absolute_path(__FILE__)), _dir)) + "/*.rb"].each do |file|
|
165
|
+
require file
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
@@ -39,10 +39,23 @@ module GroupDocsConversionCloud
|
|
39
39
|
|
40
40
|
if arg.key?(:response_body) then
|
41
41
|
data = JSON.parse(arg[:response_body], :symbolize_names => true)
|
42
|
-
if !data.nil?
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
if !data.nil? then
|
43
|
+
if !data[:error].nil? then
|
44
|
+
error = data[:error]
|
45
|
+
if error.kind_of?(String) then
|
46
|
+
@message = error
|
47
|
+
else
|
48
|
+
@message = error[:message]
|
49
|
+
end
|
50
|
+
else
|
51
|
+
message = data[:message]
|
52
|
+
if !message.nil? && message.kind_of?(String) then
|
53
|
+
@message = message
|
54
|
+
@code = data[:code]
|
55
|
+
else
|
56
|
+
@message = data
|
57
|
+
end
|
58
|
+
end
|
46
59
|
end
|
47
60
|
end
|
48
61
|
|
@@ -0,0 +1,234 @@
|
|
1
|
+
#
|
2
|
+
# --------------------------------------------------------------------------------------------------------------------
|
3
|
+
# <copyright company="Aspose Pty Ltd" file="consumption_result.rb">
|
4
|
+
# Copyright (c) 2003-2021 Aspose Pty Ltd
|
5
|
+
# </copyright>
|
6
|
+
# <summary>
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
15
|
+
# copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
# SOFTWARE.
|
24
|
+
# </summary>
|
25
|
+
# --------------------------------------------------------------------------------------------------------------------
|
26
|
+
#
|
27
|
+
|
28
|
+
require 'date'
|
29
|
+
|
30
|
+
module GroupDocsConversionCloud
|
31
|
+
# Metered license consumption information
|
32
|
+
class ConsumptionResult
|
33
|
+
|
34
|
+
# Amount of used credits
|
35
|
+
attr_accessor :credit
|
36
|
+
|
37
|
+
# Amount of MBs processed
|
38
|
+
attr_accessor :quantity
|
39
|
+
|
40
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
41
|
+
def self.attribute_map
|
42
|
+
{
|
43
|
+
:'credit' => :'Credit',
|
44
|
+
:'quantity' => :'Quantity'
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
# Attribute type mapping.
|
49
|
+
def self.swagger_types
|
50
|
+
{
|
51
|
+
:'credit' => :'Float',
|
52
|
+
:'quantity' => :'Float'
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
# Initializes the object
|
57
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
58
|
+
def initialize(attributes = {})
|
59
|
+
return unless attributes.is_a?(Hash)
|
60
|
+
|
61
|
+
# convert string to symbol for hash key
|
62
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
63
|
+
|
64
|
+
if attributes.key?(:'Credit')
|
65
|
+
self.credit = attributes[:'Credit']
|
66
|
+
end
|
67
|
+
|
68
|
+
if attributes.key?(:'Quantity')
|
69
|
+
self.quantity = attributes[:'Quantity']
|
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 = []
|
78
|
+
if @credit.nil?
|
79
|
+
invalid_properties.push("invalid value for 'credit', credit cannot be nil.")
|
80
|
+
end
|
81
|
+
|
82
|
+
if @quantity.nil?
|
83
|
+
invalid_properties.push("invalid value for 'quantity', quantity cannot be nil.")
|
84
|
+
end
|
85
|
+
|
86
|
+
return invalid_properties
|
87
|
+
end
|
88
|
+
|
89
|
+
# Check to see if the all the properties in the model are valid
|
90
|
+
# @return true if the model is valid
|
91
|
+
def valid?
|
92
|
+
return false if @credit.nil?
|
93
|
+
return false if @quantity.nil?
|
94
|
+
return true
|
95
|
+
end
|
96
|
+
|
97
|
+
# Checks equality by comparing each attribute.
|
98
|
+
# @param [Object] Object to be compared
|
99
|
+
def ==(other)
|
100
|
+
return true if self.equal?(other)
|
101
|
+
self.class == other.class &&
|
102
|
+
credit == other.credit &&
|
103
|
+
quantity == other.quantity
|
104
|
+
end
|
105
|
+
|
106
|
+
# @see the `==` method
|
107
|
+
# @param [Object] Object to be compared
|
108
|
+
def eql?(other)
|
109
|
+
self == other
|
110
|
+
end
|
111
|
+
|
112
|
+
# Calculates hash code according to all attributes.
|
113
|
+
# @return [Fixnum] Hash code
|
114
|
+
def hash
|
115
|
+
[credit, quantity].hash
|
116
|
+
end
|
117
|
+
|
118
|
+
# Downcases first letter.
|
119
|
+
# @return downcased string
|
120
|
+
def uncap(str)
|
121
|
+
str[0, 1].downcase + str[1..-1]
|
122
|
+
end
|
123
|
+
|
124
|
+
# Builds the object from hash
|
125
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
126
|
+
# @return [Object] Returns the model itself
|
127
|
+
def build_from_hash(attributes)
|
128
|
+
return nil unless attributes.is_a?(Hash)
|
129
|
+
self.class.swagger_types.each_pair do |key, type|
|
130
|
+
pname = uncap(self.class.attribute_map[key]).intern
|
131
|
+
value = attributes[pname]
|
132
|
+
if type =~ /\AArray<(.*)>/i
|
133
|
+
# check to ensure the input is an array given that the the attribute
|
134
|
+
# is documented as an array but the input is not
|
135
|
+
if value.is_a?(Array)
|
136
|
+
self.send("#{key}=", value.map { |v| _deserialize($1, v) })
|
137
|
+
end
|
138
|
+
elsif !value.nil?
|
139
|
+
self.send("#{key}=", _deserialize(type, value))
|
140
|
+
end
|
141
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
142
|
+
end
|
143
|
+
|
144
|
+
self
|
145
|
+
end
|
146
|
+
|
147
|
+
# Deserializes the data based on type
|
148
|
+
# @param string type Data type
|
149
|
+
# @param string value Value to be deserialized
|
150
|
+
# @return [Object] Deserialized data
|
151
|
+
def _deserialize(type, value)
|
152
|
+
case type.to_sym
|
153
|
+
when :DateTime
|
154
|
+
Date.parse value
|
155
|
+
when :Date
|
156
|
+
Date.parse value
|
157
|
+
when :String
|
158
|
+
value.to_s
|
159
|
+
when :Integer
|
160
|
+
value.to_i
|
161
|
+
when :Float
|
162
|
+
value.to_f
|
163
|
+
when :BOOLEAN
|
164
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
165
|
+
true
|
166
|
+
else
|
167
|
+
false
|
168
|
+
end
|
169
|
+
when :Object
|
170
|
+
# generic object (usually a Hash), return directly
|
171
|
+
value
|
172
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
173
|
+
inner_type = Regexp.last_match[:inner_type]
|
174
|
+
value.map { |v| _deserialize(inner_type, v) }
|
175
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
176
|
+
k_type = Regexp.last_match[:k_type]
|
177
|
+
v_type = Regexp.last_match[:v_type]
|
178
|
+
{}.tap do |hash|
|
179
|
+
value.each do |k, v|
|
180
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
181
|
+
end
|
182
|
+
end
|
183
|
+
else
|
184
|
+
# model
|
185
|
+
temp_model = GroupDocsConversionCloud.const_get(type).new
|
186
|
+
temp_model.build_from_hash(value)
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
# Returns the string representation of the object
|
191
|
+
# @return [String] String presentation of the object
|
192
|
+
def to_s
|
193
|
+
to_hash.to_s
|
194
|
+
end
|
195
|
+
|
196
|
+
# to_body is an alias to to_hash (backward compatibility)
|
197
|
+
# @return [Hash] Returns the object in the form of hash
|
198
|
+
def to_body
|
199
|
+
to_hash
|
200
|
+
end
|
201
|
+
|
202
|
+
# Returns the object in the form of hash
|
203
|
+
# @return [Hash] Returns the object in the form of hash
|
204
|
+
def to_hash
|
205
|
+
hash = {}
|
206
|
+
self.class.attribute_map.each_pair do |attr, param|
|
207
|
+
value = self.send(attr)
|
208
|
+
next if value.nil?
|
209
|
+
hash[param] = _to_hash(value)
|
210
|
+
end
|
211
|
+
hash
|
212
|
+
end
|
213
|
+
|
214
|
+
# Outputs non-array value in the form of hash
|
215
|
+
# For object, use to_hash. Otherwise, just return the value
|
216
|
+
# @param [Object] value Any valid value
|
217
|
+
# @return [Hash] Returns the value in the form of hash
|
218
|
+
def _to_hash(value)
|
219
|
+
if value.is_a?(Array)
|
220
|
+
value.compact.map { |v| _to_hash(v) }
|
221
|
+
elsif value.is_a?(Hash)
|
222
|
+
{}.tap do |hash|
|
223
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
224
|
+
end
|
225
|
+
elsif value.respond_to? :to_hash
|
226
|
+
value.to_hash
|
227
|
+
else
|
228
|
+
value
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
end
|
233
|
+
|
234
|
+
end
|
@@ -58,6 +58,30 @@ module GroupDocsConversionCloud
|
|
58
58
|
# Watermark specific options
|
59
59
|
attr_accessor :watermark_options
|
60
60
|
|
61
|
+
# Recognition mode when converting from pdf
|
62
|
+
attr_accessor :pdf_recognition_mode
|
63
|
+
class EnumAttributeValidator
|
64
|
+
attr_reader :datatype
|
65
|
+
attr_reader :allowable_values
|
66
|
+
|
67
|
+
def initialize(datatype, allowable_values)
|
68
|
+
@allowable_values = allowable_values.map do |value|
|
69
|
+
case datatype.to_s
|
70
|
+
when /Integer/i
|
71
|
+
value.to_i
|
72
|
+
when /Float/i
|
73
|
+
value.to_f
|
74
|
+
else
|
75
|
+
value
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def valid?(value)
|
81
|
+
!value || allowable_values.include?(value)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
61
85
|
# Attribute mapping from ruby-style variable name to JSON key.
|
62
86
|
def self.attribute_map
|
63
87
|
{
|
@@ -69,7 +93,8 @@ module GroupDocsConversionCloud
|
|
69
93
|
:'dpi' => :'Dpi',
|
70
94
|
:'password' => :'Password',
|
71
95
|
:'zoom' => :'Zoom',
|
72
|
-
:'watermark_options' => :'WatermarkOptions'
|
96
|
+
:'watermark_options' => :'WatermarkOptions',
|
97
|
+
:'pdf_recognition_mode' => :'PdfRecognitionMode'
|
73
98
|
}
|
74
99
|
end
|
75
100
|
|
@@ -84,7 +109,8 @@ module GroupDocsConversionCloud
|
|
84
109
|
:'dpi' => :'Float',
|
85
110
|
:'password' => :'String',
|
86
111
|
:'zoom' => :'Integer',
|
87
|
-
:'watermark_options' => :'WatermarkOptions'
|
112
|
+
:'watermark_options' => :'WatermarkOptions',
|
113
|
+
:'pdf_recognition_mode' => :'String'
|
88
114
|
}
|
89
115
|
end
|
90
116
|
|
@@ -134,6 +160,10 @@ module GroupDocsConversionCloud
|
|
134
160
|
self.watermark_options = attributes[:'WatermarkOptions']
|
135
161
|
end
|
136
162
|
|
163
|
+
if attributes.key?(:'PdfRecognitionMode')
|
164
|
+
self.pdf_recognition_mode = attributes[:'PdfRecognitionMode']
|
165
|
+
end
|
166
|
+
|
137
167
|
end
|
138
168
|
|
139
169
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -164,6 +194,10 @@ module GroupDocsConversionCloud
|
|
164
194
|
invalid_properties.push("invalid value for 'zoom', zoom cannot be nil.")
|
165
195
|
end
|
166
196
|
|
197
|
+
if @pdf_recognition_mode.nil?
|
198
|
+
invalid_properties.push("invalid value for 'pdf_recognition_mode', pdf_recognition_mode cannot be nil.")
|
199
|
+
end
|
200
|
+
|
167
201
|
return invalid_properties
|
168
202
|
end
|
169
203
|
|
@@ -176,9 +210,26 @@ module GroupDocsConversionCloud
|
|
176
210
|
return false if @height.nil?
|
177
211
|
return false if @dpi.nil?
|
178
212
|
return false if @zoom.nil?
|
213
|
+
return false if @pdf_recognition_mode.nil?
|
214
|
+
pdf_recognition_mode_validator = EnumAttributeValidator.new('String', ["Textbox", "Flow"])
|
215
|
+
return false unless pdf_recognition_mode_validator.valid?(@pdf_recognition_mode)
|
179
216
|
return true
|
180
217
|
end
|
181
218
|
|
219
|
+
# Custom attribute writer method checking allowed values (enum).
|
220
|
+
# @param [Object] pdf_recognition_mode Object to be assigned
|
221
|
+
def pdf_recognition_mode=(pdf_recognition_mode)
|
222
|
+
validator = EnumAttributeValidator.new('String', ["Textbox", "Flow"])
|
223
|
+
if pdf_recognition_mode.to_i == 0
|
224
|
+
unless validator.valid?(pdf_recognition_mode)
|
225
|
+
raise ArgumentError, "invalid value for 'pdf_recognition_mode', must be one of #{validator.allowable_values}."
|
226
|
+
end
|
227
|
+
@pdf_recognition_mode = pdf_recognition_mode
|
228
|
+
else
|
229
|
+
@pdf_recognition_mode = validator.allowable_values[pdf_recognition_mode.to_i]
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
182
233
|
# Checks equality by comparing each attribute.
|
183
234
|
# @param [Object] Object to be compared
|
184
235
|
def ==(other)
|
@@ -192,7 +243,8 @@ module GroupDocsConversionCloud
|
|
192
243
|
dpi == other.dpi &&
|
193
244
|
password == other.password &&
|
194
245
|
zoom == other.zoom &&
|
195
|
-
watermark_options == other.watermark_options
|
246
|
+
watermark_options == other.watermark_options &&
|
247
|
+
pdf_recognition_mode == other.pdf_recognition_mode
|
196
248
|
end
|
197
249
|
|
198
250
|
# @see the `==` method
|
@@ -204,7 +256,7 @@ module GroupDocsConversionCloud
|
|
204
256
|
# Calculates hash code according to all attributes.
|
205
257
|
# @return [Fixnum] Hash code
|
206
258
|
def hash
|
207
|
-
[from_page, pages_count, pages, width, height, dpi, password, zoom, watermark_options].hash
|
259
|
+
[from_page, pages_count, pages, width, height, dpi, password, zoom, watermark_options, pdf_recognition_mode].hash
|
208
260
|
end
|
209
261
|
|
210
262
|
# Downcases first letter.
|
@@ -58,6 +58,30 @@ module GroupDocsConversionCloud
|
|
58
58
|
# Watermark specific options
|
59
59
|
attr_accessor :watermark_options
|
60
60
|
|
61
|
+
# Recognition mode when converting from pdf
|
62
|
+
attr_accessor :pdf_recognition_mode
|
63
|
+
class EnumAttributeValidator
|
64
|
+
attr_reader :datatype
|
65
|
+
attr_reader :allowable_values
|
66
|
+
|
67
|
+
def initialize(datatype, allowable_values)
|
68
|
+
@allowable_values = allowable_values.map do |value|
|
69
|
+
case datatype.to_s
|
70
|
+
when /Integer/i
|
71
|
+
value.to_i
|
72
|
+
when /Float/i
|
73
|
+
value.to_f
|
74
|
+
else
|
75
|
+
value
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def valid?(value)
|
81
|
+
!value || allowable_values.include?(value)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
61
85
|
# Attribute mapping from ruby-style variable name to JSON key.
|
62
86
|
def self.attribute_map
|
63
87
|
{
|
@@ -69,7 +93,8 @@ module GroupDocsConversionCloud
|
|
69
93
|
:'dpi' => :'Dpi',
|
70
94
|
:'password' => :'Password',
|
71
95
|
:'zoom' => :'Zoom',
|
72
|
-
:'watermark_options' => :'WatermarkOptions'
|
96
|
+
:'watermark_options' => :'WatermarkOptions',
|
97
|
+
:'pdf_recognition_mode' => :'PdfRecognitionMode'
|
73
98
|
}
|
74
99
|
end
|
75
100
|
|
@@ -84,7 +109,8 @@ module GroupDocsConversionCloud
|
|
84
109
|
:'dpi' => :'Float',
|
85
110
|
:'password' => :'String',
|
86
111
|
:'zoom' => :'Integer',
|
87
|
-
:'watermark_options' => :'WatermarkOptions'
|
112
|
+
:'watermark_options' => :'WatermarkOptions',
|
113
|
+
:'pdf_recognition_mode' => :'String'
|
88
114
|
}
|
89
115
|
end
|
90
116
|
|
@@ -134,6 +160,10 @@ module GroupDocsConversionCloud
|
|
134
160
|
self.watermark_options = attributes[:'WatermarkOptions']
|
135
161
|
end
|
136
162
|
|
163
|
+
if attributes.key?(:'PdfRecognitionMode')
|
164
|
+
self.pdf_recognition_mode = attributes[:'PdfRecognitionMode']
|
165
|
+
end
|
166
|
+
|
137
167
|
end
|
138
168
|
|
139
169
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -164,6 +194,10 @@ module GroupDocsConversionCloud
|
|
164
194
|
invalid_properties.push("invalid value for 'zoom', zoom cannot be nil.")
|
165
195
|
end
|
166
196
|
|
197
|
+
if @pdf_recognition_mode.nil?
|
198
|
+
invalid_properties.push("invalid value for 'pdf_recognition_mode', pdf_recognition_mode cannot be nil.")
|
199
|
+
end
|
200
|
+
|
167
201
|
return invalid_properties
|
168
202
|
end
|
169
203
|
|
@@ -176,9 +210,26 @@ module GroupDocsConversionCloud
|
|
176
210
|
return false if @height.nil?
|
177
211
|
return false if @dpi.nil?
|
178
212
|
return false if @zoom.nil?
|
213
|
+
return false if @pdf_recognition_mode.nil?
|
214
|
+
pdf_recognition_mode_validator = EnumAttributeValidator.new('String', ["Textbox", "Flow"])
|
215
|
+
return false unless pdf_recognition_mode_validator.valid?(@pdf_recognition_mode)
|
179
216
|
return true
|
180
217
|
end
|
181
218
|
|
219
|
+
# Custom attribute writer method checking allowed values (enum).
|
220
|
+
# @param [Object] pdf_recognition_mode Object to be assigned
|
221
|
+
def pdf_recognition_mode=(pdf_recognition_mode)
|
222
|
+
validator = EnumAttributeValidator.new('String', ["Textbox", "Flow"])
|
223
|
+
if pdf_recognition_mode.to_i == 0
|
224
|
+
unless validator.valid?(pdf_recognition_mode)
|
225
|
+
raise ArgumentError, "invalid value for 'pdf_recognition_mode', must be one of #{validator.allowable_values}."
|
226
|
+
end
|
227
|
+
@pdf_recognition_mode = pdf_recognition_mode
|
228
|
+
else
|
229
|
+
@pdf_recognition_mode = validator.allowable_values[pdf_recognition_mode.to_i]
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
182
233
|
# Checks equality by comparing each attribute.
|
183
234
|
# @param [Object] Object to be compared
|
184
235
|
def ==(other)
|
@@ -192,7 +243,8 @@ module GroupDocsConversionCloud
|
|
192
243
|
dpi == other.dpi &&
|
193
244
|
password == other.password &&
|
194
245
|
zoom == other.zoom &&
|
195
|
-
watermark_options == other.watermark_options
|
246
|
+
watermark_options == other.watermark_options &&
|
247
|
+
pdf_recognition_mode == other.pdf_recognition_mode
|
196
248
|
end
|
197
249
|
|
198
250
|
# @see the `==` method
|
@@ -204,7 +256,7 @@ module GroupDocsConversionCloud
|
|
204
256
|
# Calculates hash code according to all attributes.
|
205
257
|
# @return [Fixnum] Hash code
|
206
258
|
def hash
|
207
|
-
[from_page, pages_count, pages, width, height, dpi, password, zoom, watermark_options].hash
|
259
|
+
[from_page, pages_count, pages, width, height, dpi, password, zoom, watermark_options, pdf_recognition_mode].hash
|
208
260
|
end
|
209
261
|
|
210
262
|
# Downcases first letter.
|