Sha256: b6867b9dd9d6a8f5d859ed402c28dc95bc762335674d086a87f19a4cd6c1306b

Contents?: true

Size: 1011 Bytes

Versions: 16

Compression:

Stored size: 1011 Bytes

Contents

module Eco
  module API
    module UseCases
      class DefaultCases
        class UpdateDetailsCase < BaseCase

          def process
            @cases.define("update-details", type: :sync) do |entries, people, session, options|
              job = session.job_group("main").new("update", type: :update, sets: [:core, :details])

              entries.each.with_index do |entry, i|
                if person = people.find(entry)
                  core_excluded = ["supervisor_id"]
                  core_excluded.push("email") if options.dig(:exclude, :email)
                  entry.set_core(person, exclude: core_excluded) unless options.dig(:exclude, :core)
                  entry.set_details(person)

                  job.add(person)
                else
                  session.logger.error("Entry(#{i}) - this person does not exist: #{entry.to_s(:identify)}")
                end
              end
            end
          end

        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
eco-helpers-0.6.17 lib/eco/api/usecases/default_cases/update_details_case.rb
eco-helpers-0.6.16 lib/eco/api/usecases/default_cases/update_details_case.rb
eco-helpers-0.6.15 lib/eco/api/usecases/default_cases/update_details_case.rb
eco-helpers-0.6.13 lib/eco/api/usecases/default_cases/update_details_case.rb
eco-helpers-0.6.12 lib/eco/api/usecases/default_cases/update_details_case.rb
eco-helpers-0.6.11 lib/eco/api/usecases/default_cases/update_details_case.rb
eco-helpers-0.6.9 lib/eco/api/usecases/default_cases/update_details_case.rb
eco-helpers-0.6.8 lib/eco/api/usecases/default_cases/update_details_case.rb
eco-helpers-0.6.7 lib/eco/api/usecases/default_cases/update_details_case.rb
eco-helpers-0.6.6 lib/eco/api/usecases/default_cases/update_details_case.rb
eco-helpers-0.6.5 lib/eco/api/usecases/default_cases/update_details_case.rb
eco-helpers-0.6.4 lib/eco/api/usecases/default_cases/update_details_case.rb
eco-helpers-0.6.3 lib/eco/api/usecases/default_cases/update_details_case.rb
eco-helpers-0.6.2 lib/eco/api/usecases/default_cases/update_details_case.rb
eco-helpers-0.6.1 lib/eco/api/usecases/default_cases/update_details_case.rb
eco-helpers-0.6.0 lib/eco/api/usecases/default_cases/update_details_case.rb