Module: Eco::API::UseCases::GraphQL::Samples::Location::Command::DSL
- Defined in:
- lib/eco/api/usecases/graphql/samples/location/command/dsl.rb
Constant Summary
Constants included from TrackChangedIds
TrackChangedIds::REMAP_LOC_IDS_FILENAME, TrackChangedIds::REMAP_LOC_IDS_FOLDER
Constants included from Helpers::Location::Command::EndPoints::Optimizations
Helpers::Location::Command::EndPoints::Optimizations::DEFAULT_COMMANDS_PER_PAGE
Constants included from Helpers::Location::Base::TreeTracking
Helpers::Location::Base::TreeTracking::TAGTREE_BACKUP
Constants included from Service::TreeToList::Converter::Discarded
Service::TreeToList::Converter::Discarded::DISCARDED_NODES
Constants included from Service::TreeToList::Converter::NodeAttrMaps
Service::TreeToList::Converter::NodeAttrMaps::NODE_ATTR_MAPS
Constants included from Service::TreeToList::Output
Service::TreeToList::Output::OUT_FILENAME, Service::TreeToList::Output::OUT_FOLDER, Service::TreeToList::Output::OUT_HEADER, Service::TreeToList::Output::OUT_TIME_FORMAT
Instance Attribute Summary
Attributes included from Results
Attributes included from Lib::ErrorHandling
Attributes included from Language::AuxiliarLogger
Attributes included from TrackChangedIds
Attributes included from Helpers::Location::Base::TreeTracking
Instance Method Summary collapse
-
#input(commands, force_continue: force_continue?) ) ⇒ Object
With given the commands, it generates the input of the endpoint mutation.
- #inputs(nodes_diff = comparer, force_continue: force_continue?) ) ⇒ Object
- #print_diff_details? ⇒ Boolean
-
#process ⇒ Object
MAIN PROCESSOR.
Methods included from Results
#error?, #input_unit_response_class, #page_errors?, #result_errors?, #results, #run_results_class
Methods included from Language::AuxiliarLogger
Methods included from TrackChangedIds
#close_handling_tags_remap_csv, #generate_tags_remap_csv, #tags_remap_class, #tags_remap_csv_full_filename, #tags_remap_table, #timestamp_file, #update_tags_remap_table
Methods included from Helpers::Location::Command
#sliced_batches, #with_sliced_input
Methods included from Helpers::Location::Command::EndPoints
#add_commands, #create_draft, #delete_draft, #fetch_draft, #publish_draft
Methods included from Helpers::Location::Command::EndPoints::Optimizations
#commands_payload_without_structure_block, #commands_per_page, #create_payload_without_structure_block, #force_continue?, #publish_payload_without_structure_block
Methods included from Helpers::Location::Base
#live_tree, #session_live_tree, #tagtree_id, #target_structure_id, #target_structure_id_const
Methods included from Helpers::Location::Base::TreeTracking
#backup_tree, #track_current_tree, #track_current_tree?
Methods included from Service::TreeDiff
Instance Method Details
#input(commands, force_continue: force_continue?) ) ⇒ Object
With given the commands, it generates the input of the endpoint mutation.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/eco/api/usecases/graphql/samples/location/command/dsl.rb', line 14 def input(commands, force_continue: force_continue?) return unless (commands || []).any? results.draft ||= create_draft( current_tree.id, &create_payload_without_structure_block ).draft { clientMutationId: '', id: results.draft_id, commands: commands } end |
#inputs(nodes_diff = comparer, force_continue: force_continue?) ) ⇒ Object
this method should be overriden/re-implemented
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/eco/api/usecases/graphql/samples/location/command/dsl.rb', line 42 def inputs(nodes_diff = comparer, force_continue: force_continue?) {}.tap do |sequence| unless nodes_diff && nodes_diff.respond_to?(:commands) msg = "You should implement this method in your child class.\n" msg << "Which should yield the input Hash and the stage or descriptor.\n" msg << "Or you should provide the `nodes_diff` object." raise Eco::API::UseCases::GraphQL::Base::NotImplementedMethod, msg end nodes_diff.commands do |comms, stage| sequence[stage] = input(comms, force_continue: force_continue) end end.tap do |sequence| sequence.each do |stage, input| yield(input, stage) if block_given? end end end |
#print_diff_details? ⇒ Boolean
8 9 10 |
# File 'lib/eco/api/usecases/graphql/samples/location/command/dsl.rb', line 8 def print_diff_details? false end |
#process ⇒ Object
MAIN PROCESSOR
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/eco/api/usecases/graphql/samples/location/command/dsl.rb', line 62 def process self.error = false some_update = false with_error_handling do super if defined?(super) # The very first track of the current structure. # - This may trigger a backup of the tagtree. self.current_tree ||= live_tree results(current_tree) inputs( force_continue: force_continue? ) do |input, stage| next unless input some_update = true sliced_batches( input, desc: stage, &results_tracking_block(stage: stage) ) break if error? rescue StandardError => err log(:error) { err. } raise end end ensure rescued do next if exception refetch_draft if some_update rearchive end rescued { delete_or_publish_draft } rescued { manage_remaps_table } end |