OfficeMomsandDads/scheduler

View on GitHub
app/lib/services/notifications/shifts/recipients.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
# frozen_string_literal: true

module Services
  module Notifications
    class Shifts
      class Recipients
        include Adamantium::Flat
        include Concord.new(:shift, :action, :event_data)

        def recipients
          klass = case action
                    when :create
                      Create
                    when :update
                      Update
                    when :destroy
                      Destroy
                  end

          klass
            .new(shift, event_data)
            .recipients
            .select(&:phone?)
        end
      end
    end
  end
end