Class: DispatchRider::NotificationServices::AwsSns
- Defined in:
- lib/dispatch-rider/notification_services/aws_sns.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#channel(name) ⇒ Object
not really happy with this, but the notification service registrar system is way too rigid to do this cleaner since you only can have one notifier for the whole service, but you need to create a new one for each region.
- #channel_registrar_builder ⇒ Object
- #notifier_builder ⇒ Object
- #publish_to_channel(channel, message:) ⇒ Object
Methods inherited from Base
#channels, #initialize, #publish
Constructor Details
This class inherits a constructor from DispatchRider::NotificationServices::Base
Instance Method Details
#channel(name) ⇒ Object
not really happy with this, but the notification service registrar system is way too rigid to do this cleaner since you only can have one notifier for the whole service, but you need to create a new one for each region
24 25 26 27 28 |
# File 'lib/dispatch-rider/notification_services/aws_sns.rb', line 24 def channel(name) arn = self.fetch(name) # in v1, the Topic object was fetched from API, in v3 it's basically just an arn wrapper Aws::SNS::Topic.new(arn) end |
#channel_registrar_builder ⇒ Object
14 15 16 |
# File 'lib/dispatch-rider/notification_services/aws_sns.rb', line 14 def channel_registrar_builder Registrars::SnsChannel end |
#notifier_builder ⇒ Object
8 9 10 11 12 |
# File 'lib/dispatch-rider/notification_services/aws_sns.rb', line 8 def notifier_builder Aws::SNS::Client rescue NameError raise AdapterNotFoundError.new(self.class.name, 'aws-sdk') end |
#publish_to_channel(channel, message:) ⇒ Object
18 19 20 |
# File 'lib/dispatch-rider/notification_services/aws_sns.rb', line 18 def publish_to_channel(channel, message:) Retriable.retriable(tries: 10, on: Aws::Errors::MissingCredentialsError) { super } end |