class Bart::Configuration

Constants

DEFAULT_CONFIGURATION

The defaults to use for any configuration options that are not provided

REQUIRED_CONFIGURATION

The options required when configuring a BART instance

Attributes

adapter[RW]

The adapter to use for network communication

api_key[RW]

The key used to make requests, defaulting to BART's public key.

base_uri[RW]

The base URL of the BART system

debug_output[RW]

The output stream to which debug information should be written

refresh_time[RW]

The number of seconds real-time results are cached for.

version[RW]

The version of the BART system

Public Class Methods

new() click to toggle source
# File lib/bart_api/configuration.rb, line 32
def initialize
  # Apply the default set of configurations before anything else to ensure
  # all options are initialized.
  DEFAULT_CONFIGURATION.each do |name, value|
    send("#{name}=", value)
  end
end

Public Instance Methods

validate!() click to toggle source

Ensure that all required configurations have been given a value. Returns true if all required configuration options have been set.

# File lib/bart_api/configuration.rb, line 42
def validate!
  REQUIRED_CONFIGURATION.each do |name|
    raise "`#{name}` is a required configuration option, but was not given a value." if send("#{name}").nil?
  end
  true
end