Class: Broadcast::Configuration
- Inherits:
-
Object
- Object
- Broadcast::Configuration
- Defined in:
- lib/broadcast/configuration.rb
Instance Attribute Summary collapse
-
#api_token ⇒ Object
Returns the value of attribute api_token.
-
#broadcast_channel_id ⇒ Object
Returns the value of attribute broadcast_channel_id.
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#host ⇒ Object
Returns the value of attribute host.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
#retry_attempts ⇒ Object
Returns the value of attribute retry_attempts.
-
#retry_delay ⇒ Object
Returns the value of attribute retry_delay.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #validate! ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/broadcast/configuration.rb', line 15 def initialize @api_token = nil @host = 'https://sendbroadcast.com' @timeout = 30 @open_timeout = 10 @retry_attempts = 3 @retry_delay = 1 @logger = nil @debug = false @broadcast_channel_id = nil end |
Instance Attribute Details
#api_token ⇒ Object
Returns the value of attribute api_token.
5 6 7 |
# File 'lib/broadcast/configuration.rb', line 5 def api_token @api_token end |
#broadcast_channel_id ⇒ Object
Returns the value of attribute broadcast_channel_id.
5 6 7 |
# File 'lib/broadcast/configuration.rb', line 5 def broadcast_channel_id @broadcast_channel_id end |
#debug ⇒ Object
Returns the value of attribute debug.
5 6 7 |
# File 'lib/broadcast/configuration.rb', line 5 def debug @debug end |
#host ⇒ Object
Returns the value of attribute host.
5 6 7 |
# File 'lib/broadcast/configuration.rb', line 5 def host @host end |
#logger ⇒ Object
Returns the value of attribute logger.
5 6 7 |
# File 'lib/broadcast/configuration.rb', line 5 def logger @logger end |
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
5 6 7 |
# File 'lib/broadcast/configuration.rb', line 5 def open_timeout @open_timeout end |
#retry_attempts ⇒ Object
Returns the value of attribute retry_attempts.
5 6 7 |
# File 'lib/broadcast/configuration.rb', line 5 def retry_attempts @retry_attempts end |
#retry_delay ⇒ Object
Returns the value of attribute retry_delay.
5 6 7 |
# File 'lib/broadcast/configuration.rb', line 5 def retry_delay @retry_delay end |
#timeout ⇒ Object
Returns the value of attribute timeout.
5 6 7 |
# File 'lib/broadcast/configuration.rb', line 5 def timeout @timeout end |
Instance Method Details
#validate! ⇒ Object
27 28 29 30 31 |
# File 'lib/broadcast/configuration.rb', line 27 def validate! raise ConfigurationError, 'api_token is required' if api_token.nil? || api_token.to_s.strip.empty? self.host = host.chomp('/') if host&.end_with?('/') end |