Class: Eco::API::UseCases::OozeSamples::RegisterUpdateCase

Inherits:
OozeBaseCase show all
Includes:
Helpers::Creatable
Defined in:
lib/eco/api/usecases/ooze_samples/register_update_case.rb

Overview

Note:
  • You can define methods filters and search to change the target entries of the register
  • You need to define the process_ooze method

Use case to update a register This case expects options[:source][:register_id]

Direct Known Subclasses

RegisterMigrationCase, TargetOozesUpdateCase

Constant Summary

Constants inherited from OozeBaseCase

OozeBaseCase::DRY_COUNT, OozeBaseCase::SAVE_PATCH

Constants included from Helpers::Filters

Helpers::Filters::FILTER_TIME_FORMAT

Instance Attribute Summary collapse

Attributes inherited from OozeBaseCase

#target

Attributes included from Language::AuxiliarLogger

#logger

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helpers::Creatable

validate_base_type!

Methods included from Helpers::Rescuable

validate_base_type!

Methods included from Helpers::Filters

#date_range_filter, #days, #daystart, #field_key_name, #midnight, #previous_sunday, #set_time, #sunday, #tags_filter, #this_monday, #to_date_filter, #today, #weeks

Methods included from Helpers::Shortcuts

#bracked_regex, #clean_question, #is_number?, #non_letters_regex, #normalize_string, #object_reference, #same_string?, #simplify_string, #titleize, #to_i

Methods inherited from Common::Loaders::UseCase

cli, cli!, #cli_apply!, #initialize, type, #type

Methods inherited from Common::Loaders::CaseBase

#name, name_only_once!

Methods inherited from Common::Loaders::Base

<=>, created_at, #initialize, set_created_at!

Methods included from Common::ClassHelpers

#class_resolver, #descendants, #descendants?, #inheritable_attrs, #inheritable_class_vars, #inherited, #instance_variable_name, #new_class, #resolve_class, #to_constant

Methods included from Language::AuxiliarLogger

#log

Constructor Details

This class inherits a constructor from Eco::API::Common::Loaders::UseCase

Instance Attribute Details

#attempted_ooze_updatesObject (readonly)

Returns the value of attribute attempted_ooze_updates.



24
25
26
# File 'lib/eco/api/usecases/ooze_samples/register_update_case.rb', line 24

def attempted_ooze_updates
  @attempted_ooze_updates
end

#created_oozesObject (readonly)

Returns the value of attribute created_oozes.



25
26
27
# File 'lib/eco/api/usecases/ooze_samples/register_update_case.rb', line 25

def created_oozes
  @created_oozes
end

#dupped_search_oozesObject (readonly)

Returns the value of attribute dupped_search_oozes.



22
23
24
# File 'lib/eco/api/usecases/ooze_samples/register_update_case.rb', line 22

def dupped_search_oozes
  @dupped_search_oozes
end

#failed_update_oozesObject (readonly)

Returns the value of attribute failed_update_oozes.



24
25
26
# File 'lib/eco/api/usecases/ooze_samples/register_update_case.rb', line 24

def failed_update_oozes
  @failed_update_oozes
end

#non_retrieved_oozesObject (readonly)

Returns the value of attribute non_retrieved_oozes.



21
22
23
# File 'lib/eco/api/usecases/ooze_samples/register_update_case.rb', line 21

def non_retrieved_oozes
  @non_retrieved_oozes
end

#ooze_create_attemptsObject (readonly)

Returns the value of attribute ooze_create_attempts.



25
26
27
# File 'lib/eco/api/usecases/ooze_samples/register_update_case.rb', line 25

def ooze_create_attempts
  @ooze_create_attempts
end

#ooze_result_idsObject (readonly)

Returns the value of attribute ooze_result_ids.



23
24
25
# File 'lib/eco/api/usecases/ooze_samples/register_update_case.rb', line 23

def ooze_result_ids
  @ooze_result_ids
end

#retrieved_oozesObject (readonly)

Returns the value of attribute retrieved_oozes.



21
22
23
# File 'lib/eco/api/usecases/ooze_samples/register_update_case.rb', line 21

def retrieved_oozes
  @retrieved_oozes
end

#total_search_oozesObject (readonly)

Returns the value of attribute total_search_oozes.



22
23
24
# File 'lib/eco/api/usecases/ooze_samples/register_update_case.rb', line 22

def total_search_oozes
  @total_search_oozes
end

#updated_oozesObject (readonly)

Returns the value of attribute updated_oozes.



24
25
26
# File 'lib/eco/api/usecases/ooze_samples/register_update_case.rb', line 24

def updated_oozes
  @updated_oozes
end

Class Method Details

.batch_size(size = nil) ⇒ Integer

Returns the number of pages to be processed in each batch.

Returns:

  • (Integer)

    the number of pages to be processed in each batch



11
12
13
14
15
# File 'lib/eco/api/usecases/ooze_samples/register_update_case.rb', line 11

def batch_size(size = nil)
  @batch_size ||= 25
  return @batch_size unless size
  @batch_size = size
end

Instance Method Details

#main(session, options, usecase, mode: :legacy, &block) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/eco/api/usecases/ooze_samples/register_update_case.rb', line 27

def main(session, options, usecase, mode: :legacy, &block)
  init_kpis

  super(session, options, usecase) do
    if mode == :legacy
      with_each_entry do
        process_ooze(&block)
      end
    elsif mode == :delegate
      raise "You need to pass a block when running main in `:delegate` mode" unless block_given?
      yield
    end
  end

  log_kpis
end

#process_ooze(_ooze = target) ⇒ Object



44
45
46
# File 'lib/eco/api/usecases/ooze_samples/register_update_case.rb', line 44

def process_ooze(_ooze = target)
  raise "You need to define this method"
end