aspose_pdf_cloud 18.3.0 → 18.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -35,7 +35,6 @@ module AsposePdfCloud
35
35
  #
36
36
  class ApiClient
37
37
 
38
- include AsposeStorageCloud
39
38
  # The Configuration object holding settings to be used in the API client.
40
39
  attr_accessor :config
41
40
 
@@ -428,8 +427,8 @@ module AsposePdfCloud
428
427
  # form parameters
429
428
  form_params = {}
430
429
  form_params["grant_type"] = 'client_credentials'
431
- form_params["client_id"] = AsposeApp.app_sid
432
- form_params["client_secret"] = AsposeApp.app_key
430
+ form_params["client_id"] = @config.app_sid
431
+ form_params["client_secret"] = @config.app_key
433
432
 
434
433
 
435
434
  url = build_request_url(local_var_path).gsub(@config.base_path, '')
@@ -23,6 +23,13 @@ require 'uri'
23
23
 
24
24
  module AsposePdfCloud
25
25
  class Configuration
26
+
27
+ # App Key
28
+ attr_accessor :app_key
29
+
30
+ # App SID
31
+ attr_accessor :app_sid
32
+
26
33
  # Defines url scheme
27
34
  attr_accessor :scheme
28
35
 
@@ -31,16 +38,6 @@ module AsposePdfCloud
31
38
 
32
39
  # Defines url base path
33
40
  attr_accessor :base_path
34
-
35
- # Auth types
36
- AUTH_TYPE_O_AUTH_2 = 'OAuth2'
37
-
38
- AUTH_TYPE_REQUEST_SIGNATURE = 'RequestSignature'
39
-
40
- # Defines authentication type.
41
- #
42
- # @return [AUTH_TYPE_O_AUTH_2, AUTH_TYPE_REQUEST_SIGNATURE]
43
- attr_accessor :auth_type
44
41
 
45
42
  # Defines the access token (Bearer) used with OAuth2.
46
43
  attr_accessor :access_token
@@ -138,7 +135,6 @@ module AsposePdfCloud
138
135
  @inject_format = false
139
136
  @force_ending_format = false
140
137
  @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
141
- @auth_type = AUTH_TYPE_O_AUTH_2
142
138
 
143
139
  yield(self) if block_given?
144
140
  end
@@ -0,0 +1,43 @@
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
+ class AntialiasingProcessingType
26
+
27
+ NO_ADDITIONAL_PROCESSING = "NoAdditionalProcessing".freeze
28
+ TRY_CORRECT_RESULT_HTML = "TryCorrectResultHtml".freeze
29
+
30
+ # Builds the enum from string
31
+ # @param [String] The enum value in the form of the string
32
+ # @return [String] The enum value
33
+ def build_from_hash(value)
34
+ # resolve issue with Concstant Name modification (ex: "FooName" to :FOO_NAME)
35
+ # consantValues = AntialiasingProcessingType.constants.select{|c| c.to_s == value}
36
+ constantValues = AntialiasingProcessingType.constants.select{ |const_name| AntialiasingProcessingType.const_get(const_name) == value}
37
+
38
+ raise "Invalid ENUM value #{value} for class #AntialiasingProcessingType" if constantValues.empty?
39
+ value
40
+ end
41
+ end
42
+
43
+ end
@@ -0,0 +1,298 @@
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 the privileges for accessing Pdf file./>.
26
+ class DocumentPrivilege
27
+ # Sets the permission which allow print or not. true is allow and false or not set is forbidden.
28
+ attr_accessor :allow_print
29
+
30
+ # Sets the permission which allow degraded printing or not. true is allow and false or not set is forbidden.
31
+ attr_accessor :allow_degraded_printing
32
+
33
+ # Sets the permission which allow modify contents or not. true is allow and false or not set is forbidden.
34
+ attr_accessor :allow_modify_contents
35
+
36
+ # Sets the permission which allow copy or not. true is allow and false or not set is forbidden.
37
+ attr_accessor :allow_copy
38
+
39
+ # Sets the permission which allow modify annotations or not. true is allow and false or not set is forbidden.
40
+ attr_accessor :allow_modify_annotations
41
+
42
+ # Sets the permission which allow fill in forms or not. true is allow and false or not set is forbidden.
43
+ attr_accessor :allow_fill_in
44
+
45
+ # Sets the permission which allow screen readers or not. true is allow and false or not set is forbidden.
46
+ attr_accessor :allow_screen_readers
47
+
48
+ # Sets the permission which allow assembly or not. true is allow and false or not set is forbidden.
49
+ attr_accessor :allow_assembly
50
+
51
+ # Sets the print level of document's privilege. Just as the Adobe Professional's Printing Allowed settings. 0: None. 1: Low Resolution (150 dpi). 2: High Resolution.
52
+ attr_accessor :print_allow_level
53
+
54
+ # Sets the change level of document's privilege. Just as the Adobe Professional's Changes Allowed settings. 0: None. 1: Inserting, Deleting and Rotating pages. 2: Filling in form fields and signing existing signature fields. 3: Commenting, filling in form fields, and signing existing signature fields. 4: Any except extracting pages.
55
+ attr_accessor :change_allow_level
56
+
57
+ # Sets the copy level of document's privilege. Just as the Adobe Professional's permission settings. 0: None. 1: Enable text access for screen reader devices for the visually impaired. 2: Enable copying of text, images and other content.
58
+ attr_accessor :copy_allow_level
59
+
60
+
61
+ # Attribute mapping from ruby-style variable name to JSON key.
62
+ def self.attribute_map
63
+ {
64
+ :'allow_print' => :'AllowPrint',
65
+ :'allow_degraded_printing' => :'AllowDegradedPrinting',
66
+ :'allow_modify_contents' => :'AllowModifyContents',
67
+ :'allow_copy' => :'AllowCopy',
68
+ :'allow_modify_annotations' => :'AllowModifyAnnotations',
69
+ :'allow_fill_in' => :'AllowFillIn',
70
+ :'allow_screen_readers' => :'AllowScreenReaders',
71
+ :'allow_assembly' => :'AllowAssembly',
72
+ :'print_allow_level' => :'PrintAllowLevel',
73
+ :'change_allow_level' => :'ChangeAllowLevel',
74
+ :'copy_allow_level' => :'CopyAllowLevel'
75
+ }
76
+ end
77
+
78
+ # Attribute type mapping.
79
+ def self.swagger_types
80
+ {
81
+ :'allow_print' => :'BOOLEAN',
82
+ :'allow_degraded_printing' => :'BOOLEAN',
83
+ :'allow_modify_contents' => :'BOOLEAN',
84
+ :'allow_copy' => :'BOOLEAN',
85
+ :'allow_modify_annotations' => :'BOOLEAN',
86
+ :'allow_fill_in' => :'BOOLEAN',
87
+ :'allow_screen_readers' => :'BOOLEAN',
88
+ :'allow_assembly' => :'BOOLEAN',
89
+ :'print_allow_level' => :'Integer',
90
+ :'change_allow_level' => :'Integer',
91
+ :'copy_allow_level' => :'Integer'
92
+ }
93
+ end
94
+
95
+ # Initializes the object
96
+ # @param [Hash] attributes Model attributes in the form of hash
97
+ def initialize(attributes = {})
98
+ return unless attributes.is_a?(Hash)
99
+
100
+ # convert string to symbol for hash key
101
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
102
+
103
+ if attributes.has_key?(:'AllowPrint')
104
+ self.allow_print = attributes[:'AllowPrint']
105
+ end
106
+
107
+ if attributes.has_key?(:'AllowDegradedPrinting')
108
+ self.allow_degraded_printing = attributes[:'AllowDegradedPrinting']
109
+ end
110
+
111
+ if attributes.has_key?(:'AllowModifyContents')
112
+ self.allow_modify_contents = attributes[:'AllowModifyContents']
113
+ end
114
+
115
+ if attributes.has_key?(:'AllowCopy')
116
+ self.allow_copy = attributes[:'AllowCopy']
117
+ end
118
+
119
+ if attributes.has_key?(:'AllowModifyAnnotations')
120
+ self.allow_modify_annotations = attributes[:'AllowModifyAnnotations']
121
+ end
122
+
123
+ if attributes.has_key?(:'AllowFillIn')
124
+ self.allow_fill_in = attributes[:'AllowFillIn']
125
+ end
126
+
127
+ if attributes.has_key?(:'AllowScreenReaders')
128
+ self.allow_screen_readers = attributes[:'AllowScreenReaders']
129
+ end
130
+
131
+ if attributes.has_key?(:'AllowAssembly')
132
+ self.allow_assembly = attributes[:'AllowAssembly']
133
+ end
134
+
135
+ if attributes.has_key?(:'PrintAllowLevel')
136
+ self.print_allow_level = attributes[:'PrintAllowLevel']
137
+ end
138
+
139
+ if attributes.has_key?(:'ChangeAllowLevel')
140
+ self.change_allow_level = attributes[:'ChangeAllowLevel']
141
+ end
142
+
143
+ if attributes.has_key?(:'CopyAllowLevel')
144
+ self.copy_allow_level = attributes[:'CopyAllowLevel']
145
+ end
146
+
147
+ end
148
+
149
+ # Show invalid properties with the reasons. Usually used together with valid?
150
+ # @return Array for valid properies with the reasons
151
+ def list_invalid_properties
152
+ invalid_properties = Array.new
153
+ return invalid_properties
154
+ end
155
+
156
+ # Check to see if the all the properties in the model are valid
157
+ # @return true if the model is valid
158
+ def valid?
159
+ return true
160
+ end
161
+
162
+ # Checks equality by comparing each attribute.
163
+ # @param [Object] Object to be compared
164
+ def ==(o)
165
+ return true if self.equal?(o)
166
+ self.class == o.class &&
167
+ allow_print == o.allow_print &&
168
+ allow_degraded_printing == o.allow_degraded_printing &&
169
+ allow_modify_contents == o.allow_modify_contents &&
170
+ allow_copy == o.allow_copy &&
171
+ allow_modify_annotations == o.allow_modify_annotations &&
172
+ allow_fill_in == o.allow_fill_in &&
173
+ allow_screen_readers == o.allow_screen_readers &&
174
+ allow_assembly == o.allow_assembly &&
175
+ print_allow_level == o.print_allow_level &&
176
+ change_allow_level == o.change_allow_level &&
177
+ copy_allow_level == o.copy_allow_level
178
+ end
179
+
180
+ # @see the `==` method
181
+ # @param [Object] Object to be compared
182
+ def eql?(o)
183
+ self == o
184
+ end
185
+
186
+ # Calculates hash code according to all attributes.
187
+ # @return [Fixnum] Hash code
188
+ def hash
189
+ [allow_print, allow_degraded_printing, allow_modify_contents, allow_copy, allow_modify_annotations, allow_fill_in, allow_screen_readers, allow_assembly, print_allow_level, change_allow_level, copy_allow_level].hash
190
+ end
191
+
192
+ # Builds the object from hash
193
+ # @param [Hash] attributes Model attributes in the form of hash
194
+ # @return [Object] Returns the model itself
195
+ def build_from_hash(attributes)
196
+ return nil unless attributes.is_a?(Hash)
197
+ self.class.swagger_types.each_pair do |key, type|
198
+ if type =~ /\AArray<(.*)>/i
199
+ # check to ensure the input is an array given that the the attribute
200
+ # is documented as an array but the input is not
201
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
202
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
203
+ end
204
+ elsif !attributes[self.class.attribute_map[key]].nil?
205
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
206
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
207
+ end
208
+
209
+ self
210
+ end
211
+
212
+ # Deserializes the data based on type
213
+ # @param string type Data type
214
+ # @param string value Value to be deserialized
215
+ # @return [Object] Deserialized data
216
+ def _deserialize(type, value)
217
+ case type.to_sym
218
+ when :DateTime
219
+ DateTime.parse(value)
220
+ when :Date
221
+ Date.parse(value)
222
+ when :String
223
+ value.to_s
224
+ when :Integer
225
+ value.to_i
226
+ when :Float
227
+ value.to_f
228
+ when :BOOLEAN
229
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
230
+ true
231
+ else
232
+ false
233
+ end
234
+ when :Object
235
+ # generic object (usually a Hash), return directly
236
+ value
237
+ when /\AArray<(?<inner_type>.+)>\z/
238
+ inner_type = Regexp.last_match[:inner_type]
239
+ value.map { |v| _deserialize(inner_type, v) }
240
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
241
+ k_type = Regexp.last_match[:k_type]
242
+ v_type = Regexp.last_match[:v_type]
243
+ {}.tap do |hash|
244
+ value.each do |k, v|
245
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
246
+ end
247
+ end
248
+ else # model
249
+ temp_model = AsposePdfCloud.const_get(type).new
250
+ temp_model.build_from_hash(value)
251
+ end
252
+ end
253
+
254
+ # Returns the string representation of the object
255
+ # @return [String] String presentation of the object
256
+ def to_s
257
+ to_hash.to_s
258
+ end
259
+
260
+ # to_body is an alias to to_hash (backward compatibility)
261
+ # @return [Hash] Returns the object in the form of hash
262
+ def to_body
263
+ to_hash
264
+ end
265
+
266
+ # Returns the object in the form of hash
267
+ # @return [Hash] Returns the object in the form of hash
268
+ def to_hash
269
+ hash = {}
270
+ self.class.attribute_map.each_pair do |attr, param|
271
+ value = self.send(attr)
272
+ next if value.nil?
273
+ hash[param] = _to_hash(value)
274
+ end
275
+ hash
276
+ end
277
+
278
+ # Outputs non-array value in the form of hash
279
+ # For object, use to_hash. Otherwise, just return the value
280
+ # @param [Object] value Any valid value
281
+ # @return [Hash] Returns the value in the form of hash
282
+ def _to_hash(value)
283
+ if value.is_a?(Array)
284
+ value.compact.map{ |v| _to_hash(v) }
285
+ elsif value.is_a?(Hash)
286
+ {}.tap do |hash|
287
+ value.each { |k, v| hash[k] = _to_hash(v) }
288
+ end
289
+ elsif value.respond_to? :to_hash
290
+ value.to_hash
291
+ else
292
+ value
293
+ end
294
+ end
295
+
296
+ end
297
+
298
+ end
@@ -0,0 +1,43 @@
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
+ class FontEncodingRules
26
+
27
+ DEFAULT = "Default".freeze
28
+ DECREASE_TO_UNICODE_PRIORITY_LEVEL = "DecreaseToUnicodePriorityLevel".freeze
29
+
30
+ # Builds the enum from string
31
+ # @param [String] The enum value in the form of the string
32
+ # @return [String] The enum value
33
+ def build_from_hash(value)
34
+ # resolve issue with Concstant Name modification (ex: "FooName" to :FOO_NAME)
35
+ # consantValues = FontEncodingRules.constants.select{|c| c.to_s == value}
36
+ constantValues = FontEncodingRules.constants.select{ |const_name| FontEncodingRules.const_get(const_name) == value}
37
+
38
+ raise "Invalid ENUM value #{value} for class #FontEncodingRules" if constantValues.empty?
39
+ value
40
+ end
41
+ end
42
+
43
+ end
@@ -0,0 +1,45 @@
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
+ class FontSavingModes
26
+
27
+ ALWAYS_SAVE_AS_WOFF = "AlwaysSaveAsWOFF".freeze
28
+ ALWAYS_SAVE_AS_TTF = "AlwaysSaveAsTTF".freeze
29
+ ALWAYS_SAVE_AS_EOT = "AlwaysSaveAsEOT".freeze
30
+ SAVE_IN_ALL_FORMATS = "SaveInAllFormats".freeze
31
+
32
+ # Builds the enum from string
33
+ # @param [String] The enum value in the form of the string
34
+ # @return [String] The enum value
35
+ def build_from_hash(value)
36
+ # resolve issue with Concstant Name modification (ex: "FooName" to :FOO_NAME)
37
+ # consantValues = FontSavingModes.constants.select{|c| c.to_s == value}
38
+ constantValues = FontSavingModes.constants.select{ |const_name| FontSavingModes.const_get(const_name) == value}
39
+
40
+ raise "Invalid ENUM value #{value} for class #FontSavingModes" if constantValues.empty?
41
+ value
42
+ end
43
+ end
44
+
45
+ end