Class: LightrateRails::Configuration
- Inherits:
-
Object
- Object
- LightrateRails::Configuration
- Defined in:
- lib/lightrate_rails/configuration.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#application_id ⇒ Object
Returns the value of attribute application_id.
-
#default_local_bucket_size ⇒ Object
Returns the value of attribute default_local_bucket_size.
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#retry_attempts ⇒ Object
Returns the value of attribute retry_attempts.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #to_h ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
8 9 10 11 12 13 14 |
# File 'lib/lightrate_rails/configuration.rb', line 8 def initialize @enabled = true @timeout = 30 @retry_attempts = 3 @logger = nil @default_local_bucket_size = 5 end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
5 6 7 |
# File 'lib/lightrate_rails/configuration.rb', line 5 def api_key @api_key end |
#application_id ⇒ Object
Returns the value of attribute application_id.
5 6 7 |
# File 'lib/lightrate_rails/configuration.rb', line 5 def application_id @application_id end |
#default_local_bucket_size ⇒ Object
Returns the value of attribute default_local_bucket_size.
5 6 7 |
# File 'lib/lightrate_rails/configuration.rb', line 5 def default_local_bucket_size @default_local_bucket_size end |
#enabled ⇒ Object
Returns the value of attribute enabled.
5 6 7 |
# File 'lib/lightrate_rails/configuration.rb', line 5 def enabled @enabled end |
#logger ⇒ Object
Returns the value of attribute logger.
5 6 7 |
# File 'lib/lightrate_rails/configuration.rb', line 5 def logger @logger end |
#retry_attempts ⇒ Object
Returns the value of attribute retry_attempts.
5 6 7 |
# File 'lib/lightrate_rails/configuration.rb', line 5 def retry_attempts @retry_attempts end |
#timeout ⇒ Object
Returns the value of attribute timeout.
5 6 7 |
# File 'lib/lightrate_rails/configuration.rb', line 5 def timeout @timeout end |
Instance Method Details
#to_h ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/lightrate_rails/configuration.rb', line 20 def to_h { api_key: api_key.present? ? "******" : nil, application_id: application_id, enabled: enabled, timeout: timeout, retry_attempts: retry_attempts, logger: logger, default_local_bucket_size: default_local_bucket_size } end |
#valid? ⇒ Boolean
16 17 18 |
# File 'lib/lightrate_rails/configuration.rb', line 16 def valid? api_key.present? && application_id.present? end |