Sha256: 2e9a2737c2e81dbdcd7b1c4923f4654bfe9b99f775f5de7227c9d584553f3956

Contents?: true

Size: 671 Bytes

Versions: 2

Compression:

Stored size: 671 Bytes

Contents

module PushToSNS
  class IosPushNotification < BasicPushNotification
    def message
      basic_message = {
        apns => {
          aps: default_payload.merge(payload)
        }.to_json
      }
      basic_message
    end

    def default_payload
      basic_payload = {}
      basic_payload[:title] = payload[:title] if payload[:title]
      basic_payload[:alert] = payload[:message] if payload[:message]
      basic_payload[:badge] = payload[:badge] if payload[:badge]
      basic_payload[:sound] = payload[:sound] if payload[:sound]
      basic_payload
    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.4.1 lib/push_to_sns/ios_push_notification.rb
push_to_sns-0.4.0 lib/push_to_sns/ios_push_notification.rb