Class: Operto::StaffTasks::Create

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

Instance Method Summary collapse

Methods included from Operation

#call!, included

Instance Method Details

#call(task_id:, staff_id:, property_id:) ⇒ ::Dry::Monads::Result[::Hash[::Symbol, untyped]]

RBS:

  • (task_id: ::String, staff_id: ::String, property_id: ::String) -> Dry::Monads::Result[::Hash[::Symbol, untyped]]

Parameters:

  • task_id: (::String)
  • staff_id: (::String)
  • property_id: (::String)

Returns:

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


7
8
9
10
11
12
13
14
# File 'lib/operto/staff_tasks/create.rb', line 7

def call(task_id:, staff_id:, property_id:)
  validate_arguments!(task_id, staff_id, property_id)

  response = Operto::Client.connection.post('stafftasks', request_attributes(task_id, staff_id, property_id))
  Operto::Client.handle_response(response) { |body| { staff_task_id: body[:StaffTaskID] } }
rescue StandardError => e
  Failure(e)
end