Sha256: d15c4f278749479992d17b3081efd3b35faea64879e00dcf1872e45de69f0959

Contents?: true

Size: 653 Bytes

Versions: 6

Compression:

Stored size: 653 Bytes

Contents

module NotifyUser
  class Apns
    SYMBOL_NAMES_SIZE = 10
    PAYLOAD_LIMIT = 255

    def initialize(notification, options)
      @notification = notification
      @options = options
    end

    # Sends push notification:
    def push
      raise "Base APNS class should not be used."
    end

    private

    # Calculates the bytes already used:
    def used_space
      used_space = SYMBOL_NAMES_SIZE + @notification.id.size + @notification.created_at.to_time.to_i.size +
                    @notification.type.size

      used_space += @notification.params[:action_id].size if @notification.params[:action_id]

      used_space
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
notify_user-0.1.4 app/models/notify_user/apns.rb
notify_user-0.1.3 app/models/notify_user/apns.rb
notify_user-0.1.2 app/models/notify_user/apns.rb
notify_user-0.1.1 app/models/notify_user/apns.rb
notify_user-0.0.30 app/models/notify_user/apns.rb
notify_user-0.0.29 app/models/notify_user/apns.rb