Created
September 4, 2013 06:47
-
-
Save fred/6433475 to your computer and use it in GitHub Desktop.
publishing keen.io with celluloid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/models/keen_publisher.rb | |
require 'celluloid' | |
class KeenPublisher | |
include Celluloid | |
def initialize(name, status) | |
@name = name | |
@status = status | |
end | |
def publish | |
Keen.publish(@name, @status) | |
end | |
end | |
# from anywhere else | |
user = User.first | |
KeenPublisher.new(:new_user, user.keen_data).async.publish | |
# instead of default way | |
Keen.publish(:new_user, user.keen_data) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment