Class: Operto::Tasks::Index

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

Constant Summary collapse

FILTER_MAPPINGS =
{
  property_id: 'PropertyID',
  task_rule_id: 'TaskRuleID',
  approved_start_date: 'ApprovedStartDate',
  approved_end_date: 'ApprovedEndDate',
  completed_start_date: 'CompletedStartDate',
  completed_end_date: 'CompletedEndDate',
  task_start_date: 'TaskStartDate',
  task_end_date: 'TaskEndDate'
}.freeze
DATE_KEYS =
%i[
  approved_start_date approved_end_date
  completed_start_date completed_end_date
  task_start_date task_end_date
].freeze
DEFAULT_SORT =
'TaskID desc'.freeze

Instance Method Summary collapse

Methods included from Operation

#call!, included

Instance Method Details

#call(attributes: {}, skip: 0, take: 50) ⇒ ::Dry::Monads::Result[::Hash[::Symbol, untyped]]

RBS:

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

Parameters:

  • attributes: (::Hash[::Symbol, untyped]) (defaults to: {})
  • skip: (::Integer) (defaults to: 0)
  • take: (::Integer) (defaults to: 50)

Returns:

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


27
28
29
30
31
32
33
34
35
# File 'lib/operto/tasks/index.rb', line 27

def call(attributes: {}, skip: 0, take: 50)
  validate_arguments!(attributes)

  query_params = build_query_params(attributes, skip, take)
  response = Operto::Client.connection.get('tasks', query_params)
  Operto::Client.handle_response(response) { |body| format_results(body) }
rescue StandardError => e
  Failure(e)
end