Class: AwsSnsManager::Client
- Inherits:
-
Object
- Object
- AwsSnsManager::Client
- Defined in:
- lib/aws_sns_manager/client.rb
Overview
AwsSnsManager::Client
Instance Attribute Summary collapse
-
#arn ⇒ Object
Returns the value of attribute arn.
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #message(text) ⇒ Object
- #notification(text) ⇒ Object
- #publish_rescue(message) ⇒ Object
- #send ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
7 8 9 10 11 |
# File 'lib/aws_sns_manager/client.rb', line 7 def initialize( = {}) super() @client = Aws::SNS::Client.new() end |
Instance Attribute Details
#arn ⇒ Object
Returns the value of attribute arn.
5 6 7 |
# File 'lib/aws_sns_manager/client.rb', line 5 def arn @arn end |
#client ⇒ Object
Returns the value of attribute client.
4 5 6 |
# File 'lib/aws_sns_manager/client.rb', line 4 def client @client end |
Instance Method Details
#message(text) ⇒ Object
27 28 29 30 31 |
# File 'lib/aws_sns_manager/client.rb', line 27 def (text) { APNS: notification(text).to_json } end |
#notification(text) ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/aws_sns_manager/client.rb', line 33 def notification(text) { aps: { alert: text, sound: 'default', badge: 1 } } end |
#publish_rescue(message) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/aws_sns_manager/client.rb', line 19 def publish_rescue() client.publish( target_arn: arn, message: , message_structure: 'json' ) end |
#send ⇒ Object
13 14 15 16 17 |
# File 'lib/aws_sns_manager/client.rb', line 13 def send = ('Hi').to_json response = publish_rescue() !response.nil? end |