cloudmersive-convert-api-client 1.5.8 → 1.5.9

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.
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
@@ -79,10 +79,70 @@ module CloudmersiveConvertApiClient
79
79
  return data, status_code, headers
80
80
  end
81
81
 
82
+ # Split a single PowerPoint Presentation PPTX into Separate Slides
83
+ # Split an PowerPoint PPTX Presentation, comprised of multiple slides into separate PowerPoint PPTX presentation files, with each containing exactly one slide.
84
+ # @param input_file Input file to perform the operation on.
85
+ # @param [Hash] opts the optional parameters
86
+ # @option opts [BOOLEAN] :return_document_contents Set to true to return the contents of each Worksheet directly, set to false to only return URLs to each resulting worksheet. Default is true.
87
+ # @return [SplitPptxPresentationResult]
88
+ def split_document_pptx(input_file, opts = {})
89
+ data, _status_code, _headers = split_document_pptx_with_http_info(input_file, opts)
90
+ return data
91
+ end
92
+
93
+ # Split a single PowerPoint Presentation PPTX into Separate Slides
94
+ # Split an PowerPoint PPTX Presentation, comprised of multiple slides into separate PowerPoint PPTX presentation files, with each containing exactly one slide.
95
+ # @param input_file Input file to perform the operation on.
96
+ # @param [Hash] opts the optional parameters
97
+ # @option opts [BOOLEAN] :return_document_contents Set to true to return the contents of each Worksheet directly, set to false to only return URLs to each resulting worksheet. Default is true.
98
+ # @return [Array<(SplitPptxPresentationResult, Fixnum, Hash)>] SplitPptxPresentationResult data, response status code and response headers
99
+ def split_document_pptx_with_http_info(input_file, opts = {})
100
+ if @api_client.config.debugging
101
+ @api_client.config.logger.debug "Calling API: SplitDocumentApi.split_document_pptx ..."
102
+ end
103
+ # verify the required parameter 'input_file' is set
104
+ if @api_client.config.client_side_validation && input_file.nil?
105
+ fail ArgumentError, "Missing the required parameter 'input_file' when calling SplitDocumentApi.split_document_pptx"
106
+ end
107
+ # resource path
108
+ local_var_path = "/convert/split/pptx"
109
+
110
+ # query parameters
111
+ query_params = {}
112
+
113
+ # header parameters
114
+ header_params = {}
115
+ # HTTP header 'Accept' (if needed)
116
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
117
+ # HTTP header 'Content-Type'
118
+ header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
119
+ header_params[:'returnDocumentContents'] = opts[:'return_document_contents'] if !opts[:'return_document_contents'].nil?
120
+
121
+ # form parameters
122
+ form_params = {}
123
+ form_params["inputFile"] = input_file
124
+
125
+ # http body (model)
126
+ post_body = nil
127
+ auth_names = ['Apikey']
128
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
129
+ :header_params => header_params,
130
+ :query_params => query_params,
131
+ :form_params => form_params,
132
+ :body => post_body,
133
+ :auth_names => auth_names,
134
+ :return_type => 'SplitPptxPresentationResult')
135
+ if @api_client.config.debugging
136
+ @api_client.config.logger.debug "API called: SplitDocumentApi#split_document_pptx\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
137
+ end
138
+ return data, status_code, headers
139
+ end
140
+
82
141
  # Split a single Excel XLSX into Separate Worksheets
83
142
  # Split an Excel XLSX Spreadsheet, comprised of multiple Worksheets (or Tabs) into separate Excel XLSX spreadsheet files, with each containing exactly one Worksheet.
84
143
  # @param input_file Input file to perform the operation on.
85
144
  # @param [Hash] opts the optional parameters
145
+ # @option opts [BOOLEAN] :return_document_contents Set to true to return the contents of each Worksheet directly, set to false to only return URLs to each resulting worksheet. Default is true.
86
146
  # @return [SplitXlsxWorksheetResult]
87
147
  def split_document_xlsx(input_file, opts = {})
88
148
  data, _status_code, _headers = split_document_xlsx_with_http_info(input_file, opts)
@@ -93,6 +153,7 @@ module CloudmersiveConvertApiClient
93
153
  # Split an Excel XLSX Spreadsheet, comprised of multiple Worksheets (or Tabs) into separate Excel XLSX spreadsheet files, with each containing exactly one Worksheet.
94
154
  # @param input_file Input file to perform the operation on.
95
155
  # @param [Hash] opts the optional parameters
156
+ # @option opts [BOOLEAN] :return_document_contents Set to true to return the contents of each Worksheet directly, set to false to only return URLs to each resulting worksheet. Default is true.
96
157
  # @return [Array<(SplitXlsxWorksheetResult, Fixnum, Hash)>] SplitXlsxWorksheetResult data, response status code and response headers
97
158
  def split_document_xlsx_with_http_info(input_file, opts = {})
98
159
  if @api_client.config.debugging
@@ -114,6 +175,7 @@ module CloudmersiveConvertApiClient
114
175
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
115
176
  # HTTP header 'Content-Type'
116
177
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
178
+ header_params[:'returnDocumentContents'] = opts[:'return_document_contents'] if !opts[:'return_document_contents'].nil?
117
179
 
118
180
  # form parameters
119
181
  form_params = {}
@@ -0,0 +1,217 @@
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
+ # Request to add annotations to a PDF
17
+ class AddPdfAnnotationRequest
18
+ # Input file contents bytes for the file to modify
19
+ attr_accessor :input_file_bytes
20
+
21
+ # Annotations to add to the PDF file
22
+ attr_accessor :annotations_to_add
23
+
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'input_file_bytes' => :'InputFileBytes',
29
+ :'annotations_to_add' => :'AnnotationsToAdd'
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.swagger_types
35
+ {
36
+ :'input_file_bytes' => :'String',
37
+ :'annotations_to_add' => :'Array<PdfAnnotation>'
38
+ }
39
+ end
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ def initialize(attributes = {})
44
+ return unless attributes.is_a?(Hash)
45
+
46
+ # convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
48
+
49
+ if attributes.has_key?(:'InputFileBytes')
50
+ self.input_file_bytes = attributes[:'InputFileBytes']
51
+ end
52
+
53
+ if attributes.has_key?(:'AnnotationsToAdd')
54
+ if (value = attributes[:'AnnotationsToAdd']).is_a?(Array)
55
+ self.annotations_to_add = value
56
+ end
57
+ end
58
+
59
+ end
60
+
61
+ # Show invalid properties with the reasons. Usually used together with valid?
62
+ # @return Array for valid properties with the reasons
63
+ def list_invalid_properties
64
+ invalid_properties = Array.new
65
+ if !@input_file_bytes.nil? && @input_file_bytes !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
66
+ invalid_properties.push("invalid value for 'input_file_bytes', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.")
67
+ end
68
+
69
+ return invalid_properties
70
+ end
71
+
72
+ # Check to see if the all the properties in the model are valid
73
+ # @return true if the model is valid
74
+ def valid?
75
+ return false if !@input_file_bytes.nil? && @input_file_bytes !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
76
+ return true
77
+ end
78
+
79
+ # Custom attribute writer method with validation
80
+ # @param [Object] input_file_bytes Value to be assigned
81
+ def input_file_bytes=(input_file_bytes)
82
+
83
+ if !input_file_bytes.nil? && input_file_bytes !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
84
+ fail ArgumentError, "invalid value for 'input_file_bytes', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."
85
+ end
86
+
87
+ @input_file_bytes = input_file_bytes
88
+ end
89
+
90
+ # Checks equality by comparing each attribute.
91
+ # @param [Object] Object to be compared
92
+ def ==(o)
93
+ return true if self.equal?(o)
94
+ self.class == o.class &&
95
+ input_file_bytes == o.input_file_bytes &&
96
+ annotations_to_add == o.annotations_to_add
97
+ end
98
+
99
+ # @see the `==` method
100
+ # @param [Object] Object to be compared
101
+ def eql?(o)
102
+ self == o
103
+ end
104
+
105
+ # Calculates hash code according to all attributes.
106
+ # @return [Fixnum] Hash code
107
+ def hash
108
+ [input_file_bytes, annotations_to_add].hash
109
+ end
110
+
111
+ # Builds the object from hash
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ # @return [Object] Returns the model itself
114
+ def build_from_hash(attributes)
115
+ return nil unless attributes.is_a?(Hash)
116
+ self.class.swagger_types.each_pair do |key, type|
117
+ if type =~ /\AArray<(.*)>/i
118
+ # check to ensure the input is an array given that the the attribute
119
+ # is documented as an array but the input is not
120
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
121
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
122
+ end
123
+ elsif !attributes[self.class.attribute_map[key]].nil?
124
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
125
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
126
+ end
127
+
128
+ self
129
+ end
130
+
131
+ # Deserializes the data based on type
132
+ # @param string type Data type
133
+ # @param string value Value to be deserialized
134
+ # @return [Object] Deserialized data
135
+ def _deserialize(type, value)
136
+ case type.to_sym
137
+ when :DateTime
138
+ DateTime.parse(value)
139
+ when :Date
140
+ Date.parse(value)
141
+ when :String
142
+ value.to_s
143
+ when :Integer
144
+ value.to_i
145
+ when :Float
146
+ value.to_f
147
+ when :BOOLEAN
148
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
149
+ true
150
+ else
151
+ false
152
+ end
153
+ when :Object
154
+ # generic object (usually a Hash), return directly
155
+ value
156
+ when /\AArray<(?<inner_type>.+)>\z/
157
+ inner_type = Regexp.last_match[:inner_type]
158
+ value.map { |v| _deserialize(inner_type, v) }
159
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
160
+ k_type = Regexp.last_match[:k_type]
161
+ v_type = Regexp.last_match[:v_type]
162
+ {}.tap do |hash|
163
+ value.each do |k, v|
164
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
165
+ end
166
+ end
167
+ else # model
168
+ temp_model = CloudmersiveConvertApiClient.const_get(type).new
169
+ temp_model.build_from_hash(value)
170
+ end
171
+ end
172
+
173
+ # Returns the string representation of the object
174
+ # @return [String] String presentation of the object
175
+ def to_s
176
+ to_hash.to_s
177
+ end
178
+
179
+ # to_body is an alias to to_hash (backward compatibility)
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_body
182
+ to_hash
183
+ end
184
+
185
+ # Returns the object in the form of hash
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_hash
188
+ hash = {}
189
+ self.class.attribute_map.each_pair do |attr, param|
190
+ value = self.send(attr)
191
+ next if value.nil?
192
+ hash[param] = _to_hash(value)
193
+ end
194
+ hash
195
+ end
196
+
197
+ # Outputs non-array value in the form of hash
198
+ # For object, use to_hash. Otherwise, just return the value
199
+ # @param [Object] value Any valid value
200
+ # @return [Hash] Returns the value in the form of hash
201
+ def _to_hash(value)
202
+ if value.is_a?(Array)
203
+ value.compact.map{ |v| _to_hash(v) }
204
+ elsif value.is_a?(Hash)
205
+ {}.tap do |hash|
206
+ value.each { |k, v| hash[k] = _to_hash(v) }
207
+ end
208
+ elsif value.respond_to? :to_hash
209
+ value.to_hash
210
+ else
211
+ value
212
+ end
213
+ end
214
+
215
+ end
216
+
217
+ end
@@ -0,0 +1,201 @@
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
+ # Result of retrieving annotations from a PDF document
17
+ class GetPdfAnnotationsResult
18
+ # True if successful, false otherwise
19
+ attr_accessor :successful
20
+
21
+ # Annotations in the PDF file, ordered by placement from start to finish in the document
22
+ attr_accessor :annotations
23
+
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'successful' => :'Successful',
29
+ :'annotations' => :'Annotations'
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.swagger_types
35
+ {
36
+ :'successful' => :'BOOLEAN',
37
+ :'annotations' => :'Array<PdfAnnotation>'
38
+ }
39
+ end
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ def initialize(attributes = {})
44
+ return unless attributes.is_a?(Hash)
45
+
46
+ # convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
48
+
49
+ if attributes.has_key?(:'Successful')
50
+ self.successful = attributes[:'Successful']
51
+ end
52
+
53
+ if attributes.has_key?(:'Annotations')
54
+ if (value = attributes[:'Annotations']).is_a?(Array)
55
+ self.annotations = value
56
+ end
57
+ end
58
+
59
+ end
60
+
61
+ # Show invalid properties with the reasons. Usually used together with valid?
62
+ # @return Array for valid properties with the reasons
63
+ def list_invalid_properties
64
+ invalid_properties = Array.new
65
+ return invalid_properties
66
+ end
67
+
68
+ # Check to see if the all the properties in the model are valid
69
+ # @return true if the model is valid
70
+ def valid?
71
+ return true
72
+ end
73
+
74
+ # Checks equality by comparing each attribute.
75
+ # @param [Object] Object to be compared
76
+ def ==(o)
77
+ return true if self.equal?(o)
78
+ self.class == o.class &&
79
+ successful == o.successful &&
80
+ annotations == o.annotations
81
+ end
82
+
83
+ # @see the `==` method
84
+ # @param [Object] Object to be compared
85
+ def eql?(o)
86
+ self == o
87
+ end
88
+
89
+ # Calculates hash code according to all attributes.
90
+ # @return [Fixnum] Hash code
91
+ def hash
92
+ [successful, annotations].hash
93
+ end
94
+
95
+ # Builds the object from hash
96
+ # @param [Hash] attributes Model attributes in the form of hash
97
+ # @return [Object] Returns the model itself
98
+ def build_from_hash(attributes)
99
+ return nil unless attributes.is_a?(Hash)
100
+ self.class.swagger_types.each_pair do |key, type|
101
+ if type =~ /\AArray<(.*)>/i
102
+ # check to ensure the input is an array given that the the attribute
103
+ # is documented as an array but the input is not
104
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
105
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
106
+ end
107
+ elsif !attributes[self.class.attribute_map[key]].nil?
108
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
109
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
110
+ end
111
+
112
+ self
113
+ end
114
+
115
+ # Deserializes the data based on type
116
+ # @param string type Data type
117
+ # @param string value Value to be deserialized
118
+ # @return [Object] Deserialized data
119
+ def _deserialize(type, value)
120
+ case type.to_sym
121
+ when :DateTime
122
+ DateTime.parse(value)
123
+ when :Date
124
+ Date.parse(value)
125
+ when :String
126
+ value.to_s
127
+ when :Integer
128
+ value.to_i
129
+ when :Float
130
+ value.to_f
131
+ when :BOOLEAN
132
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
133
+ true
134
+ else
135
+ false
136
+ end
137
+ when :Object
138
+ # generic object (usually a Hash), return directly
139
+ value
140
+ when /\AArray<(?<inner_type>.+)>\z/
141
+ inner_type = Regexp.last_match[:inner_type]
142
+ value.map { |v| _deserialize(inner_type, v) }
143
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
144
+ k_type = Regexp.last_match[:k_type]
145
+ v_type = Regexp.last_match[:v_type]
146
+ {}.tap do |hash|
147
+ value.each do |k, v|
148
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
149
+ end
150
+ end
151
+ else # model
152
+ temp_model = CloudmersiveConvertApiClient.const_get(type).new
153
+ temp_model.build_from_hash(value)
154
+ end
155
+ end
156
+
157
+ # Returns the string representation of the object
158
+ # @return [String] String presentation of the object
159
+ def to_s
160
+ to_hash.to_s
161
+ end
162
+
163
+ # to_body is an alias to to_hash (backward compatibility)
164
+ # @return [Hash] Returns the object in the form of hash
165
+ def to_body
166
+ to_hash
167
+ end
168
+
169
+ # Returns the object in the form of hash
170
+ # @return [Hash] Returns the object in the form of hash
171
+ def to_hash
172
+ hash = {}
173
+ self.class.attribute_map.each_pair do |attr, param|
174
+ value = self.send(attr)
175
+ next if value.nil?
176
+ hash[param] = _to_hash(value)
177
+ end
178
+ hash
179
+ end
180
+
181
+ # Outputs non-array value in the form of hash
182
+ # For object, use to_hash. Otherwise, just return the value
183
+ # @param [Object] value Any valid value
184
+ # @return [Hash] Returns the value in the form of hash
185
+ def _to_hash(value)
186
+ if value.is_a?(Array)
187
+ value.compact.map{ |v| _to_hash(v) }
188
+ elsif value.is_a?(Hash)
189
+ {}.tap do |hash|
190
+ value.each { |k, v| hash[k] = _to_hash(v) }
191
+ end
192
+ elsif value.respond_to? :to_hash
193
+ value.to_hash
194
+ else
195
+ value
196
+ end
197
+ end
198
+
199
+ end
200
+
201
+ end