Class: CommandTower::Messaging::Planner::ExcludedDestination

Inherits:
Data
  • Object
show all
Defined in:
app/services/command_tower/messaging/planner/excluded_destination.rb

Constant Summary collapse

ALLOWED_REASON_CLASSES =
(
  Preferences::ReasonClasses::ALL + RecipientReadiness::ReasonCodes::ALL
).freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#destinationObject (readonly)

Returns the value of attribute destination

Returns:

  • (Object)

    the current value of destination



6
7
8
# File 'app/services/command_tower/messaging/planner/excluded_destination.rb', line 6

def destination
  @destination
end

#reason_classObject (readonly)

Returns the value of attribute reason_class

Returns:

  • (Object)

    the current value of reason_class



6
7
8
# File 'app/services/command_tower/messaging/planner/excluded_destination.rb', line 6

def reason_class
  @reason_class
end

Class Method Details

.build(destination:, reason_class:) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/services/command_tower/messaging/planner/excluded_destination.rb', line 11

def self.build(destination:, reason_class:)
  unless ALLOWED_REASON_CLASSES.include?(reason_class)
    raise ArgumentError, "unknown reason_class: #{reason_class}"
  end

  dest =
    if destination == :inbox || destination == "inbox"
      :inbox
    else
      destination.to_s
    end

  new(destination: dest, reason_class:).freeze
end