lib/parse/model/push.rb
def payload
      msg = {
        data: {
          alert: alert,
          badge: badge || "Increment"
        }
      }
      msg[:data][:sound] = sound if sound.present?
      msg[:data][:title] = title if title.present?
      msg[:data].merge! @data if @data.is_a?(Hash)


      if @expiration_time.present?
        msg[:expiration_time] = @expiration_time.respond_to?(:iso8601) ? @expiration_time.iso8601(3) : @expiration_time
      end
      if @push_time.present?
        msg[:push_time] = @push_time.respond_to?(:iso8601) ? @push_time.iso8601(3) : @push_time
      end

      if @expiration_interval.is_a?(Numeric)
        msg[:expiration_interval] = @expiration_interval.to_i
      end

      if query.where.present?
        q = @query.dup
        if @channels.is_a?(Array) && @channels.empty? == false
          q.where :channels.in => @channels
        end
        msg[:where] = q.compile_where unless q.where.empty?
      elsif @channels.is_a?(Array) && @channels.empty? == false
        msg[:channels] = @channels
      end
      msg
    end
def payload
      msg = {
        data: {
          alert: alert,
          badge: badge || "Increment"
        }
      }
      msg[:data][:sound] = sound if sound.present?
      msg[:data][:title] = title if title.present?
      msg[:data].merge! @data if @data.is_a?(Hash)


      if @expiration_time.present?
        msg[:expiration_time] = @expiration_time.respond_to?(:iso8601) ? @expiration_time.iso8601(3) : @expiration_time
      end
      if @push_time.present?
        msg[:push_time] = @push_time.respond_to?(:iso8601) ? @push_time.iso8601(3) : @push_time
      end

      if @expiration_interval.is_a?(Numeric)
        msg[:expiration_interval] = @expiration_interval.to_i
      end

      if query.where.present?
        q = @query.dup
        if @channels.is_a?(Array) && @channels.empty? == false
          q.where :channels.in => @channels
        end
        msg[:where] = q.compile_where unless q.where.empty?
      elsif @channels.is_a?(Array) && @channels.empty? == false
        msg[:channels] = @channels
      end
      msg
    end
def payload msg = { data : { alert : alert , badge : badge || "Increment" } } msg [ :data ] [ :sound ] = sound if sound . present? msg [ :data ] [ :title ] = title if title . present? msg [ :data ] . merge! @data if @data . is_a? ( Hash ) if @expiration_time . present? msg [ :expiration_time ] = @expiration_time . respond_to? ( :iso8601 ) ? @expiration_time . iso8601 ( 3 ) : @expiration_time end if @push_time . present? msg [ :push_time ] = @push_time . respond_to? ( :iso8601 ) ? @push_time . iso8601 ( 3 ) : @push_time end if @expiration_interval . is_a? ( Numeric ) msg [ :expiration_interval ] = @expiration_interval . to_i end if query . where . present? q = @query . dup if @channels . is_a? ( Array ) && @channels . empty? == false q . where :channels . in => @channels end msg [ :where ] = q . compile_where unless q . where . empty? elsif @channels . is_a? ( Array ) && @channels . empty? == false msg [ :channels ] = @channels end msg end
This method takes all the parameters of the instance and creates a proper
 hash structure, required by Parse, in order to process the push notification.
 @return [Hash] the prepared push payload to be used in the request.
This method takes all the parameters of the instance and creates a proper hash structure required by Parse in order to process the push notification .