Class: CommandTower::Messaging::Planner::DestinationPlan

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#excluded_destinationsObject (readonly)

Returns the value of attribute excluded_destinations

Returns:

  • (Object)

    the current value of excluded_destinations



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

def excluded_destinations
  @excluded_destinations
end

#inbox_selectedObject (readonly)

Returns the value of attribute inbox_selected

Returns:

  • (Object)

    the current value of inbox_selected



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

def inbox_selected
  @inbox_selected
end

#mandatoryObject (readonly)

Returns the value of attribute mandatory

Returns:

  • (Object)

    the current value of mandatory



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

def mandatory
  @mandatory
end

#notification_type_keyObject (readonly)

Returns the value of attribute notification_type_key

Returns:

  • (Object)

    the current value of notification_type_key



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

def notification_type_key
  @notification_type_key
end

#preference_evaluationObject (readonly)

Returns the value of attribute preference_evaluation

Returns:

  • (Object)

    the current value of preference_evaluation



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

def preference_evaluation
  @preference_evaluation
end

#recipient_idObject (readonly)

Returns the value of attribute recipient_id

Returns:

  • (Object)

    the current value of recipient_id



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

def recipient_id
  @recipient_id
end

#selected_channelsObject (readonly)

Returns the value of attribute selected_channels

Returns:

  • (Object)

    the current value of selected_channels



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

def selected_channels
  @selected_channels
end

Class Method Details

.build(notification_type_key:, recipient_id:, selected_channels:, inbox_selected:, excluded_destinations:, mandatory:, preference_evaluation:) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'app/services/command_tower/messaging/planner/destination_plan.rb', line 15

def self.build(
  notification_type_key:,
  recipient_id:,
  selected_channels:,
  inbox_selected:,
  excluded_destinations:,
  mandatory:,
  preference_evaluation:
)
  unless preference_evaluation.is_a?(Preferences::EvaluationResult)
    raise InvalidEvaluationError, "preference_evaluation must be a Preferences::EvaluationResult"
  end

  new(
    notification_type_key: notification_type_key.to_s,
    recipient_id:,
    selected_channels: Array(selected_channels).map(&:to_s).freeze,
    inbox_selected: !!inbox_selected,
    excluded_destinations: Array(excluded_destinations).freeze,
    mandatory: !!mandatory,
    preference_evaluation:,
  ).freeze
end