Class: NotificationHub::Channels::Sms::Aws
- Defined in:
- lib/notification_hub/channels/sms/aws.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(configuration) ⇒ Aws
constructor
A new instance of Aws.
Constructor Details
#initialize(configuration) ⇒ Aws
Returns a new instance of Aws.
9 10 11 |
# File 'lib/notification_hub/channels/sms/aws.rb', line 9 def initialize(configuration) super end |
Class Method Details
.send_message(event_code, data, options) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/notification_hub/channels/sms/aws.rb', line 14 def (event_code, data, ) event = event_code.split(".") begin string = ActionController::Base.new. render_to_string("#{[:template_path]}/#{event[0]}/#{event[1]}", locals: data) sns_client = ::Aws::SNS::Client.new sns_client.publish(phone_number: [:phone_number].gsub(/[^0-9]+/, ''), message: string) rescue => exception raise "Sms::Aws Error: #{exception.}" end end |