class NotificationHub::Channels::Sms::Aws
Public Class Methods
new(configuration)
click to toggle source
Calls superclass method
# File lib/notification_hub/channels/sms/aws.rb, line 9 def initialize(configuration) super end
send_message(event_code, data, options)
click to toggle source
# File lib/notification_hub/channels/sms/aws.rb, line 14 def send_message(event_code, data, options) event = event_code.split(".") begin string = ActionController::Base.new. render_to_string("#{gateway_options[:template_path]}/#{event[0]}/#{event[1]}", locals: data) sns_client = ::Aws::SNS::Client.new sns_client.publish(phone_number: options[:phone_number].gsub(/[^0-9]+/, ''), message: string) rescue => exception raise "Sms::Aws Error: #{exception.message}" end end