aspose_pdf_cloud 20.1.0 → 20.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +26 -13
  3. data/docs/ApiInfo.md +10 -0
  4. data/docs/Cell.md +3 -0
  5. data/docs/CheckBoxField.md +1 -0
  6. data/docs/ChoiceField.md +1 -0
  7. data/docs/ComboBoxField.md +1 -0
  8. data/docs/FormField.md +1 -0
  9. data/docs/ImageCompressionVersion.md +12 -0
  10. data/docs/ImageEncoding.md +13 -0
  11. data/docs/ImageFragment.md +15 -0
  12. data/docs/ListBoxField.md +1 -0
  13. data/docs/OptimizeOptions.md +13 -7
  14. data/docs/OutputFormat.md +11 -0
  15. data/docs/PdfAType.md +3 -2
  16. data/docs/PdfApi.md +223 -26
  17. data/docs/RadioButtonField.md +1 -0
  18. data/docs/RadioButtonOptionField.md +1 -0
  19. data/docs/SignatureField.md +1 -0
  20. data/docs/TextBoxField.md +1 -0
  21. data/lib/aspose_pdf_cloud.rb +5 -0
  22. data/lib/aspose_pdf_cloud/api/pdf_api.rb +635 -43
  23. data/lib/aspose_pdf_cloud/api_client.rb +1 -1
  24. data/lib/aspose_pdf_cloud/models/api_info.rb +209 -0
  25. data/lib/aspose_pdf_cloud/models/cell.rb +36 -4
  26. data/lib/aspose_pdf_cloud/models/check_box_field.rb +11 -1
  27. data/lib/aspose_pdf_cloud/models/choice_field.rb +11 -1
  28. data/lib/aspose_pdf_cloud/models/combo_box_field.rb +11 -1
  29. data/lib/aspose_pdf_cloud/models/form_field.rb +11 -1
  30. data/lib/aspose_pdf_cloud/models/image_compression_version.rb +45 -0
  31. data/lib/aspose_pdf_cloud/models/image_encoding.rb +46 -0
  32. data/lib/aspose_pdf_cloud/models/image_fragment.rb +283 -0
  33. data/lib/aspose_pdf_cloud/models/list_box_field.rb +11 -1
  34. data/lib/aspose_pdf_cloud/models/optimize_options.rb +60 -35
  35. data/lib/aspose_pdf_cloud/models/output_format.rb +44 -0
  36. data/lib/aspose_pdf_cloud/models/pdf_a_type.rb +1 -0
  37. data/lib/aspose_pdf_cloud/models/radio_button_field.rb +11 -1
  38. data/lib/aspose_pdf_cloud/models/radio_button_option_field.rb +11 -1
  39. data/lib/aspose_pdf_cloud/models/signature_field.rb +11 -1
  40. data/lib/aspose_pdf_cloud/models/text_box_field.rb +11 -1
  41. data/lib/aspose_pdf_cloud/version.rb +1 -1
  42. data/test/pdf_tests.rb +157 -96
  43. data/test_data/4pagesPdfA.pdf +0 -0
  44. metadata +13 -2
@@ -49,7 +49,7 @@ module AsposePdfCloud
49
49
  @default_headers = {
50
50
  'Content-Type' => "application/json",
51
51
  'x-aspose-client' => "ruby sdk",
52
- 'x-aspose-version' => "#{ AsposePdfCloud::VERSION }"
52
+ 'x-aspose-client-version' => "#{ AsposePdfCloud::VERSION }"
53
53
  }
54
54
  end
55
55
 
@@ -0,0 +1,209 @@
1
+ =begin
2
+ --------------------------------------------------------------------------------------------------------------------
3
+ Copyright (c) 2020 Aspose.PDF 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
+ require 'time'
24
+
25
+ module AsposePdfCloud
26
+ # Represents response for ApiInfo DTO
27
+ class ApiInfo
28
+ # Product name.
29
+ attr_accessor :name
30
+
31
+ # API version.
32
+ attr_accessor :version
33
+
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+ :'name' => :'Name',
39
+ :'version' => :'Version'
40
+ }
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.swagger_types
45
+ {
46
+ :'name' => :'String',
47
+ :'version' => :'String'
48
+ }
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ return unless attributes.is_a?(Hash)
55
+
56
+ # convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
58
+
59
+ if attributes.has_key?(:'Name')
60
+ self.name = attributes[:'Name']
61
+ end
62
+
63
+ if attributes.has_key?(:'Version')
64
+ self.version = attributes[:'Version']
65
+ end
66
+
67
+ end
68
+
69
+ # Show invalid properties with the reasons. Usually used together with valid?
70
+ # @return Array for valid properies with the reasons
71
+ def list_invalid_properties
72
+ invalid_properties = Array.new
73
+ return invalid_properties
74
+ end
75
+
76
+ # Check to see if the all the properties in the model are valid
77
+ # @return true if the model is valid
78
+ def valid?
79
+ return true
80
+ end
81
+
82
+ # Checks equality by comparing each attribute.
83
+ # @param [Object] Object to be compared
84
+ def ==(o)
85
+ return true if self.equal?(o)
86
+ self.class == o.class &&
87
+ name == o.name &&
88
+ version == o.version
89
+ end
90
+
91
+ # @see the `==` method
92
+ # @param [Object] Object to be compared
93
+ def eql?(o)
94
+ self == o
95
+ end
96
+
97
+ # Calculates hash code according to all attributes.
98
+ # @return [Fixnum] Hash code
99
+ def hash
100
+ [name, version].hash
101
+ end
102
+
103
+ # Builds the object from hash
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ # @return [Object] Returns the model itself
106
+ def build_from_hash(attributes)
107
+ return nil unless attributes.is_a?(Hash)
108
+ self.class.swagger_types.each_pair do |key, type|
109
+ if type =~ /\AArray<(.*)>/i
110
+ # check to ensure the input is an array given that the the attribute
111
+ # is documented as an array but the input is not
112
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
113
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
114
+ end
115
+ elsif !attributes[self.class.attribute_map[key]].nil?
116
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
117
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
118
+ end
119
+
120
+ self
121
+ end
122
+
123
+ # Deserializes the data based on type
124
+ # @param string type Data type
125
+ # @param string value Value to be deserialized
126
+ # @return [Object] Deserialized data
127
+ def _deserialize(type, value)
128
+ case type.to_sym
129
+ when :DateTime
130
+ DateTime.parse(value)
131
+ when :Date
132
+ Date.parse(value)
133
+ when :String
134
+ value.to_s
135
+ when :Integer
136
+ value.to_i
137
+ when :Float
138
+ value.to_f
139
+ when :BOOLEAN
140
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
141
+ true
142
+ else
143
+ false
144
+ end
145
+ when :Object
146
+ # generic object (usually a Hash), return directly
147
+ value
148
+ when /\AArray<(?<inner_type>.+)>\z/
149
+ inner_type = Regexp.last_match[:inner_type]
150
+ value.map { |v| _deserialize(inner_type, v) }
151
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
152
+ k_type = Regexp.last_match[:k_type]
153
+ v_type = Regexp.last_match[:v_type]
154
+ {}.tap do |hash|
155
+ value.each do |k, v|
156
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
157
+ end
158
+ end
159
+ else # model
160
+ temp_model = AsposePdfCloud.const_get(type).new
161
+ temp_model.build_from_hash(value)
162
+ end
163
+ end
164
+
165
+ # Returns the string representation of the object
166
+ # @return [String] String presentation of the object
167
+ def to_s
168
+ to_hash.to_s
169
+ end
170
+
171
+ # to_body is an alias to to_hash (backward compatibility)
172
+ # @return [Hash] Returns the object in the form of hash
173
+ def to_body
174
+ to_hash
175
+ end
176
+
177
+ # Returns the object in the form of hash
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_hash
180
+ hash = {}
181
+ self.class.attribute_map.each_pair do |attr, param|
182
+ value = self.send(attr)
183
+ next if value.nil?
184
+ hash[param] = _to_hash(value)
185
+ end
186
+ hash
187
+ end
188
+
189
+ # Outputs non-array value in the form of hash
190
+ # For object, use to_hash. Otherwise, just return the value
191
+ # @param [Object] value Any valid value
192
+ # @return [Hash] Returns the value in the form of hash
193
+ def _to_hash(value)
194
+ if value.is_a?(Array)
195
+ value.compact.map{ |v| _to_hash(v) }
196
+ elsif value.is_a?(Hash)
197
+ {}.tap do |hash|
198
+ value.each { |k, v| hash[k] = _to_hash(v) }
199
+ end
200
+ elsif value.respond_to? :to_hash
201
+ value.to_hash
202
+ else
203
+ value
204
+ end
205
+ end
206
+
207
+ end
208
+
209
+ end
@@ -40,6 +40,9 @@ module AsposePdfCloud
40
40
  # Gets or sets the background image file.
41
41
  attr_accessor :background_image_file
42
42
 
43
+ # Gets or sets path of the background image file from storage.
44
+ attr_accessor :background_image_storage_file
45
+
43
46
  # Gets or sets the alignment.
44
47
  attr_accessor :alignment
45
48
 
@@ -64,6 +67,12 @@ module AsposePdfCloud
64
67
  # Gets or sets the column width.
65
68
  attr_accessor :width
66
69
 
70
+ # Gets or sets Html fragment.
71
+ attr_accessor :html_fragment
72
+
73
+ # Gets or sets ImageFragment list.
74
+ attr_accessor :images
75
+
67
76
 
68
77
  # Attribute mapping from ruby-style variable name to JSON key.
69
78
  def self.attribute_map
@@ -73,6 +82,7 @@ module AsposePdfCloud
73
82
  :'border' => :'Border',
74
83
  :'background_color' => :'BackgroundColor',
75
84
  :'background_image_file' => :'BackgroundImageFile',
85
+ :'background_image_storage_file' => :'BackgroundImageStorageFile',
76
86
  :'alignment' => :'Alignment',
77
87
  :'default_cell_text_state' => :'DefaultCellTextState',
78
88
  :'paragraphs' => :'Paragraphs',
@@ -80,7 +90,9 @@ module AsposePdfCloud
80
90
  :'vertical_alignment' => :'VerticalAlignment',
81
91
  :'col_span' => :'ColSpan',
82
92
  :'row_span' => :'RowSpan',
83
- :'width' => :'Width'
93
+ :'width' => :'Width',
94
+ :'html_fragment' => :'HtmlFragment',
95
+ :'images' => :'Images'
84
96
  }
85
97
  end
86
98
 
@@ -92,6 +104,7 @@ module AsposePdfCloud
92
104
  :'border' => :'BorderInfo',
93
105
  :'background_color' => :'Color',
94
106
  :'background_image_file' => :'String',
107
+ :'background_image_storage_file' => :'String',
95
108
  :'alignment' => :'HorizontalAlignment',
96
109
  :'default_cell_text_state' => :'TextState',
97
110
  :'paragraphs' => :'Array<TextRect>',
@@ -99,7 +112,9 @@ module AsposePdfCloud
99
112
  :'vertical_alignment' => :'VerticalAlignment',
100
113
  :'col_span' => :'Integer',
101
114
  :'row_span' => :'Integer',
102
- :'width' => :'Float'
115
+ :'width' => :'Float',
116
+ :'html_fragment' => :'String',
117
+ :'images' => :'Array<ImageFragment>'
103
118
  }
104
119
  end
105
120
 
@@ -131,6 +146,10 @@ module AsposePdfCloud
131
146
  self.background_image_file = attributes[:'BackgroundImageFile']
132
147
  end
133
148
 
149
+ if attributes.has_key?(:'BackgroundImageStorageFile')
150
+ self.background_image_storage_file = attributes[:'BackgroundImageStorageFile']
151
+ end
152
+
134
153
  if attributes.has_key?(:'Alignment')
135
154
  self.alignment = attributes[:'Alignment']
136
155
  end
@@ -165,6 +184,16 @@ module AsposePdfCloud
165
184
  self.width = attributes[:'Width']
166
185
  end
167
186
 
187
+ if attributes.has_key?(:'HtmlFragment')
188
+ self.html_fragment = attributes[:'HtmlFragment']
189
+ end
190
+
191
+ if attributes.has_key?(:'Images')
192
+ if (value = attributes[:'Images']).is_a?(Array)
193
+ self.images = value
194
+ end
195
+ end
196
+
168
197
  end
169
198
 
170
199
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -190,6 +219,7 @@ module AsposePdfCloud
190
219
  border == o.border &&
191
220
  background_color == o.background_color &&
192
221
  background_image_file == o.background_image_file &&
222
+ background_image_storage_file == o.background_image_storage_file &&
193
223
  alignment == o.alignment &&
194
224
  default_cell_text_state == o.default_cell_text_state &&
195
225
  paragraphs == o.paragraphs &&
@@ -197,7 +227,9 @@ module AsposePdfCloud
197
227
  vertical_alignment == o.vertical_alignment &&
198
228
  col_span == o.col_span &&
199
229
  row_span == o.row_span &&
200
- width == o.width
230
+ width == o.width &&
231
+ html_fragment == o.html_fragment &&
232
+ images == o.images
201
233
  end
202
234
 
203
235
  # @see the `==` method
@@ -209,7 +241,7 @@ module AsposePdfCloud
209
241
  # Calculates hash code according to all attributes.
210
242
  # @return [Fixnum] Hash code
211
243
  def hash
212
- [is_no_border, margin, border, background_color, background_image_file, alignment, default_cell_text_state, paragraphs, is_word_wrapped, vertical_alignment, col_span, row_span, width].hash
244
+ [is_no_border, margin, border, background_color, background_image_file, background_image_storage_file, alignment, default_cell_text_state, paragraphs, is_word_wrapped, vertical_alignment, col_span, row_span, width, html_fragment, images].hash
213
245
  end
214
246
 
215
247
  # Builds the object from hash
@@ -31,6 +31,9 @@ module AsposePdfCloud
31
31
  # Field name.
32
32
  attr_accessor :partial_name
33
33
 
34
+ # Full Field name.
35
+ attr_accessor :full_name
36
+
34
37
  # Field rectangle.
35
38
  attr_accessor :rect
36
39
 
@@ -103,6 +106,7 @@ module AsposePdfCloud
103
106
  {
104
107
  :'links' => :'Links',
105
108
  :'partial_name' => :'PartialName',
109
+ :'full_name' => :'FullName',
106
110
  :'rect' => :'Rect',
107
111
  :'value' => :'Value',
108
112
  :'page_index' => :'PageIndex',
@@ -133,6 +137,7 @@ module AsposePdfCloud
133
137
  {
134
138
  :'links' => :'Array<Link>',
135
139
  :'partial_name' => :'String',
140
+ :'full_name' => :'String',
136
141
  :'rect' => :'Rectangle',
137
142
  :'value' => :'String',
138
143
  :'page_index' => :'Integer',
@@ -176,6 +181,10 @@ module AsposePdfCloud
176
181
  self.partial_name = attributes[:'PartialName']
177
182
  end
178
183
 
184
+ if attributes.has_key?(:'FullName')
185
+ self.full_name = attributes[:'FullName']
186
+ end
187
+
179
188
  if attributes.has_key?(:'Rect')
180
189
  self.rect = attributes[:'Rect']
181
190
  end
@@ -300,6 +309,7 @@ module AsposePdfCloud
300
309
  self.class == o.class &&
301
310
  links == o.links &&
302
311
  partial_name == o.partial_name &&
312
+ full_name == o.full_name &&
303
313
  rect == o.rect &&
304
314
  value == o.value &&
305
315
  page_index == o.page_index &&
@@ -333,7 +343,7 @@ module AsposePdfCloud
333
343
  # Calculates hash code according to all attributes.
334
344
  # @return [Fixnum] Hash code
335
345
  def hash
336
- [links, partial_name, rect, value, page_index, height, width, z_index, is_group, parent, is_shared_field, flags, color, contents, margin, highlighting, horizontal_alignment, vertical_alignment, border, allowed_states, style, active_state, checked, export_value].hash
346
+ [links, partial_name, full_name, rect, value, page_index, height, width, z_index, is_group, parent, is_shared_field, flags, color, contents, margin, highlighting, horizontal_alignment, vertical_alignment, border, allowed_states, style, active_state, checked, export_value].hash
337
347
  end
338
348
 
339
349
  # Builds the object from hash
@@ -31,6 +31,9 @@ module AsposePdfCloud
31
31
  # Field name.
32
32
  attr_accessor :partial_name
33
33
 
34
+ # Full Field name.
35
+ attr_accessor :full_name
36
+
34
37
  # Field rectangle.
35
38
  attr_accessor :rect
36
39
 
@@ -94,6 +97,7 @@ module AsposePdfCloud
94
97
  {
95
98
  :'links' => :'Links',
96
99
  :'partial_name' => :'PartialName',
100
+ :'full_name' => :'FullName',
97
101
  :'rect' => :'Rect',
98
102
  :'value' => :'Value',
99
103
  :'page_index' => :'PageIndex',
@@ -121,6 +125,7 @@ module AsposePdfCloud
121
125
  {
122
126
  :'links' => :'Array<Link>',
123
127
  :'partial_name' => :'String',
128
+ :'full_name' => :'String',
124
129
  :'rect' => :'Rectangle',
125
130
  :'value' => :'String',
126
131
  :'page_index' => :'Integer',
@@ -161,6 +166,10 @@ module AsposePdfCloud
161
166
  self.partial_name = attributes[:'PartialName']
162
167
  end
163
168
 
169
+ if attributes.has_key?(:'FullName')
170
+ self.full_name = attributes[:'FullName']
171
+ end
172
+
164
173
  if attributes.has_key?(:'Rect')
165
174
  self.rect = attributes[:'Rect']
166
175
  end
@@ -266,6 +275,7 @@ module AsposePdfCloud
266
275
  self.class == o.class &&
267
276
  links == o.links &&
268
277
  partial_name == o.partial_name &&
278
+ full_name == o.full_name &&
269
279
  rect == o.rect &&
270
280
  value == o.value &&
271
281
  page_index == o.page_index &&
@@ -296,7 +306,7 @@ module AsposePdfCloud
296
306
  # Calculates hash code according to all attributes.
297
307
  # @return [Fixnum] Hash code
298
308
  def hash
299
- [links, partial_name, rect, value, page_index, height, width, z_index, is_group, parent, is_shared_field, flags, color, contents, margin, highlighting, horizontal_alignment, vertical_alignment, border, multi_select, selected].hash
309
+ [links, partial_name, full_name, rect, value, page_index, height, width, z_index, is_group, parent, is_shared_field, flags, color, contents, margin, highlighting, horizontal_alignment, vertical_alignment, border, multi_select, selected].hash
300
310
  end
301
311
 
302
312
  # Builds the object from hash
@@ -31,6 +31,9 @@ module AsposePdfCloud
31
31
  # Field name.
32
32
  attr_accessor :partial_name
33
33
 
34
+ # Full Field name.
35
+ attr_accessor :full_name
36
+
34
37
  # Field rectangle.
35
38
  attr_accessor :rect
36
39
 
@@ -106,6 +109,7 @@ module AsposePdfCloud
106
109
  {
107
110
  :'links' => :'Links',
108
111
  :'partial_name' => :'PartialName',
112
+ :'full_name' => :'FullName',
109
113
  :'rect' => :'Rect',
110
114
  :'value' => :'Value',
111
115
  :'page_index' => :'PageIndex',
@@ -137,6 +141,7 @@ module AsposePdfCloud
137
141
  {
138
142
  :'links' => :'Array<Link>',
139
143
  :'partial_name' => :'String',
144
+ :'full_name' => :'String',
140
145
  :'rect' => :'Rectangle',
141
146
  :'value' => :'String',
142
147
  :'page_index' => :'Integer',
@@ -181,6 +186,10 @@ module AsposePdfCloud
181
186
  self.partial_name = attributes[:'PartialName']
182
187
  end
183
188
 
189
+ if attributes.has_key?(:'FullName')
190
+ self.full_name = attributes[:'FullName']
191
+ end
192
+
184
193
  if attributes.has_key?(:'Rect')
185
194
  self.rect = attributes[:'Rect']
186
195
  end
@@ -304,6 +313,7 @@ module AsposePdfCloud
304
313
  self.class == o.class &&
305
314
  links == o.links &&
306
315
  partial_name == o.partial_name &&
316
+ full_name == o.full_name &&
307
317
  rect == o.rect &&
308
318
  value == o.value &&
309
319
  page_index == o.page_index &&
@@ -338,7 +348,7 @@ module AsposePdfCloud
338
348
  # Calculates hash code according to all attributes.
339
349
  # @return [Fixnum] Hash code
340
350
  def hash
341
- [links, partial_name, rect, value, page_index, height, width, z_index, is_group, parent, is_shared_field, flags, color, contents, margin, highlighting, horizontal_alignment, vertical_alignment, border, multi_select, selected, options, active_state, editable, spell_check].hash
351
+ [links, partial_name, full_name, rect, value, page_index, height, width, z_index, is_group, parent, is_shared_field, flags, color, contents, margin, highlighting, horizontal_alignment, vertical_alignment, border, multi_select, selected, options, active_state, editable, spell_check].hash
342
352
  end
343
353
 
344
354
  # Builds the object from hash