cloudmersive-convert-api-client 1.5.4 → 1.5.5

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 (29) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +10 -5
  3. data/docs/ConvertDataApi.md +59 -4
  4. data/docs/ConvertDocumentApi.md +55 -0
  5. data/docs/DocxInsertImageRequest.md +2 -0
  6. data/docs/EditDocumentApi.md +58 -3
  7. data/docs/GetXlsxCellRequest.md +12 -0
  8. data/docs/GetXlsxCellResponse.md +9 -0
  9. data/docs/GetXlsxColumnsResponse.md +1 -1
  10. data/docs/GetXlsxImagesResponse.md +1 -1
  11. data/docs/GetXlsxRowsAndCellsResponse.md +1 -1
  12. data/lib/cloudmersive-convert-api-client.rb +2 -0
  13. data/lib/cloudmersive-convert-api-client/api/convert_data_api.rb +59 -4
  14. data/lib/cloudmersive-convert-api-client/api/convert_document_api.rb +56 -0
  15. data/lib/cloudmersive-convert-api-client/api/edit_document_api.rb +57 -2
  16. data/lib/cloudmersive-convert-api-client/models/docx_insert_image_request.rb +24 -4
  17. data/lib/cloudmersive-convert-api-client/models/get_xlsx_cell_request.rb +245 -0
  18. data/lib/cloudmersive-convert-api-client/models/get_xlsx_cell_response.rb +199 -0
  19. data/lib/cloudmersive-convert-api-client/models/get_xlsx_columns_response.rb +1 -1
  20. data/lib/cloudmersive-convert-api-client/models/get_xlsx_images_response.rb +1 -1
  21. data/lib/cloudmersive-convert-api-client/models/get_xlsx_rows_and_cells_response.rb +1 -1
  22. data/lib/cloudmersive-convert-api-client/version.rb +1 -1
  23. data/spec/api/convert_data_api_spec.rb +12 -0
  24. data/spec/api/convert_document_api_spec.rb +12 -0
  25. data/spec/api/edit_document_api_spec.rb +13 -1
  26. data/spec/models/docx_insert_image_request_spec.rb +12 -0
  27. data/spec/models/get_xlsx_cell_request_spec.rb +66 -0
  28. data/spec/models/get_xlsx_cell_response_spec.rb +48 -0
  29. metadata +8 -2
@@ -692,6 +692,62 @@ module CloudmersiveConvertApiClient
692
692
  return data, status_code, headers
693
693
  end
694
694
 
695
+ # Convert PDF to Word DOCX Document based on rasterized version of the PDF
696
+ # Convert standard PDF to Office Word Documents (docx), but first rasterize the PDF. Converts a PDF at high fidelity into Word format.
697
+ # @param input_file Input file to perform the operation on.
698
+ # @param [Hash] opts the optional parameters
699
+ # @return [String]
700
+ def convert_document_pdf_to_docx_rasterize(input_file, opts = {})
701
+ data, _status_code, _headers = convert_document_pdf_to_docx_rasterize_with_http_info(input_file, opts)
702
+ return data
703
+ end
704
+
705
+ # Convert PDF to Word DOCX Document based on rasterized version of the PDF
706
+ # Convert standard PDF to Office Word Documents (docx), but first rasterize the PDF. Converts a PDF at high fidelity into Word format.
707
+ # @param input_file Input file to perform the operation on.
708
+ # @param [Hash] opts the optional parameters
709
+ # @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
710
+ def convert_document_pdf_to_docx_rasterize_with_http_info(input_file, opts = {})
711
+ if @api_client.config.debugging
712
+ @api_client.config.logger.debug "Calling API: ConvertDocumentApi.convert_document_pdf_to_docx_rasterize ..."
713
+ end
714
+ # verify the required parameter 'input_file' is set
715
+ if @api_client.config.client_side_validation && input_file.nil?
716
+ fail ArgumentError, "Missing the required parameter 'input_file' when calling ConvertDocumentApi.convert_document_pdf_to_docx_rasterize"
717
+ end
718
+ # resource path
719
+ local_var_path = "/convert/pdf/to/docx/rasterize"
720
+
721
+ # query parameters
722
+ query_params = {}
723
+
724
+ # header parameters
725
+ header_params = {}
726
+ # HTTP header 'Accept' (if needed)
727
+ header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
728
+ # HTTP header 'Content-Type'
729
+ header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
730
+
731
+ # form parameters
732
+ form_params = {}
733
+ form_params["inputFile"] = input_file
734
+
735
+ # http body (model)
736
+ post_body = nil
737
+ auth_names = ['Apikey']
738
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
739
+ :header_params => header_params,
740
+ :query_params => query_params,
741
+ :form_params => form_params,
742
+ :body => post_body,
743
+ :auth_names => auth_names,
744
+ :return_type => 'String')
745
+ if @api_client.config.debugging
746
+ @api_client.config.logger.debug "API called: ConvertDocumentApi#convert_document_pdf_to_docx_rasterize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
747
+ end
748
+ return data, status_code, headers
749
+ end
750
+
695
751
  # Convert PDF to PNG Image Array
696
752
  # Convert PDF document to PNG array, one image per page.
697
753
  # @param input_file Input file to perform the operation on.
@@ -1561,6 +1561,61 @@ module CloudmersiveConvertApiClient
1561
1561
  return data, status_code, headers
1562
1562
  end
1563
1563
 
1564
+ # Get cell from an Excel XLSX spreadsheet, worksheet by index
1565
+ # Returns the rows and cells defined in the Excel Spreadsheet worksheet
1566
+ # @param input Document input request
1567
+ # @param [Hash] opts the optional parameters
1568
+ # @return [GetXlsxCellResponse]
1569
+ def edit_document_xlsx_get_cell_by_index(input, opts = {})
1570
+ data, _status_code, _headers = edit_document_xlsx_get_cell_by_index_with_http_info(input, opts)
1571
+ return data
1572
+ end
1573
+
1574
+ # Get cell from an Excel XLSX spreadsheet, worksheet by index
1575
+ # Returns the rows and cells defined in the Excel Spreadsheet worksheet
1576
+ # @param input Document input request
1577
+ # @param [Hash] opts the optional parameters
1578
+ # @return [Array<(GetXlsxCellResponse, Fixnum, Hash)>] GetXlsxCellResponse data, response status code and response headers
1579
+ def edit_document_xlsx_get_cell_by_index_with_http_info(input, opts = {})
1580
+ if @api_client.config.debugging
1581
+ @api_client.config.logger.debug "Calling API: EditDocumentApi.edit_document_xlsx_get_cell_by_index ..."
1582
+ end
1583
+ # verify the required parameter 'input' is set
1584
+ if @api_client.config.client_side_validation && input.nil?
1585
+ fail ArgumentError, "Missing the required parameter 'input' when calling EditDocumentApi.edit_document_xlsx_get_cell_by_index"
1586
+ end
1587
+ # resource path
1588
+ local_var_path = "/convert/edit/xlsx/get-cell/by-index"
1589
+
1590
+ # query parameters
1591
+ query_params = {}
1592
+
1593
+ # header parameters
1594
+ header_params = {}
1595
+ # HTTP header 'Accept' (if needed)
1596
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
1597
+ # HTTP header 'Content-Type'
1598
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
1599
+
1600
+ # form parameters
1601
+ form_params = {}
1602
+
1603
+ # http body (model)
1604
+ post_body = @api_client.object_to_http_body(input)
1605
+ auth_names = ['Apikey']
1606
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
1607
+ :header_params => header_params,
1608
+ :query_params => query_params,
1609
+ :form_params => form_params,
1610
+ :body => post_body,
1611
+ :auth_names => auth_names,
1612
+ :return_type => 'GetXlsxCellResponse')
1613
+ if @api_client.config.debugging
1614
+ @api_client.config.logger.debug "API called: EditDocumentApi#edit_document_xlsx_get_cell_by_index\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1615
+ end
1616
+ return data, status_code, headers
1617
+ end
1618
+
1564
1619
  # Get rows and cells from a Excel XLSX spreadsheet, worksheet
1565
1620
  # Returns the rows and cells defined in the Excel Spreadsheet worksheet
1566
1621
  # @param input Document input request
@@ -1671,7 +1726,7 @@ module CloudmersiveConvertApiClient
1671
1726
  return data, status_code, headers
1672
1727
  end
1673
1728
 
1674
- # Get rows and cells from a Word XLSX spreadsheet, worksheet
1729
+ # Get rows and cells from a Excel XLSX spreadsheet, worksheet
1675
1730
  # Returns the rows and cells defined in the Excel Spreadsheet worksheet
1676
1731
  # @param input Document input request
1677
1732
  # @param [Hash] opts the optional parameters
@@ -1681,7 +1736,7 @@ module CloudmersiveConvertApiClient
1681
1736
  return data
1682
1737
  end
1683
1738
 
1684
- # Get rows and cells from a Word XLSX spreadsheet, worksheet
1739
+ # Get rows and cells from a Excel XLSX spreadsheet, worksheet
1685
1740
  # Returns the rows and cells defined in the Excel Spreadsheet worksheet
1686
1741
  # @param input Document input request
1687
1742
  # @param [Hash] opts the optional parameters
@@ -36,6 +36,12 @@ module CloudmersiveConvertApiClient
36
36
  # Optional; location within the document to insert the object; fill in the InsertPath field using the Path value from an existing object. Used with InsertPlacement of BeforeExistingObject or AfterExistingObject
37
37
  attr_accessor :insert_path
38
38
 
39
+ # Optional: The width of the image in EMUs
40
+ attr_accessor :width_in_em_us
41
+
42
+ # Optional: The height of the image in EMUs
43
+ attr_accessor :height_in_em_us
44
+
39
45
 
40
46
  # Attribute mapping from ruby-style variable name to JSON key.
41
47
  def self.attribute_map
@@ -46,7 +52,9 @@ module CloudmersiveConvertApiClient
46
52
  :'input_image_file_url' => :'InputImageFileUrl',
47
53
  :'image_to_add' => :'ImageToAdd',
48
54
  :'insert_placement' => :'InsertPlacement',
49
- :'insert_path' => :'InsertPath'
55
+ :'insert_path' => :'InsertPath',
56
+ :'width_in_em_us' => :'WidthInEMUs',
57
+ :'height_in_em_us' => :'HeightInEMUs'
50
58
  }
51
59
  end
52
60
 
@@ -59,7 +67,9 @@ module CloudmersiveConvertApiClient
59
67
  :'input_image_file_url' => :'String',
60
68
  :'image_to_add' => :'DocxImage',
61
69
  :'insert_placement' => :'String',
62
- :'insert_path' => :'String'
70
+ :'insert_path' => :'String',
71
+ :'width_in_em_us' => :'Integer',
72
+ :'height_in_em_us' => :'Integer'
63
73
  }
64
74
  end
65
75
 
@@ -99,6 +109,14 @@ module CloudmersiveConvertApiClient
99
109
  self.insert_path = attributes[:'InsertPath']
100
110
  end
101
111
 
112
+ if attributes.has_key?(:'WidthInEMUs')
113
+ self.width_in_em_us = attributes[:'WidthInEMUs']
114
+ end
115
+
116
+ if attributes.has_key?(:'HeightInEMUs')
117
+ self.height_in_em_us = attributes[:'HeightInEMUs']
118
+ end
119
+
102
120
  end
103
121
 
104
122
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -157,7 +175,9 @@ module CloudmersiveConvertApiClient
157
175
  input_image_file_url == o.input_image_file_url &&
158
176
  image_to_add == o.image_to_add &&
159
177
  insert_placement == o.insert_placement &&
160
- insert_path == o.insert_path
178
+ insert_path == o.insert_path &&
179
+ width_in_em_us == o.width_in_em_us &&
180
+ height_in_em_us == o.height_in_em_us
161
181
  end
162
182
 
163
183
  # @see the `==` method
@@ -169,7 +189,7 @@ module CloudmersiveConvertApiClient
169
189
  # Calculates hash code according to all attributes.
170
190
  # @return [Fixnum] Hash code
171
191
  def hash
172
- [input_document_file_bytes, input_document_file_url, input_image_file_bytes, input_image_file_url, image_to_add, insert_placement, insert_path].hash
192
+ [input_document_file_bytes, input_document_file_url, input_image_file_bytes, input_image_file_url, image_to_add, insert_placement, insert_path, width_in_em_us, height_in_em_us].hash
173
193
  end
174
194
 
175
195
  # Builds the object from hash
@@ -0,0 +1,245 @@
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
+ # Input to a Get Cell request
17
+ class GetXlsxCellRequest
18
+ # Optional: Bytes of the input file to operate on
19
+ attr_accessor :input_file_bytes
20
+
21
+ # Optional: URL of a file to operate on as input. This can be a public URL, or you can also use the begin-editing API to upload a document and pass in the secure URL result from that operation as the URL here (this URL is not public).
22
+ attr_accessor :input_file_url
23
+
24
+ # Optional; Worksheet (tab) within the spreadsheet to get the rows and cells of; leave blank to default to the first worksheet
25
+ attr_accessor :worksheet_to_query
26
+
27
+ # 0-based index of the row, 0, 1, 2, ... to retrieve
28
+ attr_accessor :row_index
29
+
30
+ # 0-based index of the cell, 0, 1, 2, ... in the row to retrieve
31
+ attr_accessor :cell_index
32
+
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'input_file_bytes' => :'InputFileBytes',
38
+ :'input_file_url' => :'InputFileUrl',
39
+ :'worksheet_to_query' => :'WorksheetToQuery',
40
+ :'row_index' => :'RowIndex',
41
+ :'cell_index' => :'CellIndex'
42
+ }
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.swagger_types
47
+ {
48
+ :'input_file_bytes' => :'String',
49
+ :'input_file_url' => :'String',
50
+ :'worksheet_to_query' => :'XlsxWorksheet',
51
+ :'row_index' => :'Integer',
52
+ :'cell_index' => :'Integer'
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.has_key?(:'InputFileBytes')
65
+ self.input_file_bytes = attributes[:'InputFileBytes']
66
+ end
67
+
68
+ if attributes.has_key?(:'InputFileUrl')
69
+ self.input_file_url = attributes[:'InputFileUrl']
70
+ end
71
+
72
+ if attributes.has_key?(:'WorksheetToQuery')
73
+ self.worksheet_to_query = attributes[:'WorksheetToQuery']
74
+ end
75
+
76
+ if attributes.has_key?(:'RowIndex')
77
+ self.row_index = attributes[:'RowIndex']
78
+ end
79
+
80
+ if attributes.has_key?(:'CellIndex')
81
+ self.cell_index = attributes[:'CellIndex']
82
+ end
83
+
84
+ end
85
+
86
+ # Show invalid properties with the reasons. Usually used together with valid?
87
+ # @return Array for valid properties with the reasons
88
+ def list_invalid_properties
89
+ invalid_properties = Array.new
90
+ 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}=)?$/)
91
+ 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}=)?$/.")
92
+ end
93
+
94
+ return invalid_properties
95
+ end
96
+
97
+ # Check to see if the all the properties in the model are valid
98
+ # @return true if the model is valid
99
+ def valid?
100
+ 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}=)?$/)
101
+ return true
102
+ end
103
+
104
+ # Custom attribute writer method with validation
105
+ # @param [Object] input_file_bytes Value to be assigned
106
+ def input_file_bytes=(input_file_bytes)
107
+
108
+ 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}=)?$/)
109
+ 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}=)?$/."
110
+ end
111
+
112
+ @input_file_bytes = input_file_bytes
113
+ end
114
+
115
+ # Checks equality by comparing each attribute.
116
+ # @param [Object] Object to be compared
117
+ def ==(o)
118
+ return true if self.equal?(o)
119
+ self.class == o.class &&
120
+ input_file_bytes == o.input_file_bytes &&
121
+ input_file_url == o.input_file_url &&
122
+ worksheet_to_query == o.worksheet_to_query &&
123
+ row_index == o.row_index &&
124
+ cell_index == o.cell_index
125
+ end
126
+
127
+ # @see the `==` method
128
+ # @param [Object] Object to be compared
129
+ def eql?(o)
130
+ self == o
131
+ end
132
+
133
+ # Calculates hash code according to all attributes.
134
+ # @return [Fixnum] Hash code
135
+ def hash
136
+ [input_file_bytes, input_file_url, worksheet_to_query, row_index, cell_index].hash
137
+ end
138
+
139
+ # Builds the object from hash
140
+ # @param [Hash] attributes Model attributes in the form of hash
141
+ # @return [Object] Returns the model itself
142
+ def build_from_hash(attributes)
143
+ return nil unless attributes.is_a?(Hash)
144
+ self.class.swagger_types.each_pair do |key, type|
145
+ if type =~ /\AArray<(.*)>/i
146
+ # check to ensure the input is an array given that the the attribute
147
+ # is documented as an array but the input is not
148
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
149
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
150
+ end
151
+ elsif !attributes[self.class.attribute_map[key]].nil?
152
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
153
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
154
+ end
155
+
156
+ self
157
+ end
158
+
159
+ # Deserializes the data based on type
160
+ # @param string type Data type
161
+ # @param string value Value to be deserialized
162
+ # @return [Object] Deserialized data
163
+ def _deserialize(type, value)
164
+ case type.to_sym
165
+ when :DateTime
166
+ DateTime.parse(value)
167
+ when :Date
168
+ Date.parse(value)
169
+ when :String
170
+ value.to_s
171
+ when :Integer
172
+ value.to_i
173
+ when :Float
174
+ value.to_f
175
+ when :BOOLEAN
176
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
177
+ true
178
+ else
179
+ false
180
+ end
181
+ when :Object
182
+ # generic object (usually a Hash), return directly
183
+ value
184
+ when /\AArray<(?<inner_type>.+)>\z/
185
+ inner_type = Regexp.last_match[:inner_type]
186
+ value.map { |v| _deserialize(inner_type, v) }
187
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
188
+ k_type = Regexp.last_match[:k_type]
189
+ v_type = Regexp.last_match[:v_type]
190
+ {}.tap do |hash|
191
+ value.each do |k, v|
192
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
193
+ end
194
+ end
195
+ else # model
196
+ temp_model = CloudmersiveConvertApiClient.const_get(type).new
197
+ temp_model.build_from_hash(value)
198
+ end
199
+ end
200
+
201
+ # Returns the string representation of the object
202
+ # @return [String] String presentation of the object
203
+ def to_s
204
+ to_hash.to_s
205
+ end
206
+
207
+ # to_body is an alias to to_hash (backward compatibility)
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_body
210
+ to_hash
211
+ end
212
+
213
+ # Returns the object in the form of hash
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_hash
216
+ hash = {}
217
+ self.class.attribute_map.each_pair do |attr, param|
218
+ value = self.send(attr)
219
+ next if value.nil?
220
+ hash[param] = _to_hash(value)
221
+ end
222
+ hash
223
+ end
224
+
225
+ # Outputs non-array value in the form of hash
226
+ # For object, use to_hash. Otherwise, just return the value
227
+ # @param [Object] value Any valid value
228
+ # @return [Hash] Returns the value in the form of hash
229
+ def _to_hash(value)
230
+ if value.is_a?(Array)
231
+ value.compact.map{ |v| _to_hash(v) }
232
+ elsif value.is_a?(Hash)
233
+ {}.tap do |hash|
234
+ value.each { |k, v| hash[k] = _to_hash(v) }
235
+ end
236
+ elsif value.respond_to? :to_hash
237
+ value.to_hash
238
+ else
239
+ value
240
+ end
241
+ end
242
+
243
+ end
244
+
245
+ end