Class: AwsSms
- Inherits:
-
Object
- Object
- AwsSms
- Defined in:
- lib/aws_sms.rb,
lib/aws_sms/config.rb,
lib/aws_sms/version.rb
Defined Under Namespace
Modules: Config
Constant Summary collapse
- VERSION =
"0.5.0"
Instance Method Summary collapse
- #client ⇒ Object
-
#initialize(aws_default_region: nil, aws_access_key_id: nil, aws_secret_access_key: nil, sms_attributes: nil) ⇒ AwsSms
constructor
A new instance of AwsSms.
- #send(phone_number, message) ⇒ Object
Constructor Details
#initialize(aws_default_region: nil, aws_access_key_id: nil, aws_secret_access_key: nil, sms_attributes: nil) ⇒ AwsSms
Returns a new instance of AwsSms.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/aws_sms.rb', line 7 def initialize(aws_default_region: nil, aws_access_key_id: nil, aws_secret_access_key: nil, sms_attributes: nil) @aws_default_region = aws_default_region || Config.region @aws_access_key_id = aws_access_key_id || Config.access_key @aws_secret_access_key = aws_secret_access_key || Config.secret_key @sms_attributes = sms_attributes || Config.sms_attributes validate_args! set_config! end |
Instance Method Details
#client ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/aws_sms.rb', line 22 def client @client ||= begin sns = Aws::SNS::Client.new() sns.set_sms_attributes({ attributes: sms_attributes }) sns end end |
#send(phone_number, message) ⇒ Object
18 19 20 |
# File 'lib/aws_sms.rb', line 18 def send(phone_number, ) client.publish(phone_number: phone_number, message: ) end |