Class: Hyrax::Workflow::NotificationConfigurationParameter
- Inherits:
-
Object
- Object
- Hyrax::Workflow::NotificationConfigurationParameter
- Defined in:
- app/services/hyrax/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.
23 24 25 26 27 28 29 |
# File 'app/services/hyrax/workflow/notification_configuration_parameter.rb', line 23 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.
31 32 33 |
# File 'app/services/hyrax/workflow/notification_configuration_parameter.rb', line 31 def notification_name @notification_name end |
#notification_type ⇒ Object
Returns the value of attribute notification_type.
31 32 33 |
# File 'app/services/hyrax/workflow/notification_configuration_parameter.rb', line 31 def notification_type @notification_type end |
#reason ⇒ Object
Why are we sending the notification?
36 37 38 |
# File 'app/services/hyrax/workflow/notification_configuration_parameter.rb', line 36 def reason @reason end |
#recipients ⇒ Object
Returns the value of attribute recipients.
31 32 33 |
# File 'app/services/hyrax/workflow/notification_configuration_parameter.rb', line 31 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.
40 41 42 |
# File 'app/services/hyrax/workflow/notification_configuration_parameter.rb', line 40 def scope @scope end |
Class Method Details
.build_from_workflow_action_configuration(workflow_action:, config:) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/services/hyrax/workflow/notification_configuration_parameter.rb', line 8 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 |