Class: CurationConcerns::Workflow::NotificationConfigurationParameter
- Inherits:
-
Object
- Object
- CurationConcerns::Workflow::NotificationConfigurationParameter
- Defined in:
- app/services/curation_concerns/workflow/notification_configuration_parameter.rb
Overview
In an effort to appease Rubocop, I’m crafting this parameter object. It makes more sense anyway.
Helps consolidate and map a notification configuration.
Instance Attribute Summary collapse
-
#notification_name ⇒ Object
Returns the value of attribute notification_name.
-
#notification_type ⇒ Object
Returns the value of attribute notification_type.
-
#reason ⇒ Object
Why are we sending the notification?.
-
#recipients ⇒ Object
Returns the value of attribute recipients.
-
#scope ⇒ Object
For the given reason, there is a scope for that reason.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(reason:, scope:, notification_name:, recipients:, notification_type:) ⇒ NotificationConfigurationParameter
constructor
A new instance of NotificationConfigurationParameter.
Constructor Details
#initialize(reason:, scope:, notification_name:, recipients:, notification_type:) ⇒ NotificationConfigurationParameter
Returns a new instance of NotificationConfigurationParameter.
22 23 24 25 26 27 28 |
# File 'app/services/curation_concerns/workflow/notification_configuration_parameter.rb', line 22 def initialize(reason:, scope:, notification_name:, recipients:, notification_type:) self.reason = reason self.scope = scope self.notification_name = notification_name self.recipients = recipients self.notification_type = notification_type end |
Instance Attribute Details
#notification_name ⇒ Object
Returns the value of attribute notification_name.
30 31 32 |
# File 'app/services/curation_concerns/workflow/notification_configuration_parameter.rb', line 30 def notification_name @notification_name end |
#notification_type ⇒ Object
Returns the value of attribute notification_type.
30 31 32 |
# File 'app/services/curation_concerns/workflow/notification_configuration_parameter.rb', line 30 def notification_type @notification_type end |
#reason ⇒ Object
Why are we sending the notification?
35 36 37 |
# File 'app/services/curation_concerns/workflow/notification_configuration_parameter.rb', line 35 def reason @reason end |
#recipients ⇒ Object
Returns the value of attribute recipients.
30 31 32 |
# File 'app/services/curation_concerns/workflow/notification_configuration_parameter.rb', line 30 def recipients @recipients end |
#scope ⇒ Object
For the given reason, there is a scope for that reason. Examples of scope include an action name or a state name.
39 40 41 |
# File 'app/services/curation_concerns/workflow/notification_configuration_parameter.rb', line 39 def scope @scope end |
Class Method Details
.build_from_workflow_action_configuration(workflow_action:, config:) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/services/curation_concerns/workflow/notification_configuration_parameter.rb', line 7 def self.build_from_workflow_action_configuration(workflow_action:, config:) notification_name = config.fetch(:name) notification_type = config.fetch(:notification_type) recipients = config.slice(:to, :cc, :bcc) new( notification_name: notification_name, reason: Sipity::NotifiableContext::REASON_ACTION_IS_TAKEN, recipients: recipients, notification_type: notification_type, scope: workflow_action ) end |