Sha256: 13960a9132c1636f5a93ab17dad849be677a489b898392c8803253e07a6dcd7a
Contents?: true
Size: 1.53 KB
Versions: 16
Compression:
Stored size: 1.53 KB
Contents
module Eco module API module UseCases class DefaultCases class ChangeEMailCase < BaseCase def process @cases.define("change-email", type: :sync) do |entries, people, session| remove = session.job_group("main").new("remove account", type: :update, sets: :account) change = session.job_group("main").new("change email", type: :update, sets: :core) add_account = session.job_group("post").new("add account", type: :update, sets: :account) entries.each.with_index do |entry, i| person = people.find(entry) if !person session.logger.error("Entry(#{i}) - this person does not exist: #{entry.to_s(:identify)}") else unless entry.email.downcase == person.email account = person.account person.account = nil remove.add(person) new_email = entry.email change.add(person) do |person| person.sync person.email = new_email person end add_account.add(person) do |person| person.sync person.account = account person end end end end end end end end end end end
Version data entries
16 entries across 16 versions & 1 rubygems