Sha256: 0f59afaf56ffdae076f90dceeb40d330000a11d807806a8593148e01c159944a

Contents?: true

Size: 537 Bytes

Versions: 2

Compression:

Stored size: 537 Bytes

Contents

module Rpush
  module Client
    module ActiveModel
      module Notification
        def self.included(base)
          base.instance_eval do
            validates :expiry, numericality: true, allow_nil: true
            validates :app_id, presence: true
          end
        end

        def payload
          multi_json_dump(as_json)
        end

        def payload_size
          payload.bytesize
        end

        def payload_data_size
          multi_json_dump(as_json['data']).bytesize
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rpush-2.0.0.beta2 lib/rpush/client/active_model/notification.rb
rpush-2.0.0.beta1 lib/rpush/client/active_model/notification.rb