cloudmersive-convert-api-client 2.0.8 → 2.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +27 -4
- data/docs/ConvertDataApi.md +117 -3
- data/docs/ConvertDocumentApi.md +159 -0
- data/docs/DocxMetadataCustomProperty.md +13 -0
- data/docs/DocxSetCustomMetadataPropertiesRequest.md +10 -0
- data/docs/EditDocumentApi.md +330 -0
- data/docs/EditPdfApi.md +169 -0
- data/docs/GetDocxMetadataPropertiesResponse.md +16 -0
- data/docs/ValidateDocumentApi.md +275 -0
- data/docs/ViewerToolsApi.md +8 -2
- data/docs/ZipArchiveApi.md +80 -0
- data/lib/cloudmersive-convert-api-client.rb +3 -0
- data/lib/cloudmersive-convert-api-client/api/convert_data_api.rb +117 -4
- data/lib/cloudmersive-convert-api-client/api/convert_document_api.rb +156 -0
- data/lib/cloudmersive-convert-api-client/api/edit_document_api.rb +329 -0
- data/lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb +168 -0
- data/lib/cloudmersive-convert-api-client/api/validate_document_api.rb +275 -0
- data/lib/cloudmersive-convert-api-client/api/viewer_tools_api.rb +6 -0
- data/lib/cloudmersive-convert-api-client/api/zip_archive_api.rb +92 -0
- data/lib/cloudmersive-convert-api-client/models/docx_metadata_custom_property.rb +236 -0
- data/lib/cloudmersive-convert-api-client/models/docx_set_custom_metadata_properties_request.rb +223 -0
- data/lib/cloudmersive-convert-api-client/models/get_docx_metadata_properties_response.rb +268 -0
- data/lib/cloudmersive-convert-api-client/version.rb +1 -1
- data/spec/api/convert_data_api_spec.rb +26 -1
- data/spec/api/convert_document_api_spec.rb +35 -0
- data/spec/api/edit_document_api_spec.rb +72 -0
- data/spec/api/edit_pdf_api_spec.rb +37 -0
- data/spec/api/validate_document_api_spec.rb +60 -0
- data/spec/api/viewer_tools_api_spec.rb +2 -0
- data/spec/api/zip_archive_api_spec.rb +23 -0
- data/spec/models/docx_metadata_custom_property_spec.rb +71 -0
- data/spec/models/docx_set_custom_metadata_properties_request_spec.rb +53 -0
- data/spec/models/get_docx_metadata_properties_response_spec.rb +89 -0
- metadata +11 -2
@@ -23,6 +23,8 @@ module CloudmersiveConvertApiClient
|
|
23
23
|
# Creates an HTML embed code for a simple web-based viewer of a document; supports Office document types and PDF.
|
24
24
|
# @param input_file Input file to perform the operation on.
|
25
25
|
# @param [Hash] opts the optional parameters
|
26
|
+
# @option opts [Integer] :width Optional; width of the output viewer in pixels
|
27
|
+
# @option opts [Integer] :height Optional; height of the output viewer in pixels
|
26
28
|
# @return [ViewerResponse]
|
27
29
|
def viewer_tools_create_simple(input_file, opts = {})
|
28
30
|
data, _status_code, _headers = viewer_tools_create_simple_with_http_info(input_file, opts)
|
@@ -33,6 +35,8 @@ module CloudmersiveConvertApiClient
|
|
33
35
|
# Creates an HTML embed code for a simple web-based viewer of a document; supports Office document types and PDF.
|
34
36
|
# @param input_file Input file to perform the operation on.
|
35
37
|
# @param [Hash] opts the optional parameters
|
38
|
+
# @option opts [Integer] :width Optional; width of the output viewer in pixels
|
39
|
+
# @option opts [Integer] :height Optional; height of the output viewer in pixels
|
36
40
|
# @return [Array<(ViewerResponse, Fixnum, Hash)>] ViewerResponse data, response status code and response headers
|
37
41
|
def viewer_tools_create_simple_with_http_info(input_file, opts = {})
|
38
42
|
if @api_client.config.debugging
|
@@ -54,6 +58,8 @@ module CloudmersiveConvertApiClient
|
|
54
58
|
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
55
59
|
# HTTP header 'Content-Type'
|
56
60
|
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
61
|
+
header_params[:'width'] = opts[:'width'] if !opts[:'width'].nil?
|
62
|
+
header_params[:'height'] = opts[:'height'] if !opts[:'height'].nil?
|
57
63
|
|
58
64
|
# form parameters
|
59
65
|
form_params = {}
|
@@ -155,6 +155,98 @@ module CloudmersiveConvertApiClient
|
|
155
155
|
end
|
156
156
|
return data, status_code, headers
|
157
157
|
end
|
158
|
+
# Compress files to create a new, encrypted and password-protected zip archive
|
159
|
+
# Create a new zip archive by compressing input files, and also applies encryption and password protection to the zip.
|
160
|
+
# @param password Password to place on the Zip file; the longer the password, the more secure
|
161
|
+
# @param input_file1 First input file to perform the operation on.
|
162
|
+
# @param [Hash] opts the optional parameters
|
163
|
+
# @option opts [String] :encryption_algorithm Encryption algorithm to use; possible values are AES-256 (recommended), AES-128, and PK-Zip (not recommended; legacy, weak encryption algorithm). Default is AES-256.
|
164
|
+
# @option opts [File] :input_file2 Second input file to perform the operation on.
|
165
|
+
# @option opts [File] :input_file3 Third input file to perform the operation on.
|
166
|
+
# @option opts [File] :input_file4 Fourth input file to perform the operation on.
|
167
|
+
# @option opts [File] :input_file5 Fifth input file to perform the operation on.
|
168
|
+
# @option opts [File] :input_file6 Sixth input file to perform the operation on.
|
169
|
+
# @option opts [File] :input_file7 Seventh input file to perform the operation on.
|
170
|
+
# @option opts [File] :input_file8 Eighth input file to perform the operation on.
|
171
|
+
# @option opts [File] :input_file9 Ninth input file to perform the operation on.
|
172
|
+
# @option opts [File] :input_file10 Tenth input file to perform the operation on.
|
173
|
+
# @return [String]
|
174
|
+
def zip_archive_zip_create_encrypted(password, input_file1, opts = {})
|
175
|
+
data, _status_code, _headers = zip_archive_zip_create_encrypted_with_http_info(password, input_file1, opts)
|
176
|
+
data
|
177
|
+
end
|
178
|
+
|
179
|
+
# Compress files to create a new, encrypted and password-protected zip archive
|
180
|
+
# Create a new zip archive by compressing input files, and also applies encryption and password protection to the zip.
|
181
|
+
# @param password Password to place on the Zip file; the longer the password, the more secure
|
182
|
+
# @param input_file1 First input file to perform the operation on.
|
183
|
+
# @param [Hash] opts the optional parameters
|
184
|
+
# @option opts [String] :encryption_algorithm Encryption algorithm to use; possible values are AES-256 (recommended), AES-128, and PK-Zip (not recommended; legacy, weak encryption algorithm). Default is AES-256.
|
185
|
+
# @option opts [File] :input_file2 Second input file to perform the operation on.
|
186
|
+
# @option opts [File] :input_file3 Third input file to perform the operation on.
|
187
|
+
# @option opts [File] :input_file4 Fourth input file to perform the operation on.
|
188
|
+
# @option opts [File] :input_file5 Fifth input file to perform the operation on.
|
189
|
+
# @option opts [File] :input_file6 Sixth input file to perform the operation on.
|
190
|
+
# @option opts [File] :input_file7 Seventh input file to perform the operation on.
|
191
|
+
# @option opts [File] :input_file8 Eighth input file to perform the operation on.
|
192
|
+
# @option opts [File] :input_file9 Ninth input file to perform the operation on.
|
193
|
+
# @option opts [File] :input_file10 Tenth input file to perform the operation on.
|
194
|
+
# @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
|
195
|
+
def zip_archive_zip_create_encrypted_with_http_info(password, input_file1, opts = {})
|
196
|
+
if @api_client.config.debugging
|
197
|
+
@api_client.config.logger.debug 'Calling API: ZipArchiveApi.zip_archive_zip_create_encrypted ...'
|
198
|
+
end
|
199
|
+
# verify the required parameter 'password' is set
|
200
|
+
if @api_client.config.client_side_validation && password.nil?
|
201
|
+
fail ArgumentError, "Missing the required parameter 'password' when calling ZipArchiveApi.zip_archive_zip_create_encrypted"
|
202
|
+
end
|
203
|
+
# verify the required parameter 'input_file1' is set
|
204
|
+
if @api_client.config.client_side_validation && input_file1.nil?
|
205
|
+
fail ArgumentError, "Missing the required parameter 'input_file1' when calling ZipArchiveApi.zip_archive_zip_create_encrypted"
|
206
|
+
end
|
207
|
+
# resource path
|
208
|
+
local_var_path = '/convert/archive/zip/create/encrypted'
|
209
|
+
|
210
|
+
# query parameters
|
211
|
+
query_params = {}
|
212
|
+
|
213
|
+
# header parameters
|
214
|
+
header_params = {}
|
215
|
+
# HTTP header 'Accept' (if needed)
|
216
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
|
217
|
+
# HTTP header 'Content-Type'
|
218
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
219
|
+
header_params[:'password'] = password
|
220
|
+
header_params[:'encryptionAlgorithm'] = opts[:'encryption_algorithm'] if !opts[:'encryption_algorithm'].nil?
|
221
|
+
|
222
|
+
# form parameters
|
223
|
+
form_params = {}
|
224
|
+
form_params['inputFile1'] = input_file1
|
225
|
+
form_params['inputFile2'] = opts[:'input_file2'] if !opts[:'input_file2'].nil?
|
226
|
+
form_params['inputFile3'] = opts[:'input_file3'] if !opts[:'input_file3'].nil?
|
227
|
+
form_params['inputFile4'] = opts[:'input_file4'] if !opts[:'input_file4'].nil?
|
228
|
+
form_params['inputFile5'] = opts[:'input_file5'] if !opts[:'input_file5'].nil?
|
229
|
+
form_params['inputFile6'] = opts[:'input_file6'] if !opts[:'input_file6'].nil?
|
230
|
+
form_params['inputFile7'] = opts[:'input_file7'] if !opts[:'input_file7'].nil?
|
231
|
+
form_params['inputFile8'] = opts[:'input_file8'] if !opts[:'input_file8'].nil?
|
232
|
+
form_params['inputFile9'] = opts[:'input_file9'] if !opts[:'input_file9'].nil?
|
233
|
+
form_params['inputFile10'] = opts[:'input_file10'] if !opts[:'input_file10'].nil?
|
234
|
+
|
235
|
+
# http body (model)
|
236
|
+
post_body = nil
|
237
|
+
auth_names = ['Apikey']
|
238
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
239
|
+
:header_params => header_params,
|
240
|
+
:query_params => query_params,
|
241
|
+
:form_params => form_params,
|
242
|
+
:body => post_body,
|
243
|
+
:auth_names => auth_names,
|
244
|
+
:return_type => 'String')
|
245
|
+
if @api_client.config.debugging
|
246
|
+
@api_client.config.logger.debug "API called: ZipArchiveApi#zip_archive_zip_create_encrypted\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
247
|
+
end
|
248
|
+
return data, status_code, headers
|
249
|
+
end
|
158
250
|
# Decrypt and remove password protection on a zip file
|
159
251
|
# Decrypts and removes password protection from an encrypted zip file with the specified password
|
160
252
|
# @param input_file Input file to perform the operation on.
|
@@ -0,0 +1,236 @@
|
|
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.4.14
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module CloudmersiveConvertApiClient
|
16
|
+
# Name and value pair for a custom-defined DOCX metadata property
|
17
|
+
class DocxMetadataCustomProperty
|
18
|
+
# Name of the property
|
19
|
+
attr_accessor :property_name
|
20
|
+
|
21
|
+
# Data type of the property; possible values are \"string\", \"integer\", \"double\" or \"date\"
|
22
|
+
attr_accessor :property_data_type
|
23
|
+
|
24
|
+
# If the property is of a string data type, then provides the string value if available
|
25
|
+
attr_accessor :string_value
|
26
|
+
|
27
|
+
# If the property is of a integer data type, then provides the integer value if available
|
28
|
+
attr_accessor :integer_value
|
29
|
+
|
30
|
+
# If the property is of a double floating point data type, then provides the double value if available
|
31
|
+
attr_accessor :double_value
|
32
|
+
|
33
|
+
# If the property is of a date time data type, then provides the date time value if available
|
34
|
+
attr_accessor :date_value
|
35
|
+
|
36
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
37
|
+
def self.attribute_map
|
38
|
+
{
|
39
|
+
:'property_name' => :'PropertyName',
|
40
|
+
:'property_data_type' => :'PropertyDataType',
|
41
|
+
:'string_value' => :'StringValue',
|
42
|
+
:'integer_value' => :'IntegerValue',
|
43
|
+
:'double_value' => :'DoubleValue',
|
44
|
+
:'date_value' => :'DateValue'
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
# Attribute type mapping.
|
49
|
+
def self.swagger_types
|
50
|
+
{
|
51
|
+
:'property_name' => :'String',
|
52
|
+
:'property_data_type' => :'String',
|
53
|
+
:'string_value' => :'String',
|
54
|
+
:'integer_value' => :'Integer',
|
55
|
+
:'double_value' => :'Float',
|
56
|
+
:'date_value' => :'DateTime'
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
# Initializes the object
|
61
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
62
|
+
def initialize(attributes = {})
|
63
|
+
return unless attributes.is_a?(Hash)
|
64
|
+
|
65
|
+
# convert string to symbol for hash key
|
66
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
67
|
+
|
68
|
+
if attributes.has_key?(:'PropertyName')
|
69
|
+
self.property_name = attributes[:'PropertyName']
|
70
|
+
end
|
71
|
+
|
72
|
+
if attributes.has_key?(:'PropertyDataType')
|
73
|
+
self.property_data_type = attributes[:'PropertyDataType']
|
74
|
+
end
|
75
|
+
|
76
|
+
if attributes.has_key?(:'StringValue')
|
77
|
+
self.string_value = attributes[:'StringValue']
|
78
|
+
end
|
79
|
+
|
80
|
+
if attributes.has_key?(:'IntegerValue')
|
81
|
+
self.integer_value = attributes[:'IntegerValue']
|
82
|
+
end
|
83
|
+
|
84
|
+
if attributes.has_key?(:'DoubleValue')
|
85
|
+
self.double_value = attributes[:'DoubleValue']
|
86
|
+
end
|
87
|
+
|
88
|
+
if attributes.has_key?(:'DateValue')
|
89
|
+
self.date_value = attributes[:'DateValue']
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
94
|
+
# @return Array for valid properties with the reasons
|
95
|
+
def list_invalid_properties
|
96
|
+
invalid_properties = Array.new
|
97
|
+
invalid_properties
|
98
|
+
end
|
99
|
+
|
100
|
+
# Check to see if the all the properties in the model are valid
|
101
|
+
# @return true if the model is valid
|
102
|
+
def valid?
|
103
|
+
true
|
104
|
+
end
|
105
|
+
|
106
|
+
# Checks equality by comparing each attribute.
|
107
|
+
# @param [Object] Object to be compared
|
108
|
+
def ==(o)
|
109
|
+
return true if self.equal?(o)
|
110
|
+
self.class == o.class &&
|
111
|
+
property_name == o.property_name &&
|
112
|
+
property_data_type == o.property_data_type &&
|
113
|
+
string_value == o.string_value &&
|
114
|
+
integer_value == o.integer_value &&
|
115
|
+
double_value == o.double_value &&
|
116
|
+
date_value == o.date_value
|
117
|
+
end
|
118
|
+
|
119
|
+
# @see the `==` method
|
120
|
+
# @param [Object] Object to be compared
|
121
|
+
def eql?(o)
|
122
|
+
self == o
|
123
|
+
end
|
124
|
+
|
125
|
+
# Calculates hash code according to all attributes.
|
126
|
+
# @return [Fixnum] Hash code
|
127
|
+
def hash
|
128
|
+
[property_name, property_data_type, string_value, integer_value, double_value, date_value].hash
|
129
|
+
end
|
130
|
+
|
131
|
+
# Builds the object from hash
|
132
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
133
|
+
# @return [Object] Returns the model itself
|
134
|
+
def build_from_hash(attributes)
|
135
|
+
return nil unless attributes.is_a?(Hash)
|
136
|
+
self.class.swagger_types.each_pair do |key, type|
|
137
|
+
if type =~ /\AArray<(.*)>/i
|
138
|
+
# check to ensure the input is an array given that the attribute
|
139
|
+
# is documented as an array but the input is not
|
140
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
141
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
142
|
+
end
|
143
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
144
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
145
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
146
|
+
end
|
147
|
+
|
148
|
+
self
|
149
|
+
end
|
150
|
+
|
151
|
+
# Deserializes the data based on type
|
152
|
+
# @param string type Data type
|
153
|
+
# @param string value Value to be deserialized
|
154
|
+
# @return [Object] Deserialized data
|
155
|
+
def _deserialize(type, value)
|
156
|
+
case type.to_sym
|
157
|
+
when :DateTime
|
158
|
+
DateTime.parse(value)
|
159
|
+
when :Date
|
160
|
+
Date.parse(value)
|
161
|
+
when :String
|
162
|
+
value.to_s
|
163
|
+
when :Integer
|
164
|
+
value.to_i
|
165
|
+
when :Float
|
166
|
+
value.to_f
|
167
|
+
when :BOOLEAN
|
168
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
169
|
+
true
|
170
|
+
else
|
171
|
+
false
|
172
|
+
end
|
173
|
+
when :Object
|
174
|
+
# generic object (usually a Hash), return directly
|
175
|
+
value
|
176
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
177
|
+
inner_type = Regexp.last_match[:inner_type]
|
178
|
+
value.map { |v| _deserialize(inner_type, v) }
|
179
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
180
|
+
k_type = Regexp.last_match[:k_type]
|
181
|
+
v_type = Regexp.last_match[:v_type]
|
182
|
+
{}.tap do |hash|
|
183
|
+
value.each do |k, v|
|
184
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
185
|
+
end
|
186
|
+
end
|
187
|
+
else # model
|
188
|
+
temp_model = CloudmersiveConvertApiClient.const_get(type).new
|
189
|
+
temp_model.build_from_hash(value)
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
# Returns the string representation of the object
|
194
|
+
# @return [String] String presentation of the object
|
195
|
+
def to_s
|
196
|
+
to_hash.to_s
|
197
|
+
end
|
198
|
+
|
199
|
+
# to_body is an alias to to_hash (backward compatibility)
|
200
|
+
# @return [Hash] Returns the object in the form of hash
|
201
|
+
def to_body
|
202
|
+
to_hash
|
203
|
+
end
|
204
|
+
|
205
|
+
# Returns the object in the form of hash
|
206
|
+
# @return [Hash] Returns the object in the form of hash
|
207
|
+
def to_hash
|
208
|
+
hash = {}
|
209
|
+
self.class.attribute_map.each_pair do |attr, param|
|
210
|
+
value = self.send(attr)
|
211
|
+
next if value.nil?
|
212
|
+
hash[param] = _to_hash(value)
|
213
|
+
end
|
214
|
+
hash
|
215
|
+
end
|
216
|
+
|
217
|
+
# Outputs non-array value in the form of hash
|
218
|
+
# For object, use to_hash. Otherwise, just return the value
|
219
|
+
# @param [Object] value Any valid value
|
220
|
+
# @return [Hash] Returns the value in the form of hash
|
221
|
+
def _to_hash(value)
|
222
|
+
if value.is_a?(Array)
|
223
|
+
value.compact.map { |v| _to_hash(v) }
|
224
|
+
elsif value.is_a?(Hash)
|
225
|
+
{}.tap do |hash|
|
226
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
227
|
+
end
|
228
|
+
elsif value.respond_to? :to_hash
|
229
|
+
value.to_hash
|
230
|
+
else
|
231
|
+
value
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
end
|
236
|
+
end
|
data/lib/cloudmersive-convert-api-client/models/docx_set_custom_metadata_properties_request.rb
ADDED
@@ -0,0 +1,223 @@
|
|
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.4.14
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module CloudmersiveConvertApiClient
|
16
|
+
# Request to set Word custom metadata properties
|
17
|
+
class DocxSetCustomMetadataPropertiesRequest
|
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
|
+
# Required: properties to set in the Word Document; provide one or more property definitions to set - be sure to specify the data type and value, together with the property name
|
25
|
+
attr_accessor :properties_to_set
|
26
|
+
|
27
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
28
|
+
def self.attribute_map
|
29
|
+
{
|
30
|
+
:'input_file_bytes' => :'InputFileBytes',
|
31
|
+
:'input_file_url' => :'InputFileUrl',
|
32
|
+
:'properties_to_set' => :'PropertiesToSet'
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
# Attribute type mapping.
|
37
|
+
def self.swagger_types
|
38
|
+
{
|
39
|
+
:'input_file_bytes' => :'String',
|
40
|
+
:'input_file_url' => :'String',
|
41
|
+
:'properties_to_set' => :'Array<DocxMetadataCustomProperty>'
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
return unless attributes.is_a?(Hash)
|
49
|
+
|
50
|
+
# convert string to symbol for hash key
|
51
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
52
|
+
|
53
|
+
if attributes.has_key?(:'InputFileBytes')
|
54
|
+
self.input_file_bytes = attributes[:'InputFileBytes']
|
55
|
+
end
|
56
|
+
|
57
|
+
if attributes.has_key?(:'InputFileUrl')
|
58
|
+
self.input_file_url = attributes[:'InputFileUrl']
|
59
|
+
end
|
60
|
+
|
61
|
+
if attributes.has_key?(:'PropertiesToSet')
|
62
|
+
if (value = attributes[:'PropertiesToSet']).is_a?(Array)
|
63
|
+
self.properties_to_set = value
|
64
|
+
end
|
65
|
+
end
|
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 !@input_file_bytes.nil? && @input_file_bytes !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
73
|
+
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}=)?$/.')
|
74
|
+
end
|
75
|
+
|
76
|
+
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 !@input_file_bytes.nil? && @input_file_bytes !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
83
|
+
true
|
84
|
+
end
|
85
|
+
|
86
|
+
# Custom attribute writer method with validation
|
87
|
+
# @param [Object] input_file_bytes Value to be assigned
|
88
|
+
def input_file_bytes=(input_file_bytes)
|
89
|
+
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}=)?$/)
|
90
|
+
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}=)?$/.'
|
91
|
+
end
|
92
|
+
|
93
|
+
@input_file_bytes = input_file_bytes
|
94
|
+
end
|
95
|
+
|
96
|
+
# Checks equality by comparing each attribute.
|
97
|
+
# @param [Object] Object to be compared
|
98
|
+
def ==(o)
|
99
|
+
return true if self.equal?(o)
|
100
|
+
self.class == o.class &&
|
101
|
+
input_file_bytes == o.input_file_bytes &&
|
102
|
+
input_file_url == o.input_file_url &&
|
103
|
+
properties_to_set == o.properties_to_set
|
104
|
+
end
|
105
|
+
|
106
|
+
# @see the `==` method
|
107
|
+
# @param [Object] Object to be compared
|
108
|
+
def eql?(o)
|
109
|
+
self == o
|
110
|
+
end
|
111
|
+
|
112
|
+
# Calculates hash code according to all attributes.
|
113
|
+
# @return [Fixnum] Hash code
|
114
|
+
def hash
|
115
|
+
[input_file_bytes, input_file_url, properties_to_set].hash
|
116
|
+
end
|
117
|
+
|
118
|
+
# Builds the object from hash
|
119
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
120
|
+
# @return [Object] Returns the model itself
|
121
|
+
def build_from_hash(attributes)
|
122
|
+
return nil unless attributes.is_a?(Hash)
|
123
|
+
self.class.swagger_types.each_pair do |key, type|
|
124
|
+
if type =~ /\AArray<(.*)>/i
|
125
|
+
# check to ensure the input is an array given that the attribute
|
126
|
+
# is documented as an array but the input is not
|
127
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
128
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
129
|
+
end
|
130
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
131
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
132
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
133
|
+
end
|
134
|
+
|
135
|
+
self
|
136
|
+
end
|
137
|
+
|
138
|
+
# Deserializes the data based on type
|
139
|
+
# @param string type Data type
|
140
|
+
# @param string value Value to be deserialized
|
141
|
+
# @return [Object] Deserialized data
|
142
|
+
def _deserialize(type, value)
|
143
|
+
case type.to_sym
|
144
|
+
when :DateTime
|
145
|
+
DateTime.parse(value)
|
146
|
+
when :Date
|
147
|
+
Date.parse(value)
|
148
|
+
when :String
|
149
|
+
value.to_s
|
150
|
+
when :Integer
|
151
|
+
value.to_i
|
152
|
+
when :Float
|
153
|
+
value.to_f
|
154
|
+
when :BOOLEAN
|
155
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
156
|
+
true
|
157
|
+
else
|
158
|
+
false
|
159
|
+
end
|
160
|
+
when :Object
|
161
|
+
# generic object (usually a Hash), return directly
|
162
|
+
value
|
163
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
164
|
+
inner_type = Regexp.last_match[:inner_type]
|
165
|
+
value.map { |v| _deserialize(inner_type, v) }
|
166
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
167
|
+
k_type = Regexp.last_match[:k_type]
|
168
|
+
v_type = Regexp.last_match[:v_type]
|
169
|
+
{}.tap do |hash|
|
170
|
+
value.each do |k, v|
|
171
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
172
|
+
end
|
173
|
+
end
|
174
|
+
else # model
|
175
|
+
temp_model = CloudmersiveConvertApiClient.const_get(type).new
|
176
|
+
temp_model.build_from_hash(value)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
# Returns the string representation of the object
|
181
|
+
# @return [String] String presentation of the object
|
182
|
+
def to_s
|
183
|
+
to_hash.to_s
|
184
|
+
end
|
185
|
+
|
186
|
+
# to_body is an alias to to_hash (backward compatibility)
|
187
|
+
# @return [Hash] Returns the object in the form of hash
|
188
|
+
def to_body
|
189
|
+
to_hash
|
190
|
+
end
|
191
|
+
|
192
|
+
# Returns the object in the form of hash
|
193
|
+
# @return [Hash] Returns the object in the form of hash
|
194
|
+
def to_hash
|
195
|
+
hash = {}
|
196
|
+
self.class.attribute_map.each_pair do |attr, param|
|
197
|
+
value = self.send(attr)
|
198
|
+
next if value.nil?
|
199
|
+
hash[param] = _to_hash(value)
|
200
|
+
end
|
201
|
+
hash
|
202
|
+
end
|
203
|
+
|
204
|
+
# Outputs non-array value in the form of hash
|
205
|
+
# For object, use to_hash. Otherwise, just return the value
|
206
|
+
# @param [Object] value Any valid value
|
207
|
+
# @return [Hash] Returns the value in the form of hash
|
208
|
+
def _to_hash(value)
|
209
|
+
if value.is_a?(Array)
|
210
|
+
value.compact.map { |v| _to_hash(v) }
|
211
|
+
elsif value.is_a?(Hash)
|
212
|
+
{}.tap do |hash|
|
213
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
214
|
+
end
|
215
|
+
elsif value.respond_to? :to_hash
|
216
|
+
value.to_hash
|
217
|
+
else
|
218
|
+
value
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
end
|
223
|
+
end
|