cloudmersive-convert-api-client 1.5.8 → 1.5.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +18 -4
  3. data/docs/AddPdfAnnotationRequest.md +9 -0
  4. data/docs/EditDocumentApi.md +56 -1
  5. data/docs/EditPdfApi.md +345 -0
  6. data/docs/GetPdfAnnotationsResult.md +9 -0
  7. data/docs/PdfAnnotation.md +19 -0
  8. data/docs/PresentationResult.md +10 -0
  9. data/docs/RemovePptxSlidesRequest.md +11 -0
  10. data/docs/SetPdfMetadataRequest.md +2 -2
  11. data/docs/SplitDocumentApi.md +65 -2
  12. data/docs/SplitPptxPresentationResult.md +9 -0
  13. data/docs/WorksheetResult.md +1 -0
  14. data/lib/cloudmersive-convert-api-client.rb +6 -0
  15. data/lib/cloudmersive-convert-api-client/api/edit_document_api.rb +57 -2
  16. data/lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb +370 -0
  17. data/lib/cloudmersive-convert-api-client/api/split_document_api.rb +62 -0
  18. data/lib/cloudmersive-convert-api-client/models/add_pdf_annotation_request.rb +217 -0
  19. data/lib/cloudmersive-convert-api-client/models/get_pdf_annotations_result.rb +201 -0
  20. data/lib/cloudmersive-convert-api-client/models/pdf_annotation.rb +299 -0
  21. data/lib/cloudmersive-convert-api-client/models/presentation_result.rb +225 -0
  22. data/lib/cloudmersive-convert-api-client/models/remove_pptx_slides_request.rb +235 -0
  23. data/lib/cloudmersive-convert-api-client/models/set_pdf_metadata_request.rb +3 -1
  24. data/lib/cloudmersive-convert-api-client/models/split_pptx_presentation_result.rb +200 -0
  25. data/lib/cloudmersive-convert-api-client/models/worksheet_result.rb +30 -4
  26. data/lib/cloudmersive-convert-api-client/version.rb +1 -1
  27. data/spec/api/edit_document_api_spec.rb +13 -1
  28. data/spec/api/edit_pdf_api_spec.rb +77 -0
  29. data/spec/api/split_document_api_spec.rb +14 -0
  30. data/spec/models/add_pdf_annotation_request_spec.rb +48 -0
  31. data/spec/models/get_pdf_annotations_result_spec.rb +48 -0
  32. data/spec/models/pdf_annotation_spec.rb +108 -0
  33. data/spec/models/presentation_result_spec.rb +54 -0
  34. data/spec/models/remove_pptx_slides_request_spec.rb +60 -0
  35. data/spec/models/split_pptx_presentation_result_spec.rb +48 -0
  36. data/spec/models/worksheet_result_spec.rb +6 -0
  37. metadata +20 -2
@@ -0,0 +1,299 @@
1
+ =begin
2
+ #convertapi
3
+
4
+ #Convert API lets you effortlessly convert file formats and types.
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveConvertApiClient
16
+ # PDF Annotation details
17
+ class PdfAnnotation
18
+ # Title of the annotation; this is often the author of the annotation in Acrobat-created PDF files
19
+ attr_accessor :title
20
+
21
+ # Type of the annotation; possible values are Text
22
+ attr_accessor :annotation_type
23
+
24
+ # The 1-based index of the page containing the annotation
25
+ attr_accessor :page_number
26
+
27
+ # The 0-based index of the annotation in the document
28
+ attr_accessor :annotation_index
29
+
30
+ # Subject of the annotation
31
+ attr_accessor :subject
32
+
33
+ # Text contents of the annotation
34
+ attr_accessor :text_contents
35
+
36
+ # Date that the annotation was created
37
+ attr_accessor :creation_date
38
+
39
+ # Date that the annotation was last modified
40
+ attr_accessor :modified_date
41
+
42
+ # Left X coordinate for the location of the annotation
43
+ attr_accessor :left_x
44
+
45
+ # Top Y coordination of the location of the annotation
46
+ attr_accessor :top_y
47
+
48
+ # Width of the annotation
49
+ attr_accessor :width
50
+
51
+ # Height of the annotation
52
+ attr_accessor :height
53
+
54
+
55
+ # Attribute mapping from ruby-style variable name to JSON key.
56
+ def self.attribute_map
57
+ {
58
+ :'title' => :'Title',
59
+ :'annotation_type' => :'AnnotationType',
60
+ :'page_number' => :'PageNumber',
61
+ :'annotation_index' => :'AnnotationIndex',
62
+ :'subject' => :'Subject',
63
+ :'text_contents' => :'TextContents',
64
+ :'creation_date' => :'CreationDate',
65
+ :'modified_date' => :'ModifiedDate',
66
+ :'left_x' => :'LeftX',
67
+ :'top_y' => :'TopY',
68
+ :'width' => :'Width',
69
+ :'height' => :'Height'
70
+ }
71
+ end
72
+
73
+ # Attribute type mapping.
74
+ def self.swagger_types
75
+ {
76
+ :'title' => :'String',
77
+ :'annotation_type' => :'String',
78
+ :'page_number' => :'Integer',
79
+ :'annotation_index' => :'Integer',
80
+ :'subject' => :'String',
81
+ :'text_contents' => :'String',
82
+ :'creation_date' => :'DateTime',
83
+ :'modified_date' => :'DateTime',
84
+ :'left_x' => :'Float',
85
+ :'top_y' => :'Float',
86
+ :'width' => :'Float',
87
+ :'height' => :'Float'
88
+ }
89
+ end
90
+
91
+ # Initializes the object
92
+ # @param [Hash] attributes Model attributes in the form of hash
93
+ def initialize(attributes = {})
94
+ return unless attributes.is_a?(Hash)
95
+
96
+ # convert string to symbol for hash key
97
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
98
+
99
+ if attributes.has_key?(:'Title')
100
+ self.title = attributes[:'Title']
101
+ end
102
+
103
+ if attributes.has_key?(:'AnnotationType')
104
+ self.annotation_type = attributes[:'AnnotationType']
105
+ end
106
+
107
+ if attributes.has_key?(:'PageNumber')
108
+ self.page_number = attributes[:'PageNumber']
109
+ end
110
+
111
+ if attributes.has_key?(:'AnnotationIndex')
112
+ self.annotation_index = attributes[:'AnnotationIndex']
113
+ end
114
+
115
+ if attributes.has_key?(:'Subject')
116
+ self.subject = attributes[:'Subject']
117
+ end
118
+
119
+ if attributes.has_key?(:'TextContents')
120
+ self.text_contents = attributes[:'TextContents']
121
+ end
122
+
123
+ if attributes.has_key?(:'CreationDate')
124
+ self.creation_date = attributes[:'CreationDate']
125
+ end
126
+
127
+ if attributes.has_key?(:'ModifiedDate')
128
+ self.modified_date = attributes[:'ModifiedDate']
129
+ end
130
+
131
+ if attributes.has_key?(:'LeftX')
132
+ self.left_x = attributes[:'LeftX']
133
+ end
134
+
135
+ if attributes.has_key?(:'TopY')
136
+ self.top_y = attributes[:'TopY']
137
+ end
138
+
139
+ if attributes.has_key?(:'Width')
140
+ self.width = attributes[:'Width']
141
+ end
142
+
143
+ if attributes.has_key?(:'Height')
144
+ self.height = attributes[:'Height']
145
+ end
146
+
147
+ end
148
+
149
+ # Show invalid properties with the reasons. Usually used together with valid?
150
+ # @return Array for valid properties 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
+ title == o.title &&
168
+ annotation_type == o.annotation_type &&
169
+ page_number == o.page_number &&
170
+ annotation_index == o.annotation_index &&
171
+ subject == o.subject &&
172
+ text_contents == o.text_contents &&
173
+ creation_date == o.creation_date &&
174
+ modified_date == o.modified_date &&
175
+ left_x == o.left_x &&
176
+ top_y == o.top_y &&
177
+ width == o.width &&
178
+ height == o.height
179
+ end
180
+
181
+ # @see the `==` method
182
+ # @param [Object] Object to be compared
183
+ def eql?(o)
184
+ self == o
185
+ end
186
+
187
+ # Calculates hash code according to all attributes.
188
+ # @return [Fixnum] Hash code
189
+ def hash
190
+ [title, annotation_type, page_number, annotation_index, subject, text_contents, creation_date, modified_date, left_x, top_y, width, height].hash
191
+ end
192
+
193
+ # Builds the object from hash
194
+ # @param [Hash] attributes Model attributes in the form of hash
195
+ # @return [Object] Returns the model itself
196
+ def build_from_hash(attributes)
197
+ return nil unless attributes.is_a?(Hash)
198
+ self.class.swagger_types.each_pair do |key, type|
199
+ if type =~ /\AArray<(.*)>/i
200
+ # check to ensure the input is an array given that the the attribute
201
+ # is documented as an array but the input is not
202
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
203
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
204
+ end
205
+ elsif !attributes[self.class.attribute_map[key]].nil?
206
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
207
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
208
+ end
209
+
210
+ self
211
+ end
212
+
213
+ # Deserializes the data based on type
214
+ # @param string type Data type
215
+ # @param string value Value to be deserialized
216
+ # @return [Object] Deserialized data
217
+ def _deserialize(type, value)
218
+ case type.to_sym
219
+ when :DateTime
220
+ DateTime.parse(value)
221
+ when :Date
222
+ Date.parse(value)
223
+ when :String
224
+ value.to_s
225
+ when :Integer
226
+ value.to_i
227
+ when :Float
228
+ value.to_f
229
+ when :BOOLEAN
230
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
231
+ true
232
+ else
233
+ false
234
+ end
235
+ when :Object
236
+ # generic object (usually a Hash), return directly
237
+ value
238
+ when /\AArray<(?<inner_type>.+)>\z/
239
+ inner_type = Regexp.last_match[:inner_type]
240
+ value.map { |v| _deserialize(inner_type, v) }
241
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
242
+ k_type = Regexp.last_match[:k_type]
243
+ v_type = Regexp.last_match[:v_type]
244
+ {}.tap do |hash|
245
+ value.each do |k, v|
246
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
247
+ end
248
+ end
249
+ else # model
250
+ temp_model = CloudmersiveConvertApiClient.const_get(type).new
251
+ temp_model.build_from_hash(value)
252
+ end
253
+ end
254
+
255
+ # Returns the string representation of the object
256
+ # @return [String] String presentation of the object
257
+ def to_s
258
+ to_hash.to_s
259
+ end
260
+
261
+ # to_body is an alias to to_hash (backward compatibility)
262
+ # @return [Hash] Returns the object in the form of hash
263
+ def to_body
264
+ to_hash
265
+ end
266
+
267
+ # Returns the object in the form of hash
268
+ # @return [Hash] Returns the object in the form of hash
269
+ def to_hash
270
+ hash = {}
271
+ self.class.attribute_map.each_pair do |attr, param|
272
+ value = self.send(attr)
273
+ next if value.nil?
274
+ hash[param] = _to_hash(value)
275
+ end
276
+ hash
277
+ end
278
+
279
+ # Outputs non-array value in the form of hash
280
+ # For object, use to_hash. Otherwise, just return the value
281
+ # @param [Object] value Any valid value
282
+ # @return [Hash] Returns the value in the form of hash
283
+ def _to_hash(value)
284
+ if value.is_a?(Array)
285
+ value.compact.map{ |v| _to_hash(v) }
286
+ elsif value.is_a?(Hash)
287
+ {}.tap do |hash|
288
+ value.each { |k, v| hash[k] = _to_hash(v) }
289
+ end
290
+ elsif value.respond_to? :to_hash
291
+ value.to_hash
292
+ else
293
+ value
294
+ end
295
+ end
296
+
297
+ end
298
+
299
+ end
@@ -0,0 +1,225 @@
1
+ =begin
2
+ #convertapi
3
+
4
+ #Convert API lets you effortlessly convert file formats and types.
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveConvertApiClient
16
+ # A single Excel XLSX file corresponding to one worksheet (tab) in the original spreadsheet
17
+ class PresentationResult
18
+ # Worksheet number of the converted page, starting with 1 for the left-most worksheet
19
+ attr_accessor :slide_number
20
+
21
+ # URL to the PPTX file of this slide; file is stored in an in-memory cache and will be deleted
22
+ attr_accessor :url
23
+
24
+ # Contents of the presentation in bytes
25
+ attr_accessor :presentation_contents
26
+
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'slide_number' => :'SlideNumber',
32
+ :'url' => :'URL',
33
+ :'presentation_contents' => :'PresentationContents'
34
+ }
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.swagger_types
39
+ {
40
+ :'slide_number' => :'Integer',
41
+ :'url' => :'String',
42
+ :'presentation_contents' => :'String'
43
+ }
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ return unless attributes.is_a?(Hash)
50
+
51
+ # convert string to symbol for hash key
52
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
53
+
54
+ if attributes.has_key?(:'SlideNumber')
55
+ self.slide_number = attributes[:'SlideNumber']
56
+ end
57
+
58
+ if attributes.has_key?(:'URL')
59
+ self.url = attributes[:'URL']
60
+ end
61
+
62
+ if attributes.has_key?(:'PresentationContents')
63
+ self.presentation_contents = attributes[:'PresentationContents']
64
+ end
65
+
66
+ end
67
+
68
+ # Show invalid properties with the reasons. Usually used together with valid?
69
+ # @return Array for valid properties with the reasons
70
+ def list_invalid_properties
71
+ invalid_properties = Array.new
72
+ if !@presentation_contents.nil? && @presentation_contents !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
73
+ invalid_properties.push("invalid value for 'presentation_contents', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.")
74
+ end
75
+
76
+ return invalid_properties
77
+ end
78
+
79
+ # Check to see if the all the properties in the model are valid
80
+ # @return true if the model is valid
81
+ def valid?
82
+ return false if !@presentation_contents.nil? && @presentation_contents !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
83
+ return true
84
+ end
85
+
86
+ # Custom attribute writer method with validation
87
+ # @param [Object] presentation_contents Value to be assigned
88
+ def presentation_contents=(presentation_contents)
89
+
90
+ if !presentation_contents.nil? && presentation_contents !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
91
+ fail ArgumentError, "invalid value for 'presentation_contents', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."
92
+ end
93
+
94
+ @presentation_contents = presentation_contents
95
+ end
96
+
97
+ # Checks equality by comparing each attribute.
98
+ # @param [Object] Object to be compared
99
+ def ==(o)
100
+ return true if self.equal?(o)
101
+ self.class == o.class &&
102
+ slide_number == o.slide_number &&
103
+ url == o.url &&
104
+ presentation_contents == o.presentation_contents
105
+ end
106
+
107
+ # @see the `==` method
108
+ # @param [Object] Object to be compared
109
+ def eql?(o)
110
+ self == o
111
+ end
112
+
113
+ # Calculates hash code according to all attributes.
114
+ # @return [Fixnum] Hash code
115
+ def hash
116
+ [slide_number, url, presentation_contents].hash
117
+ end
118
+
119
+ # Builds the object from hash
120
+ # @param [Hash] attributes Model attributes in the form of hash
121
+ # @return [Object] Returns the model itself
122
+ def build_from_hash(attributes)
123
+ return nil unless attributes.is_a?(Hash)
124
+ self.class.swagger_types.each_pair do |key, type|
125
+ if type =~ /\AArray<(.*)>/i
126
+ # check to ensure the input is an array given that the the attribute
127
+ # is documented as an array but the input is not
128
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
129
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
130
+ end
131
+ elsif !attributes[self.class.attribute_map[key]].nil?
132
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
133
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
134
+ end
135
+
136
+ self
137
+ end
138
+
139
+ # Deserializes the data based on type
140
+ # @param string type Data type
141
+ # @param string value Value to be deserialized
142
+ # @return [Object] Deserialized data
143
+ def _deserialize(type, value)
144
+ case type.to_sym
145
+ when :DateTime
146
+ DateTime.parse(value)
147
+ when :Date
148
+ Date.parse(value)
149
+ when :String
150
+ value.to_s
151
+ when :Integer
152
+ value.to_i
153
+ when :Float
154
+ value.to_f
155
+ when :BOOLEAN
156
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
157
+ true
158
+ else
159
+ false
160
+ end
161
+ when :Object
162
+ # generic object (usually a Hash), return directly
163
+ value
164
+ when /\AArray<(?<inner_type>.+)>\z/
165
+ inner_type = Regexp.last_match[:inner_type]
166
+ value.map { |v| _deserialize(inner_type, v) }
167
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
168
+ k_type = Regexp.last_match[:k_type]
169
+ v_type = Regexp.last_match[:v_type]
170
+ {}.tap do |hash|
171
+ value.each do |k, v|
172
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
173
+ end
174
+ end
175
+ else # model
176
+ temp_model = CloudmersiveConvertApiClient.const_get(type).new
177
+ temp_model.build_from_hash(value)
178
+ end
179
+ end
180
+
181
+ # Returns the string representation of the object
182
+ # @return [String] String presentation of the object
183
+ def to_s
184
+ to_hash.to_s
185
+ end
186
+
187
+ # to_body is an alias to to_hash (backward compatibility)
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_body
190
+ to_hash
191
+ end
192
+
193
+ # Returns the object in the form of hash
194
+ # @return [Hash] Returns the object in the form of hash
195
+ def to_hash
196
+ hash = {}
197
+ self.class.attribute_map.each_pair do |attr, param|
198
+ value = self.send(attr)
199
+ next if value.nil?
200
+ hash[param] = _to_hash(value)
201
+ end
202
+ hash
203
+ end
204
+
205
+ # Outputs non-array value in the form of hash
206
+ # For object, use to_hash. Otherwise, just return the value
207
+ # @param [Object] value Any valid value
208
+ # @return [Hash] Returns the value in the form of hash
209
+ def _to_hash(value)
210
+ if value.is_a?(Array)
211
+ value.compact.map{ |v| _to_hash(v) }
212
+ elsif value.is_a?(Hash)
213
+ {}.tap do |hash|
214
+ value.each { |k, v| hash[k] = _to_hash(v) }
215
+ end
216
+ elsif value.respond_to? :to_hash
217
+ value.to_hash
218
+ else
219
+ value
220
+ end
221
+ end
222
+
223
+ end
224
+
225
+ end