Sha256: 591e7ebfb4b279c50fdae870981a687d894e3b32d085a3ca4bf5b49a2c348e52

Contents?: true

Size: 540 Bytes

Versions: 3

Compression:

Stored size: 540 Bytes

Contents

module Suj
  module Pusher
    class WnsNotification
      include Suj::Pusher::Logger


      def initialize(options = {})
	@options = options
      end

      def payload
        @payload ||= MultiJson.dump(@options[:data] || {})
      end

      def data
        @data ||= encode_data
      end

      private

      def get_expiry
        if @ttl.to_i == 0
          return 0
        else
          return Time.now.to_i + @ttl.to_i
        end
      end

      def encode_data
      Base64.encode64(payload)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
suj-pusher-0.2.5 lib/suj/pusher/wns_notification.rb
suj-pusher-0.2.3 lib/suj/pusher/wns_notification.rb
suj-pusher-0.2.0 lib/suj/pusher/wns_notification.rb