Sha256: dbdec925e10714908e531676326fbf71767c9ed640c372e8e3170665a6281ffe

Contents?: true

Size: 541 Bytes

Versions: 3

Compression:

Stored size: 541 Bytes

Contents

module Suj
  module Pusher
    class WnpsNotification
      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/wpns_notification.rb
suj-pusher-0.2.3 lib/suj/pusher/wpns_notification.rb
suj-pusher-0.2.0 lib/suj/pusher/wpns_notification.rb