Sha256: 433370c670a5d454829c0cae9847a6486a2d114ed1fcde19a03da5d5e662c8bb

Contents?: true

Size: 642 Bytes

Versions: 2

Compression:

Stored size: 642 Bytes

Contents

module PushToSNS
  class IosPushNotification < BasicPushNotification
    DEFAULT_MESSAGE = "IOS Push Notification"

    def message
      basic_message = {
        apns => {
          aps: {
            alert: payload[:message] || DEFAULT_MESSAGE
          },
          data: payload
        }
      }
      basic_message[apns][:aps][:badge] = payload[:badge] if payload[:badge]
      basic_message[apns][:aps][:sound] = payload[:sound] if payload[:sound]
      basic_message[apns] = basic_message[apns].to_json
      basic_message
    end

    private

    def apns
      configuration.apply(:read_ios_apns, device).to_sym
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
push_to_sns-0.3.0 lib/push_to_sns/ios_push_notification.rb
push_to_sns-0.2.0 lib/push_to_sns/ios_push_notification.rb