Sha256: 3624db593f99ce78f68aee42898c2cd04f4c119a07a110f70da70d24d3a14d7c

Contents?: true

Size: 917 Bytes

Versions: 5

Compression:

Stored size: 917 Bytes

Contents

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

          def process
            @cases.define("new-email", 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[:search]&.key?(:strict) || options.dig(:search, :strict))

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

5 entries across 5 versions & 1 rubygems

Version Path
eco-helpers-0.8.4 lib/eco/api/usecases/default_cases/new_email_case.rb
eco-helpers-0.8.3 lib/eco/api/usecases/default_cases/new_email_case.rb
eco-helpers-0.8.2 lib/eco/api/usecases/default_cases/new_email_case.rb
eco-helpers-0.8.1 lib/eco/api/usecases/default_cases/new_email_case.rb
eco-helpers-0.7.2 lib/eco/api/usecases/default_cases/new_email_case.rb