cloudmersive-convert-api-client 2.1.8 → 2.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +26 -7
- data/docs/DocumentEditingEditSession.md +9 -0
- data/docs/DocumentTransformEditSession.md +9 -0
- data/docs/DocxTableTableFillRequest.md +12 -0
- data/docs/DocxTableTableFillTableCell.md +9 -0
- data/docs/DocxTableTableFillTableRow.md +8 -0
- data/docs/EditDocumentApi.md +58 -3
- data/docs/EditHtmlApi.md +418 -0
- data/docs/EditPdfApi.md +6 -2
- data/docs/HtmlGetLanguageResult.md +9 -0
- data/docs/HtmlGetRelCanonicalUrlResult.md +9 -0
- data/docs/HtmlGetSitemapUrlResult.md +9 -0
- data/docs/MergeDocumentApi.md +2 -2
- data/docs/TransformDocumentApi.md +182 -6
- data/lib/cloudmersive-convert-api-client.rb +8 -0
- data/lib/cloudmersive-convert-api-client/api/edit_document_api.rb +56 -2
- data/lib/cloudmersive-convert-api-client/api/edit_html_api.rb +392 -0
- data/lib/cloudmersive-convert-api-client/api/edit_pdf_api.rb +3 -0
- data/lib/cloudmersive-convert-api-client/api/merge_document_api.rb +3 -3
- data/lib/cloudmersive-convert-api-client/api/transform_document_api.rb +181 -4
- data/lib/cloudmersive-convert-api-client/models/document_editing_edit_session.rb +196 -0
- data/lib/cloudmersive-convert-api-client/models/document_transform_edit_session.rb +196 -0
- data/lib/cloudmersive-convert-api-client/models/docx_table_table_fill_request.rb +243 -0
- data/lib/cloudmersive-convert-api-client/models/docx_table_table_fill_table_cell.rb +196 -0
- data/lib/cloudmersive-convert-api-client/models/docx_table_table_fill_table_row.rb +188 -0
- data/lib/cloudmersive-convert-api-client/models/html_get_language_result.rb +196 -0
- data/lib/cloudmersive-convert-api-client/models/html_get_rel_canonical_url_result.rb +196 -0
- data/lib/cloudmersive-convert-api-client/models/html_get_sitemap_url_result.rb +196 -0
- data/lib/cloudmersive-convert-api-client/version.rb +1 -1
- data/spec/api/edit_document_api_spec.rb +13 -1
- data/spec/api/edit_html_api_spec.rb +95 -0
- data/spec/api/edit_pdf_api_spec.rb +1 -0
- data/spec/api/merge_document_api_spec.rb +1 -1
- data/spec/api/transform_document_api_spec.rb +42 -2
- data/spec/models/document_editing_edit_session_spec.rb +47 -0
- data/spec/models/document_transform_edit_session_spec.rb +47 -0
- data/spec/models/docx_table_table_fill_request_spec.rb +65 -0
- data/spec/models/docx_table_table_fill_table_cell_spec.rb +47 -0
- data/spec/models/docx_table_table_fill_table_row_spec.rb +41 -0
- data/spec/models/html_get_language_result_spec.rb +47 -0
- data/spec/models/html_get_rel_canonical_url_result_spec.rb +47 -0
- data/spec/models/html_get_sitemap_url_result_spec.rb +47 -0
- metadata +26 -2
@@ -746,6 +746,7 @@ module CloudmersiveConvertApiClient
|
|
746
746
|
# Reduces the file size and optimizes the content of a PDF to minimize its file size.
|
747
747
|
# @param input_file Input file to perform the operation on.
|
748
748
|
# @param [Hash] opts the optional parameters
|
749
|
+
# @option opts [Float] :quality Quality level for the images in the PDF, ranging from 0.0 (low quality) to 1.0 (high quality); default is 0.3
|
749
750
|
# @return [String]
|
750
751
|
def edit_pdf_reduce_file_size(input_file, opts = {})
|
751
752
|
data, _status_code, _headers = edit_pdf_reduce_file_size_with_http_info(input_file, opts)
|
@@ -756,6 +757,7 @@ module CloudmersiveConvertApiClient
|
|
756
757
|
# Reduces the file size and optimizes the content of a PDF to minimize its file size.
|
757
758
|
# @param input_file Input file to perform the operation on.
|
758
759
|
# @param [Hash] opts the optional parameters
|
760
|
+
# @option opts [Float] :quality Quality level for the images in the PDF, ranging from 0.0 (low quality) to 1.0 (high quality); default is 0.3
|
759
761
|
# @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
|
760
762
|
def edit_pdf_reduce_file_size_with_http_info(input_file, opts = {})
|
761
763
|
if @api_client.config.debugging
|
@@ -777,6 +779,7 @@ module CloudmersiveConvertApiClient
|
|
777
779
|
header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
|
778
780
|
# HTTP header 'Content-Type'
|
779
781
|
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
782
|
+
header_params[:'quality'] = opts[:'quality'] if !opts[:'quality'].nil?
|
780
783
|
|
781
784
|
# form parameters
|
782
785
|
form_params = {}
|
@@ -172,7 +172,7 @@ module CloudmersiveConvertApiClient
|
|
172
172
|
# @param input_file1 First input file to perform the operation on.
|
173
173
|
# @param input_file2 Second input file to perform the operation on (more than 2 can be supplied).
|
174
174
|
# @param [Hash] opts the optional parameters
|
175
|
-
# @return [
|
175
|
+
# @return [String]
|
176
176
|
def merge_document_html(input_file1, input_file2, opts = {})
|
177
177
|
data, _status_code, _headers = merge_document_html_with_http_info(input_file1, input_file2, opts)
|
178
178
|
data
|
@@ -183,7 +183,7 @@ module CloudmersiveConvertApiClient
|
|
183
183
|
# @param input_file1 First input file to perform the operation on.
|
184
184
|
# @param input_file2 Second input file to perform the operation on (more than 2 can be supplied).
|
185
185
|
# @param [Hash] opts the optional parameters
|
186
|
-
# @return [Array<(
|
186
|
+
# @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
|
187
187
|
def merge_document_html_with_http_info(input_file1, input_file2, opts = {})
|
188
188
|
if @api_client.config.debugging
|
189
189
|
@api_client.config.logger.debug 'Calling API: MergeDocumentApi.merge_document_html ...'
|
@@ -223,7 +223,7 @@ module CloudmersiveConvertApiClient
|
|
223
223
|
:form_params => form_params,
|
224
224
|
:body => post_body,
|
225
225
|
:auth_names => auth_names,
|
226
|
-
:return_type => '
|
226
|
+
:return_type => 'String')
|
227
227
|
if @api_client.config.debugging
|
228
228
|
@api_client.config.logger.debug "API called: MergeDocumentApi#merge_document_html\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
229
229
|
end
|
@@ -19,7 +19,7 @@ module CloudmersiveConvertApiClient
|
|
19
19
|
def initialize(api_client = ApiClient.default)
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
|
-
# Replace string in Word DOCX document
|
22
|
+
# Replace string in Word DOCX document, return result
|
23
23
|
# Replace all instances of a string in an Office Word Document (docx)
|
24
24
|
# @param match_string String to search for and match against, to be replaced
|
25
25
|
# @param replace_string String to replace the matched values with
|
@@ -33,7 +33,7 @@ module CloudmersiveConvertApiClient
|
|
33
33
|
data
|
34
34
|
end
|
35
35
|
|
36
|
-
# Replace string in Word DOCX document
|
36
|
+
# Replace string in Word DOCX document, return result
|
37
37
|
# Replace all instances of a string in an Office Word Document (docx)
|
38
38
|
# @param match_string String to search for and match against, to be replaced
|
39
39
|
# @param replace_string String to replace the matched values with
|
@@ -88,7 +88,184 @@ module CloudmersiveConvertApiClient
|
|
88
88
|
end
|
89
89
|
return data, status_code, headers
|
90
90
|
end
|
91
|
-
# Replace string in
|
91
|
+
# Replace string in Word DOCX document, return edit session
|
92
|
+
# Replace all instances of a string in an Office Word Document (docx). Returns an edit session URL so that you can chain together multiple edit operations without having to send the entire document contents back and forth multiple times. Call the Finish Editing API to retrieve the final document once editing is complete.
|
93
|
+
# @param match_string String to search for and match against, to be replaced
|
94
|
+
# @param replace_string String to replace the matched values with
|
95
|
+
# @param [Hash] opts the optional parameters
|
96
|
+
# @option opts [File] :input_file Optional: Input file to perform the operation on.
|
97
|
+
# @option opts [String] :input_file_url 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 (part of EditDocumentApi) to upload a document and pass in the secure URL result from that operation as the URL here (this URL is not public).
|
98
|
+
# @option opts [BOOLEAN] :match_case Optional: True if the case should be matched, false for case insensitive match. Default is false.
|
99
|
+
# @return [DocumentTransformEditSession]
|
100
|
+
def transform_document_docx_replace_edit_session(match_string, replace_string, opts = {})
|
101
|
+
data, _status_code, _headers = transform_document_docx_replace_edit_session_with_http_info(match_string, replace_string, opts)
|
102
|
+
data
|
103
|
+
end
|
104
|
+
|
105
|
+
# Replace string in Word DOCX document, return edit session
|
106
|
+
# Replace all instances of a string in an Office Word Document (docx). Returns an edit session URL so that you can chain together multiple edit operations without having to send the entire document contents back and forth multiple times. Call the Finish Editing API to retrieve the final document once editing is complete.
|
107
|
+
# @param match_string String to search for and match against, to be replaced
|
108
|
+
# @param replace_string String to replace the matched values with
|
109
|
+
# @param [Hash] opts the optional parameters
|
110
|
+
# @option opts [File] :input_file Optional: Input file to perform the operation on.
|
111
|
+
# @option opts [String] :input_file_url 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 (part of EditDocumentApi) to upload a document and pass in the secure URL result from that operation as the URL here (this URL is not public).
|
112
|
+
# @option opts [BOOLEAN] :match_case Optional: True if the case should be matched, false for case insensitive match. Default is false.
|
113
|
+
# @return [Array<(DocumentTransformEditSession, Fixnum, Hash)>] DocumentTransformEditSession data, response status code and response headers
|
114
|
+
def transform_document_docx_replace_edit_session_with_http_info(match_string, replace_string, opts = {})
|
115
|
+
if @api_client.config.debugging
|
116
|
+
@api_client.config.logger.debug 'Calling API: TransformDocumentApi.transform_document_docx_replace_edit_session ...'
|
117
|
+
end
|
118
|
+
# verify the required parameter 'match_string' is set
|
119
|
+
if @api_client.config.client_side_validation && match_string.nil?
|
120
|
+
fail ArgumentError, "Missing the required parameter 'match_string' when calling TransformDocumentApi.transform_document_docx_replace_edit_session"
|
121
|
+
end
|
122
|
+
# verify the required parameter 'replace_string' is set
|
123
|
+
if @api_client.config.client_side_validation && replace_string.nil?
|
124
|
+
fail ArgumentError, "Missing the required parameter 'replace_string' when calling TransformDocumentApi.transform_document_docx_replace_edit_session"
|
125
|
+
end
|
126
|
+
# resource path
|
127
|
+
local_var_path = '/convert/transform/docx/replace-all/edit-session'
|
128
|
+
|
129
|
+
# query parameters
|
130
|
+
query_params = {}
|
131
|
+
|
132
|
+
# header parameters
|
133
|
+
header_params = {}
|
134
|
+
# HTTP header 'Accept' (if needed)
|
135
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
136
|
+
header_params[:'matchString'] = match_string
|
137
|
+
header_params[:'replaceString'] = replace_string
|
138
|
+
header_params[:'inputFileUrl'] = opts[:'input_file_url'] if !opts[:'input_file_url'].nil?
|
139
|
+
header_params[:'matchCase'] = opts[:'match_case'] if !opts[:'match_case'].nil?
|
140
|
+
|
141
|
+
# form parameters
|
142
|
+
form_params = {}
|
143
|
+
form_params['inputFile'] = opts[:'input_file'] if !opts[:'input_file'].nil?
|
144
|
+
|
145
|
+
# http body (model)
|
146
|
+
post_body = nil
|
147
|
+
auth_names = ['Apikey']
|
148
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
149
|
+
:header_params => header_params,
|
150
|
+
:query_params => query_params,
|
151
|
+
:form_params => form_params,
|
152
|
+
:body => post_body,
|
153
|
+
:auth_names => auth_names,
|
154
|
+
:return_type => 'DocumentTransformEditSession')
|
155
|
+
if @api_client.config.debugging
|
156
|
+
@api_client.config.logger.debug "API called: TransformDocumentApi#transform_document_docx_replace_edit_session\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
157
|
+
end
|
158
|
+
return data, status_code, headers
|
159
|
+
end
|
160
|
+
# Fill in data in a table in a Word DOCX document, return result
|
161
|
+
# Replace placeholder rows ina table in an Office Word Document (docx) using one or more templates
|
162
|
+
# @param request
|
163
|
+
# @param [Hash] opts the optional parameters
|
164
|
+
# @return [String]
|
165
|
+
def transform_document_docx_table_fill_in(request, opts = {})
|
166
|
+
data, _status_code, _headers = transform_document_docx_table_fill_in_with_http_info(request, opts)
|
167
|
+
data
|
168
|
+
end
|
169
|
+
|
170
|
+
# Fill in data in a table in a Word DOCX document, return result
|
171
|
+
# Replace placeholder rows ina table in an Office Word Document (docx) using one or more templates
|
172
|
+
# @param request
|
173
|
+
# @param [Hash] opts the optional parameters
|
174
|
+
# @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
|
175
|
+
def transform_document_docx_table_fill_in_with_http_info(request, opts = {})
|
176
|
+
if @api_client.config.debugging
|
177
|
+
@api_client.config.logger.debug 'Calling API: TransformDocumentApi.transform_document_docx_table_fill_in ...'
|
178
|
+
end
|
179
|
+
# verify the required parameter 'request' is set
|
180
|
+
if @api_client.config.client_side_validation && request.nil?
|
181
|
+
fail ArgumentError, "Missing the required parameter 'request' when calling TransformDocumentApi.transform_document_docx_table_fill_in"
|
182
|
+
end
|
183
|
+
# resource path
|
184
|
+
local_var_path = '/convert/transform/docx/table/fill/data'
|
185
|
+
|
186
|
+
# query parameters
|
187
|
+
query_params = {}
|
188
|
+
|
189
|
+
# header parameters
|
190
|
+
header_params = {}
|
191
|
+
# HTTP header 'Accept' (if needed)
|
192
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
|
193
|
+
# HTTP header 'Content-Type'
|
194
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
|
195
|
+
|
196
|
+
# form parameters
|
197
|
+
form_params = {}
|
198
|
+
|
199
|
+
# http body (model)
|
200
|
+
post_body = @api_client.object_to_http_body(request)
|
201
|
+
auth_names = ['Apikey']
|
202
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
203
|
+
:header_params => header_params,
|
204
|
+
:query_params => query_params,
|
205
|
+
:form_params => form_params,
|
206
|
+
:body => post_body,
|
207
|
+
:auth_names => auth_names,
|
208
|
+
:return_type => 'String')
|
209
|
+
if @api_client.config.debugging
|
210
|
+
@api_client.config.logger.debug "API called: TransformDocumentApi#transform_document_docx_table_fill_in\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
211
|
+
end
|
212
|
+
return data, status_code, headers
|
213
|
+
end
|
214
|
+
# Fill in data in a table in a Word DOCX document, return edit session
|
215
|
+
# Replace placeholder rows ina table in an Office Word Document (docx) using one or more templates. Returns an edit session URL so that you can chain together multiple edit operations without having to send the entire document contents back and forth multiple times. Call the Finish Editing API to retrieve the final document once editing is complete.
|
216
|
+
# @param request
|
217
|
+
# @param [Hash] opts the optional parameters
|
218
|
+
# @return [DocumentTransformEditSession]
|
219
|
+
def transform_document_docx_table_fill_in_edit_session(request, opts = {})
|
220
|
+
data, _status_code, _headers = transform_document_docx_table_fill_in_edit_session_with_http_info(request, opts)
|
221
|
+
data
|
222
|
+
end
|
223
|
+
|
224
|
+
# Fill in data in a table in a Word DOCX document, return edit session
|
225
|
+
# Replace placeholder rows ina table in an Office Word Document (docx) using one or more templates. Returns an edit session URL so that you can chain together multiple edit operations without having to send the entire document contents back and forth multiple times. Call the Finish Editing API to retrieve the final document once editing is complete.
|
226
|
+
# @param request
|
227
|
+
# @param [Hash] opts the optional parameters
|
228
|
+
# @return [Array<(DocumentTransformEditSession, Fixnum, Hash)>] DocumentTransformEditSession data, response status code and response headers
|
229
|
+
def transform_document_docx_table_fill_in_edit_session_with_http_info(request, opts = {})
|
230
|
+
if @api_client.config.debugging
|
231
|
+
@api_client.config.logger.debug 'Calling API: TransformDocumentApi.transform_document_docx_table_fill_in_edit_session ...'
|
232
|
+
end
|
233
|
+
# verify the required parameter 'request' is set
|
234
|
+
if @api_client.config.client_side_validation && request.nil?
|
235
|
+
fail ArgumentError, "Missing the required parameter 'request' when calling TransformDocumentApi.transform_document_docx_table_fill_in_edit_session"
|
236
|
+
end
|
237
|
+
# resource path
|
238
|
+
local_var_path = '/convert/transform/docx/table/fill/data/edit-session'
|
239
|
+
|
240
|
+
# query parameters
|
241
|
+
query_params = {}
|
242
|
+
|
243
|
+
# header parameters
|
244
|
+
header_params = {}
|
245
|
+
# HTTP header 'Accept' (if needed)
|
246
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
247
|
+
# HTTP header 'Content-Type'
|
248
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
|
249
|
+
|
250
|
+
# form parameters
|
251
|
+
form_params = {}
|
252
|
+
|
253
|
+
# http body (model)
|
254
|
+
post_body = @api_client.object_to_http_body(request)
|
255
|
+
auth_names = ['Apikey']
|
256
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
257
|
+
:header_params => header_params,
|
258
|
+
:query_params => query_params,
|
259
|
+
:form_params => form_params,
|
260
|
+
:body => post_body,
|
261
|
+
:auth_names => auth_names,
|
262
|
+
:return_type => 'DocumentTransformEditSession')
|
263
|
+
if @api_client.config.debugging
|
264
|
+
@api_client.config.logger.debug "API called: TransformDocumentApi#transform_document_docx_table_fill_in_edit_session\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
265
|
+
end
|
266
|
+
return data, status_code, headers
|
267
|
+
end
|
268
|
+
# Replace string in PowerPoint PPTX presentation, return result
|
92
269
|
# Replace all instances of a string in an Office PowerPoint Document (pptx)
|
93
270
|
# @param match_string String to search for and match against, to be replaced
|
94
271
|
# @param replace_string String to replace the matched values with
|
@@ -102,7 +279,7 @@ module CloudmersiveConvertApiClient
|
|
102
279
|
data
|
103
280
|
end
|
104
281
|
|
105
|
-
# Replace string in PowerPoint PPTX presentation
|
282
|
+
# Replace string in PowerPoint PPTX presentation, return result
|
106
283
|
# Replace all instances of a string in an Office PowerPoint Document (pptx)
|
107
284
|
# @param match_string String to search for and match against, to be replaced
|
108
285
|
# @param replace_string String to replace the matched values with
|
@@ -0,0 +1,196 @@
|
|
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
|
+
# Active document editing session result. To retrieve the document, use the Finish Editing API.
|
17
|
+
class DocumentEditingEditSession
|
18
|
+
# True if the operation was successful, false otherwise
|
19
|
+
attr_accessor :successful
|
20
|
+
|
21
|
+
# Document editing session URL; in-memory temporary cache link with TTL (Time-to-Live expiration) of 30 minutes. To retrieve the document, use the Finish Editing API.
|
22
|
+
attr_accessor :edit_session_url
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'successful' => :'Successful',
|
28
|
+
:'edit_session_url' => :'EditSessionURL'
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
# Attribute type mapping.
|
33
|
+
def self.swagger_types
|
34
|
+
{
|
35
|
+
:'successful' => :'BOOLEAN',
|
36
|
+
:'edit_session_url' => :'String'
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
# Initializes the object
|
41
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
42
|
+
def initialize(attributes = {})
|
43
|
+
return unless attributes.is_a?(Hash)
|
44
|
+
|
45
|
+
# convert string to symbol for hash key
|
46
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
47
|
+
|
48
|
+
if attributes.has_key?(:'Successful')
|
49
|
+
self.successful = attributes[:'Successful']
|
50
|
+
end
|
51
|
+
|
52
|
+
if attributes.has_key?(:'EditSessionURL')
|
53
|
+
self.edit_session_url = attributes[:'EditSessionURL']
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
58
|
+
# @return Array for valid properties with the reasons
|
59
|
+
def list_invalid_properties
|
60
|
+
invalid_properties = Array.new
|
61
|
+
invalid_properties
|
62
|
+
end
|
63
|
+
|
64
|
+
# Check to see if the all the properties in the model are valid
|
65
|
+
# @return true if the model is valid
|
66
|
+
def valid?
|
67
|
+
true
|
68
|
+
end
|
69
|
+
|
70
|
+
# Checks equality by comparing each attribute.
|
71
|
+
# @param [Object] Object to be compared
|
72
|
+
def ==(o)
|
73
|
+
return true if self.equal?(o)
|
74
|
+
self.class == o.class &&
|
75
|
+
successful == o.successful &&
|
76
|
+
edit_session_url == o.edit_session_url
|
77
|
+
end
|
78
|
+
|
79
|
+
# @see the `==` method
|
80
|
+
# @param [Object] Object to be compared
|
81
|
+
def eql?(o)
|
82
|
+
self == o
|
83
|
+
end
|
84
|
+
|
85
|
+
# Calculates hash code according to all attributes.
|
86
|
+
# @return [Fixnum] Hash code
|
87
|
+
def hash
|
88
|
+
[successful, edit_session_url].hash
|
89
|
+
end
|
90
|
+
|
91
|
+
# Builds the object from hash
|
92
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
93
|
+
# @return [Object] Returns the model itself
|
94
|
+
def build_from_hash(attributes)
|
95
|
+
return nil unless attributes.is_a?(Hash)
|
96
|
+
self.class.swagger_types.each_pair do |key, type|
|
97
|
+
if type =~ /\AArray<(.*)>/i
|
98
|
+
# check to ensure the input is an array given that the attribute
|
99
|
+
# is documented as an array but the input is not
|
100
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
101
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
102
|
+
end
|
103
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
104
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
105
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
106
|
+
end
|
107
|
+
|
108
|
+
self
|
109
|
+
end
|
110
|
+
|
111
|
+
# Deserializes the data based on type
|
112
|
+
# @param string type Data type
|
113
|
+
# @param string value Value to be deserialized
|
114
|
+
# @return [Object] Deserialized data
|
115
|
+
def _deserialize(type, value)
|
116
|
+
case type.to_sym
|
117
|
+
when :DateTime
|
118
|
+
DateTime.parse(value)
|
119
|
+
when :Date
|
120
|
+
Date.parse(value)
|
121
|
+
when :String
|
122
|
+
value.to_s
|
123
|
+
when :Integer
|
124
|
+
value.to_i
|
125
|
+
when :Float
|
126
|
+
value.to_f
|
127
|
+
when :BOOLEAN
|
128
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
129
|
+
true
|
130
|
+
else
|
131
|
+
false
|
132
|
+
end
|
133
|
+
when :Object
|
134
|
+
# generic object (usually a Hash), return directly
|
135
|
+
value
|
136
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
137
|
+
inner_type = Regexp.last_match[:inner_type]
|
138
|
+
value.map { |v| _deserialize(inner_type, v) }
|
139
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
140
|
+
k_type = Regexp.last_match[:k_type]
|
141
|
+
v_type = Regexp.last_match[:v_type]
|
142
|
+
{}.tap do |hash|
|
143
|
+
value.each do |k, v|
|
144
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
else # model
|
148
|
+
temp_model = CloudmersiveConvertApiClient.const_get(type).new
|
149
|
+
temp_model.build_from_hash(value)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
# Returns the string representation of the object
|
154
|
+
# @return [String] String presentation of the object
|
155
|
+
def to_s
|
156
|
+
to_hash.to_s
|
157
|
+
end
|
158
|
+
|
159
|
+
# to_body is an alias to to_hash (backward compatibility)
|
160
|
+
# @return [Hash] Returns the object in the form of hash
|
161
|
+
def to_body
|
162
|
+
to_hash
|
163
|
+
end
|
164
|
+
|
165
|
+
# Returns the object in the form of hash
|
166
|
+
# @return [Hash] Returns the object in the form of hash
|
167
|
+
def to_hash
|
168
|
+
hash = {}
|
169
|
+
self.class.attribute_map.each_pair do |attr, param|
|
170
|
+
value = self.send(attr)
|
171
|
+
next if value.nil?
|
172
|
+
hash[param] = _to_hash(value)
|
173
|
+
end
|
174
|
+
hash
|
175
|
+
end
|
176
|
+
|
177
|
+
# Outputs non-array value in the form of hash
|
178
|
+
# For object, use to_hash. Otherwise, just return the value
|
179
|
+
# @param [Object] value Any valid value
|
180
|
+
# @return [Hash] Returns the value in the form of hash
|
181
|
+
def _to_hash(value)
|
182
|
+
if value.is_a?(Array)
|
183
|
+
value.compact.map { |v| _to_hash(v) }
|
184
|
+
elsif value.is_a?(Hash)
|
185
|
+
{}.tap do |hash|
|
186
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
187
|
+
end
|
188
|
+
elsif value.respond_to? :to_hash
|
189
|
+
value.to_hash
|
190
|
+
else
|
191
|
+
value
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
end
|
196
|
+
end
|