-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathpusher-fake.rb
47 lines (42 loc) · 1.22 KB
/
pusher-fake.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
require "em-http-request"
require "em-websocket"
require "multi_json"
require "openssl"
require "thin"
require "pusher-fake/channel"
require "pusher-fake/channel/public"
require "pusher-fake/channel/private"
require "pusher-fake/channel/presence"
require "pusher-fake/configuration"
require "pusher-fake/connection"
require "pusher-fake/server"
require "pusher-fake/server/application"
require "pusher-fake/webhook"
module PusherFake
# The current version string.
VERSION = "0.12.0"
# Call this method to modify the defaults.
#
# @example
# PusherFake.configure do |configuration|
# configuration.port = 443
# end
#
# @yield [Configuration] The current configuration.
def self.configure
yield(configuration)
end
# @return [Configuration] Current configuration.
def self.configuration
@configuration ||= Configuration.new
end
# Convenience method for the JS to override the Pusher client host and port.
#
# @param [Hash] options Custom options for Pusher client.
# @return [String] JavaScript overriding the Pusher client host and port.
def self.javascript(options = {})
<<-EOS
new Pusher(#{configuration.key.to_json}, #{configuration.to_options(options).to_json})
EOS
end
end