Sha256: d07323f8337f7ac80a8ac5fdc1da9976f98104576fd1b19350271a345a1eaee6

Contents?: true

Size: 528 Bytes

Versions: 2

Compression:

Stored size: 528 Bytes

Contents

module Rpush
  module Wpns
    class Notification < Rpush::Notification
      validates :uri, presence: true
      validates :uri, format: { with: /https?:\/\/[\S]+/ }
      validates :alert, presence: true

      def as_json
        json = {
          'message' => alert,
          'uri'     => uri
        }

        if collapse_key
          json['consolidationKey'] = collapse_key
        end

        json
      end

      def uri_is_valid?
        return (/https?:\/\/[\S]+/.match(uri) != nil)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rpush-1.0.0-java lib/rpush/wpns/notification.rb
rpush-1.0.0 lib/rpush/wpns/notification.rb