Class: Nzbn::Configuration
- Inherits:
-
Object
- Object
- Nzbn::Configuration
- Defined in:
- lib/nzbn/configuration.rb
Overview
Configuration class for NZBN client settings
Constant Summary collapse
- MODES =
%i[production sandbox].freeze
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #production? ⇒ Boolean
- #sandbox? ⇒ Boolean
- #valid? ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
29 30 31 32 33 34 35 36 |
# File 'lib/nzbn/configuration.rb', line 29 def initialize @api_key = nil @mode = :production @base_url = Nzbn::PRODUCTION_BASE_URL @timeout = 30 @open_timeout = 10 @logger = nil end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
26 27 28 |
# File 'lib/nzbn/configuration.rb', line 26 def api_key @api_key end |
#base_url ⇒ Object
Returns the value of attribute base_url.
27 28 29 |
# File 'lib/nzbn/configuration.rb', line 27 def base_url @base_url end |
#logger ⇒ Object
Returns the value of attribute logger.
26 27 28 |
# File 'lib/nzbn/configuration.rb', line 26 def logger @logger end |
#mode ⇒ Object
Returns the value of attribute mode.
27 28 29 |
# File 'lib/nzbn/configuration.rb', line 27 def mode @mode end |
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
26 27 28 |
# File 'lib/nzbn/configuration.rb', line 26 def open_timeout @open_timeout end |
#timeout ⇒ Object
Returns the value of attribute timeout.
26 27 28 |
# File 'lib/nzbn/configuration.rb', line 26 def timeout @timeout end |
Instance Method Details
#production? ⇒ Boolean
60 61 62 |
# File 'lib/nzbn/configuration.rb', line 60 def production? @mode == :production end |
#sandbox? ⇒ Boolean
56 57 58 |
# File 'lib/nzbn/configuration.rb', line 56 def sandbox? @mode == :sandbox end |
#valid? ⇒ Boolean
64 65 66 |
# File 'lib/nzbn/configuration.rb', line 64 def valid? !api_key.nil? && !api_key.empty? end |