class DoubleMap::Configuration

Constants

DEFAULT_CONFIGURATION

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

REQUIRED_CONFIGURATION

The options required when configuring a DoubleMap instance

Attributes

adapter[RW]

The adapter to use for network communication

base_uri[RW]

The base URL of the DoubleMap system

debug_output[RW]

The output stream to which debug information should be written

on_route[RW]

Optional procs called when a corresponding model object is created, before it is returned to a caller.

on_stop[RW]

Optional procs called when a corresponding model object is created, before it is returned to a caller.

on_vehicle[RW]

Optional procs called when a corresponding model object is created, before it is returned to a caller.

version[RW]

The version of the DoubleMap system

Public Class Methods

new() click to toggle source
# File lib/doublemap_api/configuration.rb, line 30
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/doublemap_api/configuration.rb, line 40
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