Class: Onlyoffice::DocsIntegrationSdk::DocumentServer::Client::ConversionService
- Inherits:
-
Service
- Object
- Service
- Onlyoffice::DocsIntegrationSdk::DocumentServer::Client::ConversionService
- Includes:
- ConversionServing
- Defined in:
- lib/onlyoffice/docs_integration_sdk/document_server/client/conversion.rb
Overview
ConversionService is an implementation of the ConversionServing interface.
Defined Under Namespace
Classes: Error, Request, Result
Instance Method Summary collapse
-
#do(r) ⇒ Array(Result, Response)
do makes a request to the conversion service.
Methods inherited from Service
Constructor Details
This class inherits a constructor from Onlyoffice::DocsIntegrationSdk::DocumentServer::Client::Service
Instance Method Details
#do(r) ⇒ Array(Result, Response)
do makes a request to the conversion service. It returns an empty result if an error occurs.
442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 |
# File 'lib/onlyoffice/docs_integration_sdk/document_server/client/conversion.rb', line 442 def do(r) con, res = @client.post("ConvertService.ashx", r.serialize) if res.error return [Result.new, res] end err = T.let(nil, T.untyped) begin if con && con.is_a?(Hash) && con.key?("error") err = Error.from_serialized(con["error"]) elsif con ret = Result.from_hash(con) else ret = Result.new end rescue StandardError => e err = e end if err ret = Result.new res = Response.new( request: res.request, response: res.response, error: err, ) end [ret, res] end |