Skip to content
Browse files

Merge pull request #3 from smoku/master

Change serialization format from Marshal to JSON
  • Loading branch information...
2 parents ec21216 + 3e36d8b commit c59de60dc65d0f3f9d3f0bd0a973ab78c2e0f6b2 @Veraticus Veraticus committed Dec 9, 2012
Showing with 3 additions and 3 deletions.
  1. +1 −1 lib/rapnd.rb
  2. +1 −1 lib/rapnd/daemon.rb
  3. +1 −1 spec/rapnd_spec.rb
View
2 lib/rapnd.rb
@@ -7,7 +7,7 @@ module Rapnd
extend self
def queue(queue_name, message)
- self.redis.lpush(queue_name, Marshal.dump(message))
+ self.redis.lpush(queue_name, message.to_json)
end
def redis
View
2 lib/rapnd/daemon.rb
@@ -54,7 +54,7 @@ def run!
begin
message = @redis.blpop(self.queue, 1)
if message
- notification = Rapnd::Notification.new(Marshal.load(message.last))
+ notification = Rapnd::Notification.new(JSON(message.last).symbolize_keys)
self.connect! unless self.connected
@logger.info "Sending #{notification.device_token}: #{notification.json_payload}"
self.apple.write(notification.to_bytes)
View
2 spec/rapnd_spec.rb
@@ -14,7 +14,7 @@
Rapnd.queue('test_queue', {:alert => 'Hi!'})
@redis.llen('test_queue').should == 1
- Marshal.load(@redis.lpop('test_queue')).should == {:alert => 'Hi!'}
+ JSON(@redis.lpop('test_queue')).symbolize_keys.should == {:alert => 'Hi!'}
end
it 'gets a redis connection' do

0 comments on commit c59de60

Please sign in to comment.
Something went wrong with that request. Please try again.