Class: GroupDocsConversionCloud::AsyncApi

Inherits:
Object
  • Object
show all
Defined in:
lib/groupdocs_conversion_cloud/api/async_api.rb

Overview

GroupDocs.Conversion Cloud API

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ AsyncApi

Initializes new instance of AsyncApi

Parameters:



43
44
45
46
47
# File 'lib/groupdocs_conversion_cloud/api/async_api.rb', line 43

def initialize(config)
  @config = config
  @api_client = ApiClient.new(config)
  @access_token = nil
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



34
35
36
# File 'lib/groupdocs_conversion_cloud/api/async_api.rb', line 34

def config
  @config
end

Class Method Details

.from_config(config) ⇒ AsyncApi

Initializes new instance of AsyncApi

Parameters:

Returns:

  • (AsyncApi)

    New instance of AsyncApi



63
64
65
# File 'lib/groupdocs_conversion_cloud/api/async_api.rb', line 63

def self.from_config(config)
  return new(config)
end

.from_keys(app_sid, app_key) ⇒ AsyncApi

Initializes new instance of AsyncApi

Parameters:

  • Application (app_sid)

    identifier (App SID)

  • Application (app_key)

    private key (App Key)

Returns:

  • (AsyncApi)

    New instance of AsyncApi



54
55
56
57
# File 'lib/groupdocs_conversion_cloud/api/async_api.rb', line 54

def self.from_keys(app_sid, app_key)
  config = Configuration.new(app_sid, app_key)
  return new(config)
end

Instance Method Details

#get_operation_result(request) ⇒ File

Get async operation result

Parameters:

  • request

    get_operation_result_request

Returns:

  • (File)


71
72
73
74
# File 'lib/groupdocs_conversion_cloud/api/async_api.rb', line 71

def get_operation_result(request)
  data, _status_code, _headers = get_operation_result_with_http_info(request)
  data
end

#get_operation_result_with_http_info(request) ⇒ Array<(File, Fixnum, Hash)>

Get async operation result

File data, response status code and response headers

Parameters:

  • request

    get_operation_result_request

Returns:

  • (Array<(File, Fixnum, Hash)>)

Raises:

  • (ArgumentError)


81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/groupdocs_conversion_cloud/api/async_api.rb', line 81

def get_operation_result_with_http_info(request)
  raise ArgumentError, 'Incorrect request type' unless request.is_a? GetOperationResultRequest

  @api_client.config.logger.debug 'Calling API: AsyncApi.get_operation_result ...' if @api_client.config.debugging
  # verify the required parameter 'id' is set
  raise ArgumentError, 'Missing the required parameter id when calling AsyncApi.get_operation_result' if @api_client.config.client_side_validation && request.id.nil?
  # resource path
  local_var_path = '/conversion/async/result'

  # query parameters
  query_params = {}
  query_params[downcase_first_letter('id')] = request.id


  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
                                                    header_params: header_params,
                                                    query_params: query_params,
                                                    form_params: form_params,
                                                    body: post_body,
                                                    access_token: get_access_token,
                                                    return_type: 'File')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called:
    AsyncApi#get_operation_result\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  [data, status_code, headers]
end

#get_operation_status(request) ⇒ OperationResult

Get async operation status

Parameters:

  • request

    get_operation_status_request

Returns:



125
126
127
128
# File 'lib/groupdocs_conversion_cloud/api/async_api.rb', line 125

def get_operation_status(request)
  data, _status_code, _headers = get_operation_status_with_http_info(request)
  data
end

#get_operation_status_with_http_info(request) ⇒ Array<(OperationResult, Fixnum, Hash)>

Get async operation status

OperationResult data, response status code and response headers

Parameters:

  • request

    get_operation_status_request

Returns:

Raises:

  • (ArgumentError)


135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/groupdocs_conversion_cloud/api/async_api.rb', line 135

def get_operation_status_with_http_info(request)
  raise ArgumentError, 'Incorrect request type' unless request.is_a? GetOperationStatusRequest

  @api_client.config.logger.debug 'Calling API: AsyncApi.get_operation_status ...' if @api_client.config.debugging
  # verify the required parameter 'id' is set
  raise ArgumentError, 'Missing the required parameter id when calling AsyncApi.get_operation_status' if @api_client.config.client_side_validation && request.id.nil?
  # resource path
  local_var_path = '/conversion/async'

  # query parameters
  query_params = {}
  query_params[downcase_first_letter('id')] = request.id


  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
                                                    header_params: header_params,
                                                    query_params: query_params,
                                                    form_params: form_params,
                                                    body: post_body,
                                                    access_token: get_access_token,
                                                    return_type: 'OperationResult')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called:
    AsyncApi#get_operation_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  [data, status_code, headers]
end

#start_convert(request) ⇒ String

Starts async conversion specified input document, from request body, to format specified

Parameters:

  • request

    start_convert_request

Returns:

  • (String)


179
180
181
182
# File 'lib/groupdocs_conversion_cloud/api/async_api.rb', line 179

def start_convert(request)
  data, _status_code, _headers = start_convert_with_http_info(request)
  data
end

#start_convert_and_save(request) ⇒ String

Starts async conversion specified input document to format specified in the convertSettings with specified options

Parameters:

  • request

    start_convert_and_save_request

Returns:

  • (String)


246
247
248
249
# File 'lib/groupdocs_conversion_cloud/api/async_api.rb', line 246

def start_convert_and_save(request)
  data, _status_code, _headers = start_convert_and_save_with_http_info(request)
  data
end

#start_convert_and_save_with_http_info(request) ⇒ Array<(String, Fixnum, Hash)>

Starts async conversion specified input document to format specified in the convertSettings with specified options

String data, response status code and response headers

Parameters:

  • request

    start_convert_and_save_request

Returns:

  • (Array<(String, Fixnum, Hash)>)

Raises:

  • (ArgumentError)


256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
# File 'lib/groupdocs_conversion_cloud/api/async_api.rb', line 256

def start_convert_and_save_with_http_info(request)
  raise ArgumentError, 'Incorrect request type' unless request.is_a? StartConvertAndSaveRequest

  @api_client.config.logger.debug 'Calling API: AsyncApi.start_convert_and_save ...' if @api_client.config.debugging
  # verify the required parameter 'convert_settings' is set
  raise ArgumentError, 'Missing the required parameter convert_settings when calling AsyncApi.start_convert_and_save' if @api_client.config.client_side_validation && request.convert_settings.nil?
  # resource path
  local_var_path = '/conversion/async'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(request.convert_settings)
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
                                                    header_params: header_params,
                                                    query_params: query_params,
                                                    form_params: form_params,
                                                    body: post_body,
                                                    access_token: get_access_token,
                                                    return_type: 'String')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called:
    AsyncApi#start_convert_and_save\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  [data, status_code, headers]
end

#start_convert_with_http_info(request) ⇒ Array<(String, Fixnum, Hash)>

Starts async conversion specified input document, from request body, to format specified

String data, response status code and response headers

Parameters:

  • request

    start_convert_request

Returns:

  • (Array<(String, Fixnum, Hash)>)

Raises:

  • (ArgumentError)


189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# File 'lib/groupdocs_conversion_cloud/api/async_api.rb', line 189

def start_convert_with_http_info(request)
  raise ArgumentError, 'Incorrect request type' unless request.is_a? StartConvertRequest

  @api_client.config.logger.debug 'Calling API: AsyncApi.start_convert ...' if @api_client.config.debugging
  # verify the required parameter 'format' is set
  raise ArgumentError, 'Missing the required parameter format when calling AsyncApi.start_convert' if @api_client.config.client_side_validation && request.format.nil?
  # verify the required parameter 'file' is set
  raise ArgumentError, 'Missing the required parameter file when calling AsyncApi.start_convert' if @api_client.config.client_side_validation && request.file.nil?
  # resource path
  local_var_path = '/conversion/async'

  # query parameters
  query_params = {}
  query_params[downcase_first_letter('format')] = request.format

  if local_var_path.include? ('{' + downcase_first_letter('fromPage') + '}')
    local_var_path = local_var_path.sub('{' + downcase_first_letter('fromPage') + '}', request.from_page.to_s)
  else
    query_params[downcase_first_letter('fromPage')] = request.from_page unless request.from_page.nil?
  end
  if local_var_path.include? ('{' + downcase_first_letter('pagesCount') + '}')
    local_var_path = local_var_path.sub('{' + downcase_first_letter('pagesCount') + '}', request.pages_count.to_s)
  else
    query_params[downcase_first_letter('pagesCount')] = request.pages_count unless request.pages_count.nil?
  end

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])

  # form parameters
  form_params = {}
  form_params[downcase_first_letter('File')] = request.file

  # http body (model)
  post_body = nil
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
                                                    header_params: header_params,
                                                    query_params: query_params,
                                                    form_params: form_params,
                                                    body: post_body,
                                                    access_token: get_access_token,
                                                    return_type: 'String')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called:
    AsyncApi#start_convert\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  [data, status_code, headers]
end