Sha256: 69814bec4aa82f31d4cbbf91121dfafce84874423de175b907e6b62f08b6692e

Contents?: true

Size: 1.09 KB

Versions: 16

Compression:

Stored size: 1.09 KB

Contents

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

          def process

            @cases.define("remove-account", type: :transform) do |people, session|
              update = session.job_group("main").new("update", type: :update, sets: [:core, :account])
              people.users.map do |person|
                person.account = nil
                update.add(person)
              end
            end

            @cases.define("remove-account", type: :sync) do |entries, people, session|
              update = session.job_group("main").new("update", type: :update, sets: [:core, :account])

              entries.each.with_index do |entry, i|
                if person = people.find(entry)
                  person.account = nil
                  update.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/remove_account_case.rb
eco-helpers-0.6.16 lib/eco/api/usecases/default_cases/remove_account_case.rb
eco-helpers-0.6.15 lib/eco/api/usecases/default_cases/remove_account_case.rb
eco-helpers-0.6.13 lib/eco/api/usecases/default_cases/remove_account_case.rb
eco-helpers-0.6.12 lib/eco/api/usecases/default_cases/remove_account_case.rb
eco-helpers-0.6.11 lib/eco/api/usecases/default_cases/remove_account_case.rb
eco-helpers-0.6.9 lib/eco/api/usecases/default_cases/remove_account_case.rb
eco-helpers-0.6.8 lib/eco/api/usecases/default_cases/remove_account_case.rb
eco-helpers-0.6.7 lib/eco/api/usecases/default_cases/remove_account_case.rb
eco-helpers-0.6.6 lib/eco/api/usecases/default_cases/remove_account_case.rb
eco-helpers-0.6.5 lib/eco/api/usecases/default_cases/remove_account_case.rb
eco-helpers-0.6.4 lib/eco/api/usecases/default_cases/remove_account_case.rb
eco-helpers-0.6.3 lib/eco/api/usecases/default_cases/remove_account_case.rb
eco-helpers-0.6.2 lib/eco/api/usecases/default_cases/remove_account_case.rb
eco-helpers-0.6.1 lib/eco/api/usecases/default_cases/remove_account_case.rb
eco-helpers-0.6.0 lib/eco/api/usecases/default_cases/remove_account_case.rb