cloudmersive-convert-api-client 1.2.9 → 1.3.1
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.
- checksums.yaml +4 -4
- data/README.md +7 -4
- data/docs/AlternateFileFormatCandidate.md +10 -0
- data/docs/AutodetectGetInfoResult.md +11 -0
- data/docs/ConvertDocumentApi.md +55 -0
- data/docs/DocxImage.md +1 -1
- data/lib/cloudmersive-convert-api-client.rb +2 -0
- data/lib/cloudmersive-convert-api-client/api/convert_document_api.rb +56 -0
- data/lib/cloudmersive-convert-api-client/models/alternate_file_format_candidate.rb +209 -0
- data/lib/cloudmersive-convert-api-client/models/autodetect_get_info_result.rb +221 -0
- data/lib/cloudmersive-convert-api-client/models/docx_image.rb +7 -7
- data/lib/cloudmersive-convert-api-client/version.rb +1 -1
- data/spec/api/convert_document_api_spec.rb +12 -0
- data/spec/models/alternate_file_format_candidate_spec.rb +54 -0
- data/spec/models/autodetect_get_info_result_spec.rb +60 -0
- data/spec/models/docx_image_spec.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 833bc0da807f8c74578f0507fb03b9a09146db1fc3f2e4ac7fb69d21af436c80
|
4
|
+
data.tar.gz: 1c5f5e2c7d727019c7f64eedee82ff4af3cea72675633bc82e032a3ff30a2635
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fa0a42e167151c0d31a99d6ed947869999e7a8aad72af87caebe2e42ccd0e192793921074950b866aba80300d25c76bb50354db09313b61e21bdf46b9cdf012
|
7
|
+
data.tar.gz: 3af85f73a846e216567e11316874593f5931ddf4d96d9b7c351ed6b55f268b480844294eeb5f152c660035eb4051ee5aad56fb9322c365a3007f24d593300274
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ Convert API lets you effortlessly convert file formats and types.
|
|
7
7
|
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
8
8
|
|
9
9
|
- API version: v1
|
10
|
-
- Package version: 1.
|
10
|
+
- Package version: 1.3.1
|
11
11
|
- Build package: io.swagger.codegen.languages.RubyClientCodegen
|
12
12
|
|
13
13
|
## Installation
|
@@ -23,15 +23,15 @@ gem build cloudmersive-convert-api-client.gemspec
|
|
23
23
|
Then either install the gem locally:
|
24
24
|
|
25
25
|
```shell
|
26
|
-
gem install ./cloudmersive-convert-api-client-1.
|
26
|
+
gem install ./cloudmersive-convert-api-client-1.3.1.gem
|
27
27
|
```
|
28
|
-
(for development, run `gem install --dev ./cloudmersive-convert-api-client-1.
|
28
|
+
(for development, run `gem install --dev ./cloudmersive-convert-api-client-1.3.1.gem` to install the development dependencies)
|
29
29
|
|
30
30
|
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
31
31
|
|
32
32
|
Finally add this to the Gemfile:
|
33
33
|
|
34
|
-
gem 'cloudmersive-convert-api-client', '~> 1.
|
34
|
+
gem 'cloudmersive-convert-api-client', '~> 1.3.1'
|
35
35
|
|
36
36
|
### Install from Git
|
37
37
|
|
@@ -88,6 +88,7 @@ Class | Method | HTTP request | Description
|
|
88
88
|
*CloudmersiveConvertApiClient::CompareDocumentApi* | [**compare_document_docx**](docs/CompareDocumentApi.md#compare_document_docx) | **POST** /convert/compare/docx | Compare Two Word DOCX
|
89
89
|
*CloudmersiveConvertApiClient::ConvertDataApi* | [**convert_data_csv_to_json**](docs/ConvertDataApi.md#convert_data_csv_to_json) | **POST** /convert/csv/to/json | CSV to JSON conversion
|
90
90
|
*CloudmersiveConvertApiClient::ConvertDataApi* | [**convert_data_xml_to_json**](docs/ConvertDataApi.md#convert_data_xml_to_json) | **POST** /convert/xml/to/json | XML to JSON conversion
|
91
|
+
*CloudmersiveConvertApiClient::ConvertDocumentApi* | [**convert_document_autodetect_get_info**](docs/ConvertDocumentApi.md#convert_document_autodetect_get_info) | **POST** /convert/autodetect/get-info | Get document type information
|
91
92
|
*CloudmersiveConvertApiClient::ConvertDocumentApi* | [**convert_document_autodetect_to_pdf**](docs/ConvertDocumentApi.md#convert_document_autodetect_to_pdf) | **POST** /convert/autodetect/to/pdf | Convert Document to PDF
|
92
93
|
*CloudmersiveConvertApiClient::ConvertDocumentApi* | [**convert_document_csv_to_xlsx**](docs/ConvertDocumentApi.md#convert_document_csv_to_xlsx) | **POST** /convert/csv/to/xlsx | CSV to Excel XLSX
|
93
94
|
*CloudmersiveConvertApiClient::ConvertDocumentApi* | [**convert_document_doc_to_docx**](docs/ConvertDocumentApi.md#convert_document_doc_to_docx) | **POST** /convert/doc/to/docx | Word DOC (97-03) to DOCX
|
@@ -144,6 +145,8 @@ Class | Method | HTTP request | Description
|
|
144
145
|
|
145
146
|
## Documentation for Models
|
146
147
|
|
148
|
+
- [CloudmersiveConvertApiClient::AlternateFileFormatCandidate](docs/AlternateFileFormatCandidate.md)
|
149
|
+
- [CloudmersiveConvertApiClient::AutodetectGetInfoResult](docs/AutodetectGetInfoResult.md)
|
147
150
|
- [CloudmersiveConvertApiClient::ConvertedPngPage](docs/ConvertedPngPage.md)
|
148
151
|
- [CloudmersiveConvertApiClient::DocumentValidationError](docs/DocumentValidationError.md)
|
149
152
|
- [CloudmersiveConvertApiClient::DocumentValidationResult](docs/DocumentValidationResult.md)
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# CloudmersiveConvertApiClient::AlternateFileFormatCandidate
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**probability** | **Float** | Probability that this extension is the right one; possible values are between 0.0 (lowest confidence) and 1.0 (highest confidence) | [optional]
|
7
|
+
**detected_file_extension** | **String** | Detected file extension of the file format, with a leading period | [optional]
|
8
|
+
**detected_mime_type** | **String** | MIME type of this file extension | [optional]
|
9
|
+
|
10
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# CloudmersiveConvertApiClient::AutodetectGetInfoResult
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**successful** | **BOOLEAN** | True if the operation was successful, false otherwise | [optional]
|
7
|
+
**detected_file_extension** | **String** | Detected file extension of the file format, with a leading period | [optional]
|
8
|
+
**detected_mime_type** | **String** | MIME type of this file extension | [optional]
|
9
|
+
**alternate_file_type_candidates** | [**Array<AlternateFileFormatCandidate>**](AlternateFileFormatCandidate.md) | Alternate file type options and their probability | [optional]
|
10
|
+
|
11
|
+
|
data/docs/ConvertDocumentApi.md
CHANGED
@@ -4,6 +4,7 @@ All URIs are relative to *https://api.cloudmersive.com*
|
|
4
4
|
|
5
5
|
Method | HTTP request | Description
|
6
6
|
------------- | ------------- | -------------
|
7
|
+
[**convert_document_autodetect_get_info**](ConvertDocumentApi.md#convert_document_autodetect_get_info) | **POST** /convert/autodetect/get-info | Get document type information
|
7
8
|
[**convert_document_autodetect_to_pdf**](ConvertDocumentApi.md#convert_document_autodetect_to_pdf) | **POST** /convert/autodetect/to/pdf | Convert Document to PDF
|
8
9
|
[**convert_document_csv_to_xlsx**](ConvertDocumentApi.md#convert_document_csv_to_xlsx) | **POST** /convert/csv/to/xlsx | CSV to Excel XLSX
|
9
10
|
[**convert_document_doc_to_docx**](ConvertDocumentApi.md#convert_document_doc_to_docx) | **POST** /convert/doc/to/docx | Word DOC (97-03) to DOCX
|
@@ -19,6 +20,60 @@ Method | HTTP request | Description
|
|
19
20
|
[**convert_document_xlsx_to_pdf**](ConvertDocumentApi.md#convert_document_xlsx_to_pdf) | **POST** /convert/xlsx/to/pdf | Excel XLSX to PDF
|
20
21
|
|
21
22
|
|
23
|
+
# **convert_document_autodetect_get_info**
|
24
|
+
> AutodetectGetInfoResult convert_document_autodetect_get_info(input_file)
|
25
|
+
|
26
|
+
Get document type information
|
27
|
+
|
28
|
+
Auto-detects a document's type information; does not require file extension. Analyzes file contents to confirm file type.
|
29
|
+
|
30
|
+
### Example
|
31
|
+
```ruby
|
32
|
+
# load the gem
|
33
|
+
require 'cloudmersive-convert-api-client'
|
34
|
+
# setup authorization
|
35
|
+
CloudmersiveConvertApiClient.configure do |config|
|
36
|
+
# Configure API key authorization: Apikey
|
37
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
38
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
39
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
40
|
+
end
|
41
|
+
|
42
|
+
api_instance = CloudmersiveConvertApiClient::ConvertDocumentApi.new
|
43
|
+
|
44
|
+
input_file = File.new("/path/to/file.txt") # File | Input file to perform the operation on.
|
45
|
+
|
46
|
+
|
47
|
+
begin
|
48
|
+
#Get document type information
|
49
|
+
result = api_instance.convert_document_autodetect_get_info(input_file)
|
50
|
+
p result
|
51
|
+
rescue CloudmersiveConvertApiClient::ApiError => e
|
52
|
+
puts "Exception when calling ConvertDocumentApi->convert_document_autodetect_get_info: #{e}"
|
53
|
+
end
|
54
|
+
```
|
55
|
+
|
56
|
+
### Parameters
|
57
|
+
|
58
|
+
Name | Type | Description | Notes
|
59
|
+
------------- | ------------- | ------------- | -------------
|
60
|
+
**input_file** | **File**| Input file to perform the operation on. |
|
61
|
+
|
62
|
+
### Return type
|
63
|
+
|
64
|
+
[**AutodetectGetInfoResult**](AutodetectGetInfoResult.md)
|
65
|
+
|
66
|
+
### Authorization
|
67
|
+
|
68
|
+
[Apikey](../README.md#Apikey)
|
69
|
+
|
70
|
+
### HTTP request headers
|
71
|
+
|
72
|
+
- **Content-Type**: multipart/form-data
|
73
|
+
- **Accept**: application/octet-stream
|
74
|
+
|
75
|
+
|
76
|
+
|
22
77
|
# **convert_document_autodetect_to_pdf**
|
23
78
|
> String convert_document_autodetect_to_pdf(input_file)
|
24
79
|
|
data/docs/DocxImage.md
CHANGED
@@ -15,6 +15,6 @@ Name | Type | Description | Notes
|
|
15
15
|
**image_data_content_type** | **String** | Read-only; image data MIME content-type | [optional]
|
16
16
|
**image_internal_file_name** | **String** | Read-only; internal file name/path for the image | [optional]
|
17
17
|
**image_contents_url** | **String** | URL to the image contents; file is stored in an in-memory cache and will be deleted. Call Finish-Editing to get the contents. | [optional]
|
18
|
-
**
|
18
|
+
**inline_with_text** | **BOOLEAN** | True if the image is inline with the text; false if it is floating | [optional]
|
19
19
|
|
20
20
|
|
@@ -17,6 +17,8 @@ require 'cloudmersive-convert-api-client/version'
|
|
17
17
|
require 'cloudmersive-convert-api-client/configuration'
|
18
18
|
|
19
19
|
# Models
|
20
|
+
require 'cloudmersive-convert-api-client/models/alternate_file_format_candidate'
|
21
|
+
require 'cloudmersive-convert-api-client/models/autodetect_get_info_result'
|
20
22
|
require 'cloudmersive-convert-api-client/models/converted_png_page'
|
21
23
|
require 'cloudmersive-convert-api-client/models/document_validation_error'
|
22
24
|
require 'cloudmersive-convert-api-client/models/document_validation_result'
|
@@ -20,6 +20,62 @@ module CloudmersiveConvertApiClient
|
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
22
|
|
23
|
+
# Get document type information
|
24
|
+
# Auto-detects a document's type information; does not require file extension. Analyzes file contents to confirm file type.
|
25
|
+
# @param input_file Input file to perform the operation on.
|
26
|
+
# @param [Hash] opts the optional parameters
|
27
|
+
# @return [AutodetectGetInfoResult]
|
28
|
+
def convert_document_autodetect_get_info(input_file, opts = {})
|
29
|
+
data, _status_code, _headers = convert_document_autodetect_get_info_with_http_info(input_file, opts)
|
30
|
+
return data
|
31
|
+
end
|
32
|
+
|
33
|
+
# Get document type information
|
34
|
+
# Auto-detects a document's type information; does not require file extension. Analyzes file contents to confirm file type.
|
35
|
+
# @param input_file Input file to perform the operation on.
|
36
|
+
# @param [Hash] opts the optional parameters
|
37
|
+
# @return [Array<(AutodetectGetInfoResult, Fixnum, Hash)>] AutodetectGetInfoResult data, response status code and response headers
|
38
|
+
def convert_document_autodetect_get_info_with_http_info(input_file, opts = {})
|
39
|
+
if @api_client.config.debugging
|
40
|
+
@api_client.config.logger.debug "Calling API: ConvertDocumentApi.convert_document_autodetect_get_info ..."
|
41
|
+
end
|
42
|
+
# verify the required parameter 'input_file' is set
|
43
|
+
if @api_client.config.client_side_validation && input_file.nil?
|
44
|
+
fail ArgumentError, "Missing the required parameter 'input_file' when calling ConvertDocumentApi.convert_document_autodetect_get_info"
|
45
|
+
end
|
46
|
+
# resource path
|
47
|
+
local_var_path = "/convert/autodetect/get-info"
|
48
|
+
|
49
|
+
# query parameters
|
50
|
+
query_params = {}
|
51
|
+
|
52
|
+
# header parameters
|
53
|
+
header_params = {}
|
54
|
+
# HTTP header 'Accept' (if needed)
|
55
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
|
56
|
+
# HTTP header 'Content-Type'
|
57
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
58
|
+
|
59
|
+
# form parameters
|
60
|
+
form_params = {}
|
61
|
+
form_params["inputFile"] = input_file
|
62
|
+
|
63
|
+
# http body (model)
|
64
|
+
post_body = nil
|
65
|
+
auth_names = ['Apikey']
|
66
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
67
|
+
:header_params => header_params,
|
68
|
+
:query_params => query_params,
|
69
|
+
:form_params => form_params,
|
70
|
+
:body => post_body,
|
71
|
+
:auth_names => auth_names,
|
72
|
+
:return_type => 'AutodetectGetInfoResult')
|
73
|
+
if @api_client.config.debugging
|
74
|
+
@api_client.config.logger.debug "API called: ConvertDocumentApi#convert_document_autodetect_get_info\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
75
|
+
end
|
76
|
+
return data, status_code, headers
|
77
|
+
end
|
78
|
+
|
23
79
|
# Convert Document to PDF
|
24
80
|
# Automatically detect file type and convert it to PDF.
|
25
81
|
# @param input_file Input file to perform the operation on.
|
@@ -0,0 +1,209 @@
|
|
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: unset
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module CloudmersiveConvertApiClient
|
16
|
+
# Alternate file format possibility
|
17
|
+
class AlternateFileFormatCandidate
|
18
|
+
# Probability that this extension is the right one; possible values are between 0.0 (lowest confidence) and 1.0 (highest confidence)
|
19
|
+
attr_accessor :probability
|
20
|
+
|
21
|
+
# Detected file extension of the file format, with a leading period
|
22
|
+
attr_accessor :detected_file_extension
|
23
|
+
|
24
|
+
# MIME type of this file extension
|
25
|
+
attr_accessor :detected_mime_type
|
26
|
+
|
27
|
+
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
+
def self.attribute_map
|
30
|
+
{
|
31
|
+
:'probability' => :'Probability',
|
32
|
+
:'detected_file_extension' => :'DetectedFileExtension',
|
33
|
+
:'detected_mime_type' => :'DetectedMimeType'
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
# Attribute type mapping.
|
38
|
+
def self.swagger_types
|
39
|
+
{
|
40
|
+
:'probability' => :'Float',
|
41
|
+
:'detected_file_extension' => :'String',
|
42
|
+
:'detected_mime_type' => :'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?(:'Probability')
|
55
|
+
self.probability = attributes[:'Probability']
|
56
|
+
end
|
57
|
+
|
58
|
+
if attributes.has_key?(:'DetectedFileExtension')
|
59
|
+
self.detected_file_extension = attributes[:'DetectedFileExtension']
|
60
|
+
end
|
61
|
+
|
62
|
+
if attributes.has_key?(:'DetectedMimeType')
|
63
|
+
self.detected_mime_type = attributes[:'DetectedMimeType']
|
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
|
+
return invalid_properties
|
73
|
+
end
|
74
|
+
|
75
|
+
# Check to see if the all the properties in the model are valid
|
76
|
+
# @return true if the model is valid
|
77
|
+
def valid?
|
78
|
+
return true
|
79
|
+
end
|
80
|
+
|
81
|
+
# Checks equality by comparing each attribute.
|
82
|
+
# @param [Object] Object to be compared
|
83
|
+
def ==(o)
|
84
|
+
return true if self.equal?(o)
|
85
|
+
self.class == o.class &&
|
86
|
+
probability == o.probability &&
|
87
|
+
detected_file_extension == o.detected_file_extension &&
|
88
|
+
detected_mime_type == o.detected_mime_type
|
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
|
+
[probability, detected_file_extension, detected_mime_type].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 = CloudmersiveConvertApiClient.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
|
@@ -0,0 +1,221 @@
|
|
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: unset
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module CloudmersiveConvertApiClient
|
16
|
+
# Result of an autodetect/get-info operation
|
17
|
+
class AutodetectGetInfoResult
|
18
|
+
# True if the operation was successful, false otherwise
|
19
|
+
attr_accessor :successful
|
20
|
+
|
21
|
+
# Detected file extension of the file format, with a leading period
|
22
|
+
attr_accessor :detected_file_extension
|
23
|
+
|
24
|
+
# MIME type of this file extension
|
25
|
+
attr_accessor :detected_mime_type
|
26
|
+
|
27
|
+
# Alternate file type options and their probability
|
28
|
+
attr_accessor :alternate_file_type_candidates
|
29
|
+
|
30
|
+
|
31
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
32
|
+
def self.attribute_map
|
33
|
+
{
|
34
|
+
:'successful' => :'Successful',
|
35
|
+
:'detected_file_extension' => :'DetectedFileExtension',
|
36
|
+
:'detected_mime_type' => :'DetectedMimeType',
|
37
|
+
:'alternate_file_type_candidates' => :'AlternateFileTypeCandidates'
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
# Attribute type mapping.
|
42
|
+
def self.swagger_types
|
43
|
+
{
|
44
|
+
:'successful' => :'BOOLEAN',
|
45
|
+
:'detected_file_extension' => :'String',
|
46
|
+
:'detected_mime_type' => :'String',
|
47
|
+
:'alternate_file_type_candidates' => :'Array<AlternateFileFormatCandidate>'
|
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?(:'Successful')
|
60
|
+
self.successful = attributes[:'Successful']
|
61
|
+
end
|
62
|
+
|
63
|
+
if attributes.has_key?(:'DetectedFileExtension')
|
64
|
+
self.detected_file_extension = attributes[:'DetectedFileExtension']
|
65
|
+
end
|
66
|
+
|
67
|
+
if attributes.has_key?(:'DetectedMimeType')
|
68
|
+
self.detected_mime_type = attributes[:'DetectedMimeType']
|
69
|
+
end
|
70
|
+
|
71
|
+
if attributes.has_key?(:'AlternateFileTypeCandidates')
|
72
|
+
if (value = attributes[:'AlternateFileTypeCandidates']).is_a?(Array)
|
73
|
+
self.alternate_file_type_candidates = value
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
80
|
+
# @return Array for valid properties with the reasons
|
81
|
+
def list_invalid_properties
|
82
|
+
invalid_properties = Array.new
|
83
|
+
return invalid_properties
|
84
|
+
end
|
85
|
+
|
86
|
+
# Check to see if the all the properties in the model are valid
|
87
|
+
# @return true if the model is valid
|
88
|
+
def valid?
|
89
|
+
return true
|
90
|
+
end
|
91
|
+
|
92
|
+
# Checks equality by comparing each attribute.
|
93
|
+
# @param [Object] Object to be compared
|
94
|
+
def ==(o)
|
95
|
+
return true if self.equal?(o)
|
96
|
+
self.class == o.class &&
|
97
|
+
successful == o.successful &&
|
98
|
+
detected_file_extension == o.detected_file_extension &&
|
99
|
+
detected_mime_type == o.detected_mime_type &&
|
100
|
+
alternate_file_type_candidates == o.alternate_file_type_candidates
|
101
|
+
end
|
102
|
+
|
103
|
+
# @see the `==` method
|
104
|
+
# @param [Object] Object to be compared
|
105
|
+
def eql?(o)
|
106
|
+
self == o
|
107
|
+
end
|
108
|
+
|
109
|
+
# Calculates hash code according to all attributes.
|
110
|
+
# @return [Fixnum] Hash code
|
111
|
+
def hash
|
112
|
+
[successful, detected_file_extension, detected_mime_type, alternate_file_type_candidates].hash
|
113
|
+
end
|
114
|
+
|
115
|
+
# Builds the object from hash
|
116
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
117
|
+
# @return [Object] Returns the model itself
|
118
|
+
def build_from_hash(attributes)
|
119
|
+
return nil unless attributes.is_a?(Hash)
|
120
|
+
self.class.swagger_types.each_pair do |key, type|
|
121
|
+
if type =~ /\AArray<(.*)>/i
|
122
|
+
# check to ensure the input is an array given that the the attribute
|
123
|
+
# is documented as an array but the input is not
|
124
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
125
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
126
|
+
end
|
127
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
128
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
129
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
130
|
+
end
|
131
|
+
|
132
|
+
self
|
133
|
+
end
|
134
|
+
|
135
|
+
# Deserializes the data based on type
|
136
|
+
# @param string type Data type
|
137
|
+
# @param string value Value to be deserialized
|
138
|
+
# @return [Object] Deserialized data
|
139
|
+
def _deserialize(type, value)
|
140
|
+
case type.to_sym
|
141
|
+
when :DateTime
|
142
|
+
DateTime.parse(value)
|
143
|
+
when :Date
|
144
|
+
Date.parse(value)
|
145
|
+
when :String
|
146
|
+
value.to_s
|
147
|
+
when :Integer
|
148
|
+
value.to_i
|
149
|
+
when :Float
|
150
|
+
value.to_f
|
151
|
+
when :BOOLEAN
|
152
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
153
|
+
true
|
154
|
+
else
|
155
|
+
false
|
156
|
+
end
|
157
|
+
when :Object
|
158
|
+
# generic object (usually a Hash), return directly
|
159
|
+
value
|
160
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
161
|
+
inner_type = Regexp.last_match[:inner_type]
|
162
|
+
value.map { |v| _deserialize(inner_type, v) }
|
163
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
164
|
+
k_type = Regexp.last_match[:k_type]
|
165
|
+
v_type = Regexp.last_match[:v_type]
|
166
|
+
{}.tap do |hash|
|
167
|
+
value.each do |k, v|
|
168
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
else # model
|
172
|
+
temp_model = CloudmersiveConvertApiClient.const_get(type).new
|
173
|
+
temp_model.build_from_hash(value)
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
# Returns the string representation of the object
|
178
|
+
# @return [String] String presentation of the object
|
179
|
+
def to_s
|
180
|
+
to_hash.to_s
|
181
|
+
end
|
182
|
+
|
183
|
+
# to_body is an alias to to_hash (backward compatibility)
|
184
|
+
# @return [Hash] Returns the object in the form of hash
|
185
|
+
def to_body
|
186
|
+
to_hash
|
187
|
+
end
|
188
|
+
|
189
|
+
# Returns the object in the form of hash
|
190
|
+
# @return [Hash] Returns the object in the form of hash
|
191
|
+
def to_hash
|
192
|
+
hash = {}
|
193
|
+
self.class.attribute_map.each_pair do |attr, param|
|
194
|
+
value = self.send(attr)
|
195
|
+
next if value.nil?
|
196
|
+
hash[param] = _to_hash(value)
|
197
|
+
end
|
198
|
+
hash
|
199
|
+
end
|
200
|
+
|
201
|
+
# Outputs non-array value in the form of hash
|
202
|
+
# For object, use to_hash. Otherwise, just return the value
|
203
|
+
# @param [Object] value Any valid value
|
204
|
+
# @return [Hash] Returns the value in the form of hash
|
205
|
+
def _to_hash(value)
|
206
|
+
if value.is_a?(Array)
|
207
|
+
value.compact.map{ |v| _to_hash(v) }
|
208
|
+
elsif value.is_a?(Hash)
|
209
|
+
{}.tap do |hash|
|
210
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
211
|
+
end
|
212
|
+
elsif value.respond_to? :to_hash
|
213
|
+
value.to_hash
|
214
|
+
else
|
215
|
+
value
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
end
|
220
|
+
|
221
|
+
end
|
@@ -52,7 +52,7 @@ module CloudmersiveConvertApiClient
|
|
52
52
|
attr_accessor :image_contents_url
|
53
53
|
|
54
54
|
# True if the image is inline with the text; false if it is floating
|
55
|
-
attr_accessor :
|
55
|
+
attr_accessor :inline_with_text
|
56
56
|
|
57
57
|
|
58
58
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -70,7 +70,7 @@ module CloudmersiveConvertApiClient
|
|
70
70
|
:'image_data_content_type' => :'ImageDataContentType',
|
71
71
|
:'image_internal_file_name' => :'ImageInternalFileName',
|
72
72
|
:'image_contents_url' => :'ImageContentsURL',
|
73
|
-
:'
|
73
|
+
:'inline_with_text' => :'InlineWithText'
|
74
74
|
}
|
75
75
|
end
|
76
76
|
|
@@ -89,7 +89,7 @@ module CloudmersiveConvertApiClient
|
|
89
89
|
:'image_data_content_type' => :'String',
|
90
90
|
:'image_internal_file_name' => :'String',
|
91
91
|
:'image_contents_url' => :'String',
|
92
|
-
:'
|
92
|
+
:'inline_with_text' => :'BOOLEAN'
|
93
93
|
}
|
94
94
|
end
|
95
95
|
|
@@ -149,8 +149,8 @@ module CloudmersiveConvertApiClient
|
|
149
149
|
self.image_contents_url = attributes[:'ImageContentsURL']
|
150
150
|
end
|
151
151
|
|
152
|
-
if attributes.has_key?(:'
|
153
|
-
self.
|
152
|
+
if attributes.has_key?(:'InlineWithText')
|
153
|
+
self.inline_with_text = attributes[:'InlineWithText']
|
154
154
|
end
|
155
155
|
|
156
156
|
end
|
@@ -185,7 +185,7 @@ module CloudmersiveConvertApiClient
|
|
185
185
|
image_data_content_type == o.image_data_content_type &&
|
186
186
|
image_internal_file_name == o.image_internal_file_name &&
|
187
187
|
image_contents_url == o.image_contents_url &&
|
188
|
-
|
188
|
+
inline_with_text == o.inline_with_text
|
189
189
|
end
|
190
190
|
|
191
191
|
# @see the `==` method
|
@@ -197,7 +197,7 @@ module CloudmersiveConvertApiClient
|
|
197
197
|
# Calculates hash code according to all attributes.
|
198
198
|
# @return [Fixnum] Hash code
|
199
199
|
def hash
|
200
|
-
[path, image_name, image_id, image_description, image_width, image_height, x_offset, y_offset, image_data_embed_id, image_data_content_type, image_internal_file_name, image_contents_url,
|
200
|
+
[path, image_name, image_id, image_description, image_width, image_height, x_offset, y_offset, image_data_embed_id, image_data_content_type, image_internal_file_name, image_contents_url, inline_with_text].hash
|
201
201
|
end
|
202
202
|
|
203
203
|
# Builds the object from hash
|
@@ -32,6 +32,18 @@ describe 'ConvertDocumentApi' do
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
+
# unit tests for convert_document_autodetect_get_info
|
36
|
+
# Get document type information
|
37
|
+
# Auto-detects a document's type information; does not require file extension. Analyzes file contents to confirm file type.
|
38
|
+
# @param input_file Input file to perform the operation on.
|
39
|
+
# @param [Hash] opts the optional parameters
|
40
|
+
# @return [AutodetectGetInfoResult]
|
41
|
+
describe 'convert_document_autodetect_get_info test' do
|
42
|
+
it "should work" do
|
43
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
35
47
|
# unit tests for convert_document_autodetect_to_pdf
|
36
48
|
# Convert Document to PDF
|
37
49
|
# Automatically detect file type and convert it to PDF.
|
@@ -0,0 +1,54 @@
|
|
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: unset
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
require 'date'
|
16
|
+
|
17
|
+
# Unit tests for CloudmersiveConvertApiClient::AlternateFileFormatCandidate
|
18
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
19
|
+
# Please update as you see appropriate
|
20
|
+
describe 'AlternateFileFormatCandidate' do
|
21
|
+
before do
|
22
|
+
# run before each test
|
23
|
+
@instance = CloudmersiveConvertApiClient::AlternateFileFormatCandidate.new
|
24
|
+
end
|
25
|
+
|
26
|
+
after do
|
27
|
+
# run after each test
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'test an instance of AlternateFileFormatCandidate' do
|
31
|
+
it 'should create an instance of AlternateFileFormatCandidate' do
|
32
|
+
expect(@instance).to be_instance_of(CloudmersiveConvertApiClient::AlternateFileFormatCandidate)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
describe 'test attribute "probability"' do
|
36
|
+
it 'should work' do
|
37
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe 'test attribute "detected_file_extension"' do
|
42
|
+
it 'should work' do
|
43
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe 'test attribute "detected_mime_type"' do
|
48
|
+
it 'should work' do
|
49
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
@@ -0,0 +1,60 @@
|
|
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: unset
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
require 'date'
|
16
|
+
|
17
|
+
# Unit tests for CloudmersiveConvertApiClient::AutodetectGetInfoResult
|
18
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
19
|
+
# Please update as you see appropriate
|
20
|
+
describe 'AutodetectGetInfoResult' do
|
21
|
+
before do
|
22
|
+
# run before each test
|
23
|
+
@instance = CloudmersiveConvertApiClient::AutodetectGetInfoResult.new
|
24
|
+
end
|
25
|
+
|
26
|
+
after do
|
27
|
+
# run after each test
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'test an instance of AutodetectGetInfoResult' do
|
31
|
+
it 'should create an instance of AutodetectGetInfoResult' do
|
32
|
+
expect(@instance).to be_instance_of(CloudmersiveConvertApiClient::AutodetectGetInfoResult)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
describe 'test attribute "successful"' do
|
36
|
+
it 'should work' do
|
37
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe 'test attribute "detected_file_extension"' do
|
42
|
+
it 'should work' do
|
43
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe 'test attribute "detected_mime_type"' do
|
48
|
+
it 'should work' do
|
49
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe 'test attribute "alternate_file_type_candidates"' do
|
54
|
+
it 'should work' do
|
55
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
@@ -104,7 +104,7 @@ describe 'DocxImage' do
|
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
107
|
-
describe 'test attribute "
|
107
|
+
describe 'test attribute "inline_with_text"' do
|
108
108
|
it 'should work' do
|
109
109
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
110
110
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudmersive-convert-api-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cloudmersive
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -202,6 +202,8 @@ files:
|
|
202
202
|
- "./README.md"
|
203
203
|
- "./Rakefile"
|
204
204
|
- "./cloudmersive-convert-api-client.gemspec"
|
205
|
+
- "./docs/AlternateFileFormatCandidate.md"
|
206
|
+
- "./docs/AutodetectGetInfoResult.md"
|
205
207
|
- "./docs/CompareDocumentApi.md"
|
206
208
|
- "./docs/ConvertDataApi.md"
|
207
209
|
- "./docs/ConvertDocumentApi.md"
|
@@ -299,6 +301,8 @@ files:
|
|
299
301
|
- "./lib/cloudmersive-convert-api-client/api_client.rb"
|
300
302
|
- "./lib/cloudmersive-convert-api-client/api_error.rb"
|
301
303
|
- "./lib/cloudmersive-convert-api-client/configuration.rb"
|
304
|
+
- "./lib/cloudmersive-convert-api-client/models/alternate_file_format_candidate.rb"
|
305
|
+
- "./lib/cloudmersive-convert-api-client/models/autodetect_get_info_result.rb"
|
302
306
|
- "./lib/cloudmersive-convert-api-client/models/converted_png_page.rb"
|
303
307
|
- "./lib/cloudmersive-convert-api-client/models/document_validation_error.rb"
|
304
308
|
- "./lib/cloudmersive-convert-api-client/models/document_validation_result.rb"
|
@@ -384,6 +388,8 @@ files:
|
|
384
388
|
- "./spec/api/viewer_tools_api_spec.rb"
|
385
389
|
- "./spec/api_client_spec.rb"
|
386
390
|
- "./spec/configuration_spec.rb"
|
391
|
+
- "./spec/models/alternate_file_format_candidate_spec.rb"
|
392
|
+
- "./spec/models/autodetect_get_info_result_spec.rb"
|
387
393
|
- "./spec/models/converted_png_page_spec.rb"
|
388
394
|
- "./spec/models/document_validation_error_spec.rb"
|
389
395
|
- "./spec/models/document_validation_result_spec.rb"
|