Class: Parse::Push
- Inherits:
-
Object
- Object
- Parse::Push
- Defined in:
- lib/parse/push.rb
Instance Attribute Summary collapse
-
#channel ⇒ Object
Returns the value of attribute channel.
-
#channels ⇒ Object
Returns the value of attribute channels.
-
#data ⇒ Object
Returns the value of attribute data.
-
#expiration_time ⇒ Object
Returns the value of attribute expiration_time.
-
#expiration_time_interval ⇒ Object
Returns the value of attribute expiration_time_interval.
-
#push_time ⇒ Object
Returns the value of attribute push_time.
-
#type ⇒ Object
Returns the value of attribute type.
-
#where ⇒ Object
Returns the value of attribute where.
Instance Method Summary collapse
-
#initialize(data, channel = "") ⇒ Push
constructor
A new instance of Push.
- #save ⇒ Object
Constructor Details
#initialize(data, channel = "") ⇒ Push
Returns a new instance of Push.
16 17 18 19 |
# File 'lib/parse/push.rb', line 16 def initialize(data, channel = "") @data = data @channel = channel end |
Instance Attribute Details
#channel ⇒ Object
Returns the value of attribute channel.
8 9 10 |
# File 'lib/parse/push.rb', line 8 def channel @channel end |
#channels ⇒ Object
Returns the value of attribute channels.
7 8 9 |
# File 'lib/parse/push.rb', line 7 def channels @channels end |
#data ⇒ Object
Returns the value of attribute data.
14 15 16 |
# File 'lib/parse/push.rb', line 14 def data @data end |
#expiration_time ⇒ Object
Returns the value of attribute expiration_time.
12 13 14 |
# File 'lib/parse/push.rb', line 12 def expiration_time @expiration_time end |
#expiration_time_interval ⇒ Object
Returns the value of attribute expiration_time_interval.
11 12 13 |
# File 'lib/parse/push.rb', line 11 def expiration_time_interval @expiration_time_interval end |
#push_time ⇒ Object
Returns the value of attribute push_time.
13 14 15 |
# File 'lib/parse/push.rb', line 13 def push_time @push_time end |
#type ⇒ Object
Returns the value of attribute type.
10 11 12 |
# File 'lib/parse/push.rb', line 10 def type @type end |
#where ⇒ Object
Returns the value of attribute where.
9 10 11 |
# File 'lib/parse/push.rb', line 9 def where @where end |
Instance Method Details
#save ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/parse/push.rb', line 21 def save uri = Protocol.push_uri body = { :data => @data, :channel => @channel } if @channels body.merge!({ :channels => @channels }) body.delete :channel end if @where body.merge!({ :where => @where }) body.delete :channel end body.merge!({ :expiration_interval => @expiration_time_interval }) if @expiration_time_interval body.merge!({ :expiration_time => @expiration_time }) if @expiration_time body.merge!({ :push_time => @push_time }) if @push_time body.merge!({ :type => @type }) if @type response = Parse.client.request uri, :post, body.to_json, nil end |