module Pousse

Constants

TEMPLATE_MIN
TEMPLATE_SOURCE
VERSION

Attributes

configuration[RW]

Public Class Methods

configure() { |configuration| ... } click to toggle source
# File lib/pousse.rb, line 26
def configure
  yield configuration
end
js(channels, server = nil, secret = nil) click to toggle source
# File lib/pousse.rb, line 30
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