cloudmersive-convert-api-client 2.2.2 → 2.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +20 -4
- data/docs/DocxContentControl.md +8 -0
- data/docs/DocxSetFormFieldsRequest.md +10 -0
- data/docs/DocxTableSingleTableFill.md +10 -0
- data/docs/DocxTableTableFillMultiRequest.md +10 -0
- data/docs/EditDocumentApi.md +165 -0
- data/docs/FillHandlebarFormField.md +9 -0
- data/docs/GetDocxContentControlsResponse.md +9 -0
- data/docs/GetDocxGetFormFieldsResponse.md +10 -0
- data/docs/HandlebarFormField.md +8 -0
- data/docs/TransformDocumentApi.md +55 -0
- data/docs/ValidateDocumentApi.md +220 -0
- data/lib/cloudmersive-convert-api-client/api/edit_document_api.rb +164 -0
- data/lib/cloudmersive-convert-api-client/api/transform_document_api.rb +54 -0
- data/lib/cloudmersive-convert-api-client/api/validate_document_api.rb +220 -0
- data/lib/cloudmersive-convert-api-client/models/docx_content_control.rb +186 -0
- data/lib/cloudmersive-convert-api-client/models/docx_set_form_fields_request.rb +223 -0
- data/lib/cloudmersive-convert-api-client/models/docx_table_single_table_fill.rb +208 -0
- data/lib/cloudmersive-convert-api-client/models/docx_table_table_fill_multi_request.rb +223 -0
- data/lib/cloudmersive-convert-api-client/models/fill_handlebar_form_field.rb +196 -0
- data/lib/cloudmersive-convert-api-client/models/get_docx_content_controls_response.rb +198 -0
- data/lib/cloudmersive-convert-api-client/models/get_docx_get_form_fields_response.rb +210 -0
- data/lib/cloudmersive-convert-api-client/models/handlebar_form_field.rb +186 -0
- data/lib/cloudmersive-convert-api-client/version.rb +1 -1
- data/lib/cloudmersive-convert-api-client.rb +8 -0
- data/spec/api/edit_document_api_spec.rb +36 -0
- data/spec/api/transform_document_api_spec.rb +12 -0
- data/spec/api/validate_document_api_spec.rb +48 -0
- data/spec/models/docx_content_control_spec.rb +41 -0
- data/spec/models/docx_set_form_fields_request_spec.rb +53 -0
- data/spec/models/docx_table_single_table_fill_spec.rb +53 -0
- data/spec/models/docx_table_table_fill_multi_request_spec.rb +53 -0
- data/spec/models/fill_handlebar_form_field_spec.rb +47 -0
- data/spec/models/get_docx_content_controls_response_spec.rb +47 -0
- data/spec/models/get_docx_get_form_fields_response_spec.rb +53 -0
- data/spec/models/handlebar_form_field_spec.rb +41 -0
- metadata +26 -2
@@ -129,6 +129,61 @@ module CloudmersiveConvertApiClient
|
|
129
129
|
end
|
130
130
|
return data, status_code, headers
|
131
131
|
end
|
132
|
+
# Validate a Word 97-2003 Legacy document (DOC)
|
133
|
+
# Validate a Word 97-2003 Legacy document (DOC)
|
134
|
+
# @param input_file Input file to perform the operation on.
|
135
|
+
# @param [Hash] opts the optional parameters
|
136
|
+
# @return [DocumentValidationResult]
|
137
|
+
def validate_document_doc_validation(input_file, opts = {})
|
138
|
+
data, _status_code, _headers = validate_document_doc_validation_with_http_info(input_file, opts)
|
139
|
+
data
|
140
|
+
end
|
141
|
+
|
142
|
+
# Validate a Word 97-2003 Legacy document (DOC)
|
143
|
+
# Validate a Word 97-2003 Legacy document (DOC)
|
144
|
+
# @param input_file Input file to perform the operation on.
|
145
|
+
# @param [Hash] opts the optional parameters
|
146
|
+
# @return [Array<(DocumentValidationResult, Fixnum, Hash)>] DocumentValidationResult data, response status code and response headers
|
147
|
+
def validate_document_doc_validation_with_http_info(input_file, opts = {})
|
148
|
+
if @api_client.config.debugging
|
149
|
+
@api_client.config.logger.debug 'Calling API: ValidateDocumentApi.validate_document_doc_validation ...'
|
150
|
+
end
|
151
|
+
# verify the required parameter 'input_file' is set
|
152
|
+
if @api_client.config.client_side_validation && input_file.nil?
|
153
|
+
fail ArgumentError, "Missing the required parameter 'input_file' when calling ValidateDocumentApi.validate_document_doc_validation"
|
154
|
+
end
|
155
|
+
# resource path
|
156
|
+
local_var_path = '/convert/validate/doc'
|
157
|
+
|
158
|
+
# query parameters
|
159
|
+
query_params = {}
|
160
|
+
|
161
|
+
# header parameters
|
162
|
+
header_params = {}
|
163
|
+
# HTTP header 'Accept' (if needed)
|
164
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
165
|
+
# HTTP header 'Content-Type'
|
166
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
167
|
+
|
168
|
+
# form parameters
|
169
|
+
form_params = {}
|
170
|
+
form_params['inputFile'] = input_file
|
171
|
+
|
172
|
+
# http body (model)
|
173
|
+
post_body = nil
|
174
|
+
auth_names = ['Apikey']
|
175
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
176
|
+
:header_params => header_params,
|
177
|
+
:query_params => query_params,
|
178
|
+
:form_params => form_params,
|
179
|
+
:body => post_body,
|
180
|
+
:auth_names => auth_names,
|
181
|
+
:return_type => 'DocumentValidationResult')
|
182
|
+
if @api_client.config.debugging
|
183
|
+
@api_client.config.logger.debug "API called: ValidateDocumentApi#validate_document_doc_validation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
184
|
+
end
|
185
|
+
return data, status_code, headers
|
186
|
+
end
|
132
187
|
# Validate a Word document (DOCX)
|
133
188
|
# Validate a Word document (DOCX); if the document is not valid, identifies the errors in the document
|
134
189
|
# @param input_file Input file to perform the operation on.
|
@@ -789,6 +844,61 @@ module CloudmersiveConvertApiClient
|
|
789
844
|
end
|
790
845
|
return data, status_code, headers
|
791
846
|
end
|
847
|
+
# Validate a PowerPoint 97-2003 Legacy presentation (PPT)
|
848
|
+
# Validate a PowerPoint 97-2003 Legacy presentation (PPT)
|
849
|
+
# @param input_file Input file to perform the operation on.
|
850
|
+
# @param [Hash] opts the optional parameters
|
851
|
+
# @return [DocumentValidationResult]
|
852
|
+
def validate_document_ppt_validation(input_file, opts = {})
|
853
|
+
data, _status_code, _headers = validate_document_ppt_validation_with_http_info(input_file, opts)
|
854
|
+
data
|
855
|
+
end
|
856
|
+
|
857
|
+
# Validate a PowerPoint 97-2003 Legacy presentation (PPT)
|
858
|
+
# Validate a PowerPoint 97-2003 Legacy presentation (PPT)
|
859
|
+
# @param input_file Input file to perform the operation on.
|
860
|
+
# @param [Hash] opts the optional parameters
|
861
|
+
# @return [Array<(DocumentValidationResult, Fixnum, Hash)>] DocumentValidationResult data, response status code and response headers
|
862
|
+
def validate_document_ppt_validation_with_http_info(input_file, opts = {})
|
863
|
+
if @api_client.config.debugging
|
864
|
+
@api_client.config.logger.debug 'Calling API: ValidateDocumentApi.validate_document_ppt_validation ...'
|
865
|
+
end
|
866
|
+
# verify the required parameter 'input_file' is set
|
867
|
+
if @api_client.config.client_side_validation && input_file.nil?
|
868
|
+
fail ArgumentError, "Missing the required parameter 'input_file' when calling ValidateDocumentApi.validate_document_ppt_validation"
|
869
|
+
end
|
870
|
+
# resource path
|
871
|
+
local_var_path = '/convert/validate/ppt'
|
872
|
+
|
873
|
+
# query parameters
|
874
|
+
query_params = {}
|
875
|
+
|
876
|
+
# header parameters
|
877
|
+
header_params = {}
|
878
|
+
# HTTP header 'Accept' (if needed)
|
879
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
880
|
+
# HTTP header 'Content-Type'
|
881
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
882
|
+
|
883
|
+
# form parameters
|
884
|
+
form_params = {}
|
885
|
+
form_params['inputFile'] = input_file
|
886
|
+
|
887
|
+
# http body (model)
|
888
|
+
post_body = nil
|
889
|
+
auth_names = ['Apikey']
|
890
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
891
|
+
:header_params => header_params,
|
892
|
+
:query_params => query_params,
|
893
|
+
:form_params => form_params,
|
894
|
+
:body => post_body,
|
895
|
+
:auth_names => auth_names,
|
896
|
+
:return_type => 'DocumentValidationResult')
|
897
|
+
if @api_client.config.debugging
|
898
|
+
@api_client.config.logger.debug "API called: ValidateDocumentApi#validate_document_ppt_validation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
899
|
+
end
|
900
|
+
return data, status_code, headers
|
901
|
+
end
|
792
902
|
# Validate a PowerPoint presentation (PPTX)
|
793
903
|
# Validate a PowerPoint presentation (PPTX); if the document is not valid, identifies the errors in the document
|
794
904
|
# @param input_file Input file to perform the operation on.
|
@@ -899,6 +1009,61 @@ module CloudmersiveConvertApiClient
|
|
899
1009
|
end
|
900
1010
|
return data, status_code, headers
|
901
1011
|
end
|
1012
|
+
# Validate a Rich Text Format document (RTF)
|
1013
|
+
# Validate a Rich Text Format document (RTF)
|
1014
|
+
# @param input_file Input file to perform the operation on.
|
1015
|
+
# @param [Hash] opts the optional parameters
|
1016
|
+
# @return [DocumentValidationResult]
|
1017
|
+
def validate_document_rtf_validation(input_file, opts = {})
|
1018
|
+
data, _status_code, _headers = validate_document_rtf_validation_with_http_info(input_file, opts)
|
1019
|
+
data
|
1020
|
+
end
|
1021
|
+
|
1022
|
+
# Validate a Rich Text Format document (RTF)
|
1023
|
+
# Validate a Rich Text Format document (RTF)
|
1024
|
+
# @param input_file Input file to perform the operation on.
|
1025
|
+
# @param [Hash] opts the optional parameters
|
1026
|
+
# @return [Array<(DocumentValidationResult, Fixnum, Hash)>] DocumentValidationResult data, response status code and response headers
|
1027
|
+
def validate_document_rtf_validation_with_http_info(input_file, opts = {})
|
1028
|
+
if @api_client.config.debugging
|
1029
|
+
@api_client.config.logger.debug 'Calling API: ValidateDocumentApi.validate_document_rtf_validation ...'
|
1030
|
+
end
|
1031
|
+
# verify the required parameter 'input_file' is set
|
1032
|
+
if @api_client.config.client_side_validation && input_file.nil?
|
1033
|
+
fail ArgumentError, "Missing the required parameter 'input_file' when calling ValidateDocumentApi.validate_document_rtf_validation"
|
1034
|
+
end
|
1035
|
+
# resource path
|
1036
|
+
local_var_path = '/convert/validate/rtf'
|
1037
|
+
|
1038
|
+
# query parameters
|
1039
|
+
query_params = {}
|
1040
|
+
|
1041
|
+
# header parameters
|
1042
|
+
header_params = {}
|
1043
|
+
# HTTP header 'Accept' (if needed)
|
1044
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
1045
|
+
# HTTP header 'Content-Type'
|
1046
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
1047
|
+
|
1048
|
+
# form parameters
|
1049
|
+
form_params = {}
|
1050
|
+
form_params['inputFile'] = input_file
|
1051
|
+
|
1052
|
+
# http body (model)
|
1053
|
+
post_body = nil
|
1054
|
+
auth_names = ['Apikey']
|
1055
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
1056
|
+
:header_params => header_params,
|
1057
|
+
:query_params => query_params,
|
1058
|
+
:form_params => form_params,
|
1059
|
+
:body => post_body,
|
1060
|
+
:auth_names => auth_names,
|
1061
|
+
:return_type => 'DocumentValidationResult')
|
1062
|
+
if @api_client.config.debugging
|
1063
|
+
@api_client.config.logger.debug "API called: ValidateDocumentApi#validate_document_rtf_validation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
1064
|
+
end
|
1065
|
+
return data, status_code, headers
|
1066
|
+
end
|
902
1067
|
# Validate a TAR Tarball Archive file (TAR)
|
903
1068
|
# Validate a TAR tarball archive file (TAR)
|
904
1069
|
# @param input_file Input file to perform the operation on.
|
@@ -1009,6 +1174,61 @@ module CloudmersiveConvertApiClient
|
|
1009
1174
|
end
|
1010
1175
|
return data, status_code, headers
|
1011
1176
|
end
|
1177
|
+
# Validate a Excel 97-2003 Legacy spreadsheet (XLS)
|
1178
|
+
# Validate a Excel 97-2003 Legacy spreadsheet (XLS)
|
1179
|
+
# @param input_file Input file to perform the operation on.
|
1180
|
+
# @param [Hash] opts the optional parameters
|
1181
|
+
# @return [DocumentValidationResult]
|
1182
|
+
def validate_document_xls_validation(input_file, opts = {})
|
1183
|
+
data, _status_code, _headers = validate_document_xls_validation_with_http_info(input_file, opts)
|
1184
|
+
data
|
1185
|
+
end
|
1186
|
+
|
1187
|
+
# Validate a Excel 97-2003 Legacy spreadsheet (XLS)
|
1188
|
+
# Validate a Excel 97-2003 Legacy spreadsheet (XLS)
|
1189
|
+
# @param input_file Input file to perform the operation on.
|
1190
|
+
# @param [Hash] opts the optional parameters
|
1191
|
+
# @return [Array<(DocumentValidationResult, Fixnum, Hash)>] DocumentValidationResult data, response status code and response headers
|
1192
|
+
def validate_document_xls_validation_with_http_info(input_file, opts = {})
|
1193
|
+
if @api_client.config.debugging
|
1194
|
+
@api_client.config.logger.debug 'Calling API: ValidateDocumentApi.validate_document_xls_validation ...'
|
1195
|
+
end
|
1196
|
+
# verify the required parameter 'input_file' is set
|
1197
|
+
if @api_client.config.client_side_validation && input_file.nil?
|
1198
|
+
fail ArgumentError, "Missing the required parameter 'input_file' when calling ValidateDocumentApi.validate_document_xls_validation"
|
1199
|
+
end
|
1200
|
+
# resource path
|
1201
|
+
local_var_path = '/convert/validate/xls'
|
1202
|
+
|
1203
|
+
# query parameters
|
1204
|
+
query_params = {}
|
1205
|
+
|
1206
|
+
# header parameters
|
1207
|
+
header_params = {}
|
1208
|
+
# HTTP header 'Accept' (if needed)
|
1209
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
1210
|
+
# HTTP header 'Content-Type'
|
1211
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
1212
|
+
|
1213
|
+
# form parameters
|
1214
|
+
form_params = {}
|
1215
|
+
form_params['inputFile'] = input_file
|
1216
|
+
|
1217
|
+
# http body (model)
|
1218
|
+
post_body = nil
|
1219
|
+
auth_names = ['Apikey']
|
1220
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
1221
|
+
:header_params => header_params,
|
1222
|
+
:query_params => query_params,
|
1223
|
+
:form_params => form_params,
|
1224
|
+
:body => post_body,
|
1225
|
+
:auth_names => auth_names,
|
1226
|
+
:return_type => 'DocumentValidationResult')
|
1227
|
+
if @api_client.config.debugging
|
1228
|
+
@api_client.config.logger.debug "API called: ValidateDocumentApi#validate_document_xls_validation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
1229
|
+
end
|
1230
|
+
return data, status_code, headers
|
1231
|
+
end
|
1012
1232
|
# Validate a Excel document (XLSX)
|
1013
1233
|
# Validate a Excel document (XLSX); if the document is not valid, identifies the errors in the document
|
1014
1234
|
# @param input_file Input file to perform the operation on.
|
@@ -0,0 +1,186 @@
|
|
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
|
+
# Content Control instance
|
17
|
+
class DocxContentControl
|
18
|
+
# Text content value in the content control; text entered into the control
|
19
|
+
attr_accessor :value
|
20
|
+
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
+
def self.attribute_map
|
23
|
+
{
|
24
|
+
:'value' => :'Value'
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
# Attribute type mapping.
|
29
|
+
def self.swagger_types
|
30
|
+
{
|
31
|
+
:'value' => :'String'
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
# Initializes the object
|
36
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
37
|
+
def initialize(attributes = {})
|
38
|
+
return unless attributes.is_a?(Hash)
|
39
|
+
|
40
|
+
# convert string to symbol for hash key
|
41
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
42
|
+
|
43
|
+
if attributes.has_key?(:'Value')
|
44
|
+
self.value = attributes[:'Value']
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
49
|
+
# @return Array for valid properties with the reasons
|
50
|
+
def list_invalid_properties
|
51
|
+
invalid_properties = Array.new
|
52
|
+
invalid_properties
|
53
|
+
end
|
54
|
+
|
55
|
+
# Check to see if the all the properties in the model are valid
|
56
|
+
# @return true if the model is valid
|
57
|
+
def valid?
|
58
|
+
true
|
59
|
+
end
|
60
|
+
|
61
|
+
# Checks equality by comparing each attribute.
|
62
|
+
# @param [Object] Object to be compared
|
63
|
+
def ==(o)
|
64
|
+
return true if self.equal?(o)
|
65
|
+
self.class == o.class &&
|
66
|
+
value == o.value
|
67
|
+
end
|
68
|
+
|
69
|
+
# @see the `==` method
|
70
|
+
# @param [Object] Object to be compared
|
71
|
+
def eql?(o)
|
72
|
+
self == o
|
73
|
+
end
|
74
|
+
|
75
|
+
# Calculates hash code according to all attributes.
|
76
|
+
# @return [Fixnum] Hash code
|
77
|
+
def hash
|
78
|
+
[value].hash
|
79
|
+
end
|
80
|
+
|
81
|
+
# Builds the object from hash
|
82
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
83
|
+
# @return [Object] Returns the model itself
|
84
|
+
def build_from_hash(attributes)
|
85
|
+
return nil unless attributes.is_a?(Hash)
|
86
|
+
self.class.swagger_types.each_pair do |key, type|
|
87
|
+
if type =~ /\AArray<(.*)>/i
|
88
|
+
# check to ensure the input is an array given that the attribute
|
89
|
+
# is documented as an array but the input is not
|
90
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
91
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
92
|
+
end
|
93
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
94
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
95
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
96
|
+
end
|
97
|
+
|
98
|
+
self
|
99
|
+
end
|
100
|
+
|
101
|
+
# Deserializes the data based on type
|
102
|
+
# @param string type Data type
|
103
|
+
# @param string value Value to be deserialized
|
104
|
+
# @return [Object] Deserialized data
|
105
|
+
def _deserialize(type, value)
|
106
|
+
case type.to_sym
|
107
|
+
when :DateTime
|
108
|
+
DateTime.parse(value)
|
109
|
+
when :Date
|
110
|
+
Date.parse(value)
|
111
|
+
when :String
|
112
|
+
value.to_s
|
113
|
+
when :Integer
|
114
|
+
value.to_i
|
115
|
+
when :Float
|
116
|
+
value.to_f
|
117
|
+
when :BOOLEAN
|
118
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
119
|
+
true
|
120
|
+
else
|
121
|
+
false
|
122
|
+
end
|
123
|
+
when :Object
|
124
|
+
# generic object (usually a Hash), return directly
|
125
|
+
value
|
126
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
127
|
+
inner_type = Regexp.last_match[:inner_type]
|
128
|
+
value.map { |v| _deserialize(inner_type, v) }
|
129
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
130
|
+
k_type = Regexp.last_match[:k_type]
|
131
|
+
v_type = Regexp.last_match[:v_type]
|
132
|
+
{}.tap do |hash|
|
133
|
+
value.each do |k, v|
|
134
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
else # model
|
138
|
+
temp_model = CloudmersiveConvertApiClient.const_get(type).new
|
139
|
+
temp_model.build_from_hash(value)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
# Returns the string representation of the object
|
144
|
+
# @return [String] String presentation of the object
|
145
|
+
def to_s
|
146
|
+
to_hash.to_s
|
147
|
+
end
|
148
|
+
|
149
|
+
# to_body is an alias to to_hash (backward compatibility)
|
150
|
+
# @return [Hash] Returns the object in the form of hash
|
151
|
+
def to_body
|
152
|
+
to_hash
|
153
|
+
end
|
154
|
+
|
155
|
+
# Returns the object in the form of hash
|
156
|
+
# @return [Hash] Returns the object in the form of hash
|
157
|
+
def to_hash
|
158
|
+
hash = {}
|
159
|
+
self.class.attribute_map.each_pair do |attr, param|
|
160
|
+
value = self.send(attr)
|
161
|
+
next if value.nil?
|
162
|
+
hash[param] = _to_hash(value)
|
163
|
+
end
|
164
|
+
hash
|
165
|
+
end
|
166
|
+
|
167
|
+
# Outputs non-array value in the form of hash
|
168
|
+
# For object, use to_hash. Otherwise, just return the value
|
169
|
+
# @param [Object] value Any valid value
|
170
|
+
# @return [Hash] Returns the value in the form of hash
|
171
|
+
def _to_hash(value)
|
172
|
+
if value.is_a?(Array)
|
173
|
+
value.compact.map { |v| _to_hash(v) }
|
174
|
+
elsif value.is_a?(Hash)
|
175
|
+
{}.tap do |hash|
|
176
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
177
|
+
end
|
178
|
+
elsif value.respond_to? :to_hash
|
179
|
+
value.to_hash
|
180
|
+
else
|
181
|
+
value
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
end
|
186
|
+
end
|
@@ -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 for DocxSetFormFields operation
|
17
|
+
class DocxSetFormFieldsRequest
|
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
|
+
# Handlebar style form fields to fill in; form field that is handlebar style, such as \"{{FieldName}}\"
|
25
|
+
attr_accessor :handlebar_fields_to_fill
|
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
|
+
:'handlebar_fields_to_fill' => :'HandlebarFieldsToFill'
|
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
|
+
:'handlebar_fields_to_fill' => :'Array<FillHandlebarFormField>'
|
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?(:'HandlebarFieldsToFill')
|
62
|
+
if (value = attributes[:'HandlebarFieldsToFill']).is_a?(Array)
|
63
|
+
self.handlebar_fields_to_fill = 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
|
+
handlebar_fields_to_fill == o.handlebar_fields_to_fill
|
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, handlebar_fields_to_fill].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
|