Class: Operto::Tasks::Create

Inherits:
Object
  • Object
show all
Includes:
Operation, Shared
Defined in:
lib/operto/tasks/create.rb,
sig/operto.rbs

Instance Method Summary collapse

Methods included from Operation

#call!, included

Instance Method Details

#call(attributes:) ⇒ ::Dry::Monads::Result[::Hash[::Symbol, untyped]]

RBS:

  • (attributes: ::Hash[::Symbol, untyped]) -> Dry::Monads::Result[::Hash[::Symbol, untyped]]

Parameters:

  • attributes: (::Hash[::Symbol, untyped])

Returns:

  • (::Dry::Monads::Result[::Hash[::Symbol, untyped]])


8
9
10
11
12
13
14
15
16
17
# File 'lib/operto/tasks/create.rb', line 8

def call(attributes:)
  validate_arguments!(attributes)

  request_attributes = prepare_attributes(attributes)
  response = Operto::Client.connection.post('tasks', request_attributes)

  handle_task_response(response)
rescue StandardError => e
  Failure(e)
end