Class: Onlyoffice::DocsIntegrationSdk::DocumentServer::Client::CommandService
- Inherits:
-
Service
- Object
- Service
- Onlyoffice::DocsIntegrationSdk::DocumentServer::Client::CommandService
- Includes:
- CommandServing
- Defined in:
- lib/onlyoffice/docs_integration_sdk/document_server/client/command.rb
Overview
CommandService is an implementation of the CommandServing interface.
Defined Under Namespace
Classes: Error, Request, Result
Instance Method Summary collapse
-
#do(r) ⇒ Array(Result, Response)
do makes a request to the command 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 command service. It returns an empty result if an error occurs.
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 |
# File 'lib/onlyoffice/docs_integration_sdk/document_server/client/command.rb', line 378 def do(r) com, res = @client.post("coauthoring/CommandService.ashx", r.serialize) if res.error return [Result.new, res] end err = T.let(nil, T.untyped) begin if com && com.is_a?(Hash) && com.key?("error") err = Error.from_serialized(com["error"]) if err == Error::None err = nil ret = Result.from_hash(com) end elsif com ret = Result.from_hash(com) 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 |