Skip to content

Commit

Permalink
refactor already horrible code
Browse files Browse the repository at this point in the history
  • Loading branch information
tikhon committed Apr 19, 2012
1 parent 1a273c1 commit 5d35649
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/parse/push.rb
Expand Up @@ -12,13 +12,16 @@ class Push

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

def send
uri = Protocol.push_uri
body = { :data => @data, :channel => @channel }
body.merge({ :channels => @channels }) if @channels && @channel.nil?
if @channel == "" && @channels
body.merge({ :channels => @channels })
body.delete :channel
end
body.merge({ :expiration_time_interval => @expiration_time_interval }) if @expiration_time_interval
body.merge({ :expiration_time => @expiration_time }) if @expiration_time && @expiration_time_interval.nil?
body.merge({ :type => @type }) if @type
Expand Down

0 comments on commit 5d35649

Please sign in to comment.