Class: Eco::API::UseCases::OozeSamples::OozeBaseCase

Inherits:
Common::Loaders::UseCase show all
Includes:
Helpers, Helpers::Rescuable
Defined in:
lib/eco/api/usecases/ooze_samples/ooze_base_case.rb

Direct Known Subclasses

OozeRunBaseCase, RegisterUpdateCase

Constant Summary collapse

SAVE_PATCH =
"ooze_patch_update.json".freeze
DRY_COUNT =
5

Constants included from Helpers::Filters

Helpers::Filters::FILTER_TIME_FORMAT

Instance Attribute Summary collapse

Attributes included from Language::AuxiliarLogger

#logger

Instance Method Summary collapse

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

#targetEcoportal::API::V2::Page (readonly)

current target ooze.

Returns:

  • (Ecoportal::API::V2::Page)

    the current value of target



2
3
4
# File 'lib/eco/api/usecases/ooze_samples/ooze_base_case.rb', line 2

def target
  @target
end

Instance Method Details

#main(_session, options, _usecase) ⇒ Object



14
15
16
17
18
19
# File 'lib/eco/api/usecases/ooze_samples/ooze_base_case.rb', line 14

def main(_session, options, _usecase)
  options[:end_get] = false
  raise "You need to inherit from this class ('#{self.class}') and call super with a block" unless block_given?
  @target = nil
  yield
end

#process_ooze(ooz = target) {|ooz| ... } ⇒ Object

Write here your script

Yields:

  • (ooz)


22
23
24
25
26
27
# File 'lib/eco/api/usecases/ooze_samples/ooze_base_case.rb', line 22

def process_ooze(ooz = target)
  ooz ||= ooze
  raise "You need to inherit from this class ('#{self.class}') and call super with a block" unless block_given?
  yield(ooz)
  update_ooze(ooz)
end