Class: Nzbn::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/nzbn/configuration.rb

Overview

Configuration class for NZBN client settings

Examples:

Nzbn.configure do |config|
  config.api_key = 'your-api-key'
  config.base_url = 'https://api.business.govt.nz/gateway/nzbn/v5'
  config.timeout = 30
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



16
17
18
19
20
21
22
# File 'lib/nzbn/configuration.rb', line 16

def initialize
  @api_key = nil
  @base_url = Nzbn::DEFAULT_BASE_URL
  @timeout = 30
  @open_timeout = 10
  @logger = nil
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



14
15
16
# File 'lib/nzbn/configuration.rb', line 14

def api_key
  @api_key
end

#base_urlObject

Returns the value of attribute base_url.



14
15
16
# File 'lib/nzbn/configuration.rb', line 14

def base_url
  @base_url
end

#loggerObject

Returns the value of attribute logger.



14
15
16
# File 'lib/nzbn/configuration.rb', line 14

def logger
  @logger
end

#open_timeoutObject

Returns the value of attribute open_timeout.



14
15
16
# File 'lib/nzbn/configuration.rb', line 14

def open_timeout
  @open_timeout
end

#timeoutObject

Returns the value of attribute timeout.



14
15
16
# File 'lib/nzbn/configuration.rb', line 14

def timeout
  @timeout
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/nzbn/configuration.rb', line 24

def valid?
  !api_key.nil? && !api_key.empty?
end