Sha256: 225a68c19f90162f16815ae578915bf93245b1af6096ca87c651a96bc534f2bb
Contents?: true
Size: 878 Bytes
Versions: 1
Compression:
Stored size: 878 Bytes
Contents
module AwsSnsManager # = AwsSnsManager::Client class Client attr_accessor :client attr_accessor :arn def initialize(options = {}) super() @client = Aws::SNS::Client.new(options) end def send(text = nil, options = {}) message = message(text, options).to_json response = publish_rescue(message) !response.nil? end def publish_rescue(message) client.publish( target_arn: arn, message: message, message_structure: 'json' ) end def message(text, options = {}) { APNS: notification(text, options).to_json } end def notification(text, options = {}) base = { aps: { alert: text, sound: 'default', badge: 1, 'content-available': 1 } } base.merge(options) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
aws_sns_manager-0.0.2.pre.alpha.pre.21 | lib/aws_sns_manager/client.rb |