Class: Eco::API::UseCases::OozeSamples::OozeRunBaseCase

Inherits:
OozeBaseCase show all
Defined in:
lib/eco/api/usecases/ooze_samples/ooze_run_base_case.rb

Overview

Base class to run a script against a single ooze.

Direct Known Subclasses

OozeUpdateCase

Constant Summary collapse

SAVE_PATCH =
"ooze_patch_update.json"

Constants inherited from OozeBaseCase

Eco::API::UseCases::OozeSamples::OozeBaseCase::DRY_COUNT

Instance Attribute Summary collapse

Attributes inherited from OozeBaseCase

#target

Instance Method Summary collapse

Methods included from Helpers::Shortcuts

#clean_question, #normalize_string, #object_reference, #same_string?, #titleize

Methods inherited from Common::Loaders::UseCase

#initialize, type, #type

Methods inherited from Common::Loaders::CaseBase

#name, name_only_once!

Methods inherited from Common::Loaders::Base

<=>, created_at, #initialize, #name, 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

Constructor Details

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

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/eco/api/usecases/ooze_samples/ooze_run_base_case.rb', line 6

def options
  @options
end

#sessionObject (readonly)

Returns the value of attribute session.



6
7
8
# File 'lib/eco/api/usecases/ooze_samples/ooze_run_base_case.rb', line 6

def session
  @session
end

#usecaseObject (readonly)

Returns the value of attribute usecase.



6
7
8
# File 'lib/eco/api/usecases/ooze_samples/ooze_run_base_case.rb', line 6

def usecase
  @usecase
end

Instance Method Details

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



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

def main(session, options, usecase, &block)
  raise "You need to inherit from this class and call super with a block" unless block
  @session = session; @options = options; @usecase = usecase
  process_ooze(&block)
end

#process_ooze(ooze = target) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/eco/api/usecases/ooze_samples/ooze_run_base_case.rb', line 16

def process_ooze(ooze = target)
  raise "You need to inherit from this class and call super with a block" unless block_given?
  super(ooze) do
    yield(ooze)
    exit_if_no_changes!
  end
end