Sha256: 7bcece3dc2bb14f12e1f9960e3b15e0688eef71a0a67f89331e7e2f46c2dcd30
Contents?: true
Size: 1.06 KB
Versions: 3
Compression:
Stored size: 1.06 KB
Contents
require 'redis' require 'action_mailer' require "pousse/version" require 'pousse/configuration' require 'pousse/redis_delivery' require 'pousse/mailer' require 'pousse/crypt' module Pousse TEMPLATE_SOURCE = File.join( File.dirname(__FILE__), '..', 'app', 'assets', 'javascript', 'pousse.js.coffee.erb' ) TEMPLATE_MIN = File.join( File.dirname(__FILE__), '..', 'app', 'assets', 'javascript', 'pousse.min.js.erb' ) class << self attr_accessor :configuration def configuration @configuration ||= Configuration.new end def configure yield configuration end def js(channels, server = nil, secret = nil) require 'erb' require 'json' secret ||= configuration.secret raise 'You should configure your secret or specify it.' if secret == nil server ||= configuration.server raise 'You should configure your secret or specify it.' if server == nil token, iv = Pousse::Crypt.encrypt(channels.to_json, secret) return ERB.new(File.read(TEMPLATE_MIN)).result(binding) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pousse-0.0.6 | lib/pousse.rb |
pousse-0.0.5 | lib/pousse.rb |
pousse-0.0.4 | lib/pousse.rb |