Class: PusherFake::Configuration
- Inherits:
-
Object
- Object
- PusherFake::Configuration
- Defined in:
- lib/pusher-fake/configuration.rb
Instance Attribute Summary collapse
-
#app_id ⇒ String
The Pusher Applicaiton ID.
-
#key ⇒ String
The Pusher API key.
-
#logger ⇒ IO
An IO instance for verbose logging.
-
#secret ⇒ String
The Pusher API token.
-
#socket_options ⇒ Hash
Options for the socket server.
-
#verbose ⇒ Boolean
Enable verbose logging.
-
#web_options ⇒ Hash
Options for the web server.
-
#webhooks ⇒ Array
An array of webhook URLs.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
Instantiated from configuration.
- #reset! ⇒ Object
-
#to_options(options = {}) ⇒ Object
Convert the configuration to a hash sutiable for Pusher JS options.
Constructor Details
#initialize ⇒ Configuration
Instantiated from PusherFake.configuration. Sets the defaults.
32 33 34 |
# File 'lib/pusher-fake/configuration.rb', line 32 def initialize reset! end |
Instance Attribute Details
#app_id ⇒ String
Returns The Pusher Applicaiton ID. (Defaults to PUSHER_APP_ID
.).
4 5 6 |
# File 'lib/pusher-fake/configuration.rb', line 4 def app_id @app_id end |
#key ⇒ String
Returns The Pusher API key. (Defaults to PUSHER_API_KEY
.).
7 8 9 |
# File 'lib/pusher-fake/configuration.rb', line 7 def key @key end |
#logger ⇒ IO
Returns An IO instance for verbose logging.
10 11 12 |
# File 'lib/pusher-fake/configuration.rb', line 10 def logger @logger end |
#secret ⇒ String
Returns The Pusher API token. (Defaults to PUSHER_API_SECRET
.).
13 14 15 |
# File 'lib/pusher-fake/configuration.rb', line 13 def secret @secret end |
#socket_options ⇒ Hash
Options for the socket server. See EventMachine::WebSocket.start
for options.
18 19 20 |
# File 'lib/pusher-fake/configuration.rb', line 18 def @socket_options end |
#verbose ⇒ Boolean
Returns Enable verbose logging.
21 22 23 |
# File 'lib/pusher-fake/configuration.rb', line 21 def verbose @verbose end |
#web_options ⇒ Hash
Options for the web server. See Thin::Server
for options.
26 27 28 |
# File 'lib/pusher-fake/configuration.rb', line 26 def @web_options end |
#webhooks ⇒ Array
Returns An array of webhook URLs. (Defaults to []
.).
29 30 31 |
# File 'lib/pusher-fake/configuration.rb', line 29 def webhooks @webhooks end |
Instance Method Details
#reset! ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/pusher-fake/configuration.rb', line 36 def reset! self.app_id = "PUSHER_APP_ID" self.key = "PUSHER_API_KEY" self.logger = STDOUT.to_io self.secret = "PUSHER_API_SECRET" self.verbose = false self.webhooks = [] self. = { host: "127.0.0.1", port: available_port } self. = { host: "127.0.0.1", port: available_port } end |
#to_options(options = {}) ⇒ Object
Convert the configuration to a hash sutiable for Pusher JS options.
51 52 53 54 55 56 |
# File 'lib/pusher-fake/configuration.rb', line 51 def ( = {}) .merge( wsHost: [:host], wsPort: [:port] ) end |