Class: Eco::API::UseCases::OozeSamples::RegisterUpdateCase
- Inherits:
-
OozeBaseCase
- Object
- Common::Loaders::Base
- Common::Loaders::CaseBase
- Common::Loaders::UseCase
- OozeBaseCase
- Eco::API::UseCases::OozeSamples::RegisterUpdateCase
- Defined in:
- lib/eco/api/usecases/ooze_samples/register_update_case.rb
Overview
- You can define methods
filters
andsearch
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
Constant Summary
Constants inherited from OozeBaseCase
OozeBaseCase::DRY_COUNT, OozeBaseCase::SAVE_PATCH
Instance Attribute Summary collapse
-
#dupped_search_oozes ⇒ Object
readonly
Returns the value of attribute dupped_search_oozes.
-
#failed_update_oozes ⇒ Object
readonly
Returns the value of attribute failed_update_oozes.
-
#non_retrieved_oozes ⇒ Object
readonly
Returns the value of attribute non_retrieved_oozes.
-
#ooze_result_ids ⇒ Object
readonly
Returns the value of attribute ooze_result_ids.
-
#retrieved_oozes ⇒ Object
readonly
Returns the value of attribute retrieved_oozes.
-
#total_search_oozes ⇒ Object
readonly
Returns the value of attribute total_search_oozes.
-
#updated_oozes ⇒ Object
readonly
Returns the value of attribute updated_oozes.
Attributes inherited from OozeBaseCase
#options, #session, #target, #usecase
Class Method Summary collapse
-
.batch_size(size = nil) ⇒ Integer
The number of pages to be processed in each batch.
Instance Method Summary collapse
Methods included from Helpers::Shortcuts
#clean_question, #is_number?, #normalize_string, #object_reference, #same_string?, #titleize, #to_i
Methods inherited from Common::Loaders::UseCase
Methods inherited from Common::Loaders::CaseBase
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
#dupped_search_oozes ⇒ Object (readonly)
Returns the value of attribute dupped_search_oozes.
21 22 23 |
# File 'lib/eco/api/usecases/ooze_samples/register_update_case.rb', line 21 def dupped_search_oozes @dupped_search_oozes end |
#failed_update_oozes ⇒ Object (readonly)
Returns the value of attribute failed_update_oozes.
22 23 24 |
# File 'lib/eco/api/usecases/ooze_samples/register_update_case.rb', line 22 def failed_update_oozes @failed_update_oozes end |
#non_retrieved_oozes ⇒ Object (readonly)
Returns the value of attribute non_retrieved_oozes.
20 21 22 |
# File 'lib/eco/api/usecases/ooze_samples/register_update_case.rb', line 20 def non_retrieved_oozes @non_retrieved_oozes end |
#ooze_result_ids ⇒ Object (readonly)
Returns the value of attribute ooze_result_ids.
22 23 24 |
# File 'lib/eco/api/usecases/ooze_samples/register_update_case.rb', line 22 def ooze_result_ids @ooze_result_ids end |
#retrieved_oozes ⇒ Object (readonly)
Returns the value of attribute retrieved_oozes.
20 21 22 |
# File 'lib/eco/api/usecases/ooze_samples/register_update_case.rb', line 20 def retrieved_oozes @retrieved_oozes end |
#total_search_oozes ⇒ Object (readonly)
Returns the value of attribute total_search_oozes.
21 22 23 |
# File 'lib/eco/api/usecases/ooze_samples/register_update_case.rb', line 21 def total_search_oozes @total_search_oozes end |
#updated_oozes ⇒ Object (readonly)
Returns the value of attribute updated_oozes.
22 23 24 |
# File 'lib/eco/api/usecases/ooze_samples/register_update_case.rb', line 22 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.
10 11 12 13 14 |
# File 'lib/eco/api/usecases/ooze_samples/register_update_case.rb', line 10 def batch_size(size = nil) @batch_size ||= 25 return @batch_size unless size @batch_size = size end |
Instance Method Details
#main(session, options, usecase, &block) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/eco/api/usecases/ooze_samples/register_update_case.rb', line 24 def main(session, , usecase, &block) @retrieved_oozes = 0 @non_retrieved_oozes = 0 @dupped_search_oozes = 0 @ooze_result_ids = {} @updated_oozes = 0 @failed_update_oozes = 0 super(session, , usecase) do with_each_entry do |ooze| process_ooze(&block) end end msg = "Run end:\n" msg += " • Search results: #{total_search_oozes}\n" msg += " • Duplicated search results #{dupped_search_oozes}\n" msg += " • Retrieved a total of #{retrieved_oozes}\n" msg += " • Could not get #{non_retrieved_oozes} oozes.\n" msg += " • Updated #{updated_oozes} oozes.\n" msg += " - Failed update on #{failed_update_oozes} oozes.\n" logger.info(msg) end |
#process_ooze(ooze = target) ⇒ Object
47 48 49 |
# File 'lib/eco/api/usecases/ooze_samples/register_update_case.rb', line 47 def process_ooze(ooze = target) raise "You need to define this method" end |