Sha256: 1f44b03eddbf32cc11f4e7cd74cdd28070e92c7766040ba60d224cf741a17ce6

Contents?: true

Size: 828 Bytes

Versions: 2

Compression:

Stored size: 828 Bytes

Contents

require 'cgi'
require 'parse/error'

module Parse
  class Push
    attr_accessor :channels
    attr_accessor :channel
    attr_accessor :type
    attr_accessor :expiration_time_interval
    attr_accessor :expiration_time
    attr_accessor :data

    def initialize(data, channel = "")
      @data = data
      @channel = channel
    end

    def save
      uri   = Protocol.push_uri
      
      body = { :data => @data, :channel => @channel }
      body.merge({ :channels => @channels }) if @channels
      body.merge({ :expiration_time_interval => @expiration_time_interval }) if @expiration_time_interval
      body.merge({ :expiration_time => @expiration_time }) if @expiration_time 
      body.merge({ :type => @type }) if @type
      
      response = Parse.client.request uri, :post, body.to_json, nil
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
parse-ruby-client-0.0.6 lib/parse/push.rb
parse-ruby-client-0.0.5 lib/parse/push.rb