Sha256: d46a32b2b28dfed93fde81e17d20d6e5088d0e02ad4164eecfb20a66da8a5545

Contents?: true

Size: 516 Bytes

Versions: 5

Compression:

Stored size: 516 Bytes

Contents

module PushToSNS
  class AndroidPushNotification < BasicPushNotification
    DEFAULT_MESSAGE = "Android Push Notification"

    def message
      { GCM: { data: default_payload.deeper_merge(payload) }.to_json }
    end

    private

    def default_payload
      basic_message = {
        message: payload[:message] || DEFAULT_MESSAGE
      }
      basic_message[:smallIcon] = payload[:badge] if payload[:badge]
      basic_message[:sound] = payload[:sound] if payload[:sound]

      basic_message
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
push_to_sns-0.3.3 lib/push_to_sns/android_push_notification.rb
push_to_sns-0.3.2 lib/push_to_sns/android_push_notification.rb
push_to_sns-0.3.1 lib/push_to_sns/android_push_notification.rb
push_to_sns-0.3.0 lib/push_to_sns/android_push_notification.rb
push_to_sns-0.2.0 lib/push_to_sns/android_push_notification.rb