Sha256: fecd15d6347662078692333a7c81e13c11eb3885de1e559fd8db925a07596051

Contents?: true

Size: 885 Bytes

Versions: 1

Compression:

Stored size: 885 Bytes

Contents

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

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

              strict_search = session.config.people.strict_search? || options.dig(:search, :strict)

              entries.each.with_index do |entry, i|
                if person = people.find(entry, strict: strict_search)
                  person.external_id = entry.external_id
                  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

1 entries across 1 versions & 1 rubygems

Version Path
eco-helpers-0.7.1 lib/eco/api/usecases/default_cases/new_id_case.rb