Sha256: 9519dbc208e1b0f8d27ae419bec1b7143298033133a0ce62dbf6f9e4c0475695

Contents?: true

Size: 632 Bytes

Versions: 3

Compression:

Stored size: 632 Bytes

Contents

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

    def message
      basic_message = {
        apns => {
          aps: {
            alert: payload[:message] || DEFAULT_MESSAGE
          }.merge(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

3 entries across 3 versions & 1 rubygems

Version Path
push_to_sns-0.3.3 lib/push_to_sns/ios_push_notification.rb
push_to_sns-0.3.2 lib/push_to_sns/ios_push_notification.rb
push_to_sns-0.3.1 lib/push_to_sns/ios_push_notification.rb