Sha256: b1fba9f9acedb82b08a4d002be93c632d93e7d028cabc4705e213ba6d2868990

Contents?: true

Size: 736 Bytes

Versions: 2

Compression:

Stored size: 736 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[:image] = payload[:image] if payload[:image]
      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.6.0 lib/push_to_sns/ios_push_notification.rb
push_to_sns-0.5.0 lib/push_to_sns/ios_push_notification.rb