Class: PusherFake::Configuration
- Inherits:
-
Object
- Object
- PusherFake::Configuration
- Defined in:
- lib/pusher-fake/configuration.rb
Overview
Configuration class.
Instance Attribute Summary collapse
-
#app_id ⇒ String
The Pusher Applicaiton ID.
-
#disable_stats ⇒ Boolean
Disable the client statistics.
-
#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.
38 39 40 |
# File 'lib/pusher-fake/configuration.rb', line 38 def initialize reset! end |
Instance Attribute Details
#app_id ⇒ String
Returns The Pusher Applicaiton ID. (Defaults to PUSHER_APP_ID
.).
7 8 9 |
# File 'lib/pusher-fake/configuration.rb', line 7 def app_id @app_id end |
#disable_stats ⇒ Boolean
Returns Disable the client statistics. (Defaults to true
.).
10 11 12 |
# File 'lib/pusher-fake/configuration.rb', line 10 def disable_stats @disable_stats end |
#key ⇒ String
Returns The Pusher API key. (Defaults to PUSHER_API_KEY
.).
13 14 15 |
# File 'lib/pusher-fake/configuration.rb', line 13 def key @key end |
#logger ⇒ IO
Returns An IO instance for verbose logging.
16 17 18 |
# File 'lib/pusher-fake/configuration.rb', line 16 def logger @logger end |
#secret ⇒ String
Returns The Pusher API token. (Defaults to PUSHER_API_SECRET
.).
19 20 21 |
# File 'lib/pusher-fake/configuration.rb', line 19 def secret @secret end |
#socket_options ⇒ Hash
Options for the socket server. See EventMachine::WebSocket.start
.
24 25 26 |
# File 'lib/pusher-fake/configuration.rb', line 24 def @socket_options end |
#verbose ⇒ Boolean
Returns Enable verbose logging.
27 28 29 |
# File 'lib/pusher-fake/configuration.rb', line 27 def verbose @verbose end |
#web_options ⇒ Hash
Options for the web server. See Thin::Server
for options.
32 33 34 |
# File 'lib/pusher-fake/configuration.rb', line 32 def @web_options end |
#webhooks ⇒ Array
Returns An array of webhook URLs. (Defaults to []
.).
35 36 37 |
# File 'lib/pusher-fake/configuration.rb', line 35 def webhooks @webhooks end |
Instance Method Details
#reset! ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/pusher-fake/configuration.rb', line 49 def reset! self.app_id = "PUSHER_APP_ID" self.key = "PUSHER_API_KEY" self.logger = standard_out_io self.secret = "PUSHER_API_SECRET" self.verbose = false self.webhooks = [] self.disable_stats = true 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.
65 66 67 68 69 70 71 72 73 |
# File 'lib/pusher-fake/configuration.rb', line 65 def ( = {}) .merge( wsHost: [:host], wsPort: [:port], cluster: "us-east-1", forceTLS: false, disableStats: disable_stats ) end |