module Tidas::Configuration

Attributes

api_key[R]
application[R]
server[R]
timeout[R]

Public Class Methods

api_key() click to toggle source
# File lib/tidas/configuration.rb, line 51
def self.api_key
  @api_key
end
application() click to toggle source
# File lib/tidas/configuration.rb, line 55
def self.application
  @application
end
clear_configuration(flag) click to toggle source
# File lib/tidas/configuration.rb, line 38
def self.clear_configuration(flag)
  case flag
    when :server then @server = nil
    when :api_key then @api_key = nil
    when :application then @application = nil
    when :timeout then @timeout = nil
  end
end
configure(attributes={}) click to toggle source
# File lib/tidas/configuration.rb, line 15
def self.configure(attributes={})
  server = attributes.fetch(:server,ENV['tidas_server'])
  api_key = attributes.fetch(:api_key,ENV['tidas_api_key'])
  application = attributes.fetch(:application,ENV['tidas_application'])
  timeout = attributes.fetch(:timeout,ENV['tidas_timeout'])

  if server
    @server = server
  end

  if api_key
    @api_key = api_key
  end

  if application
    @application = application
  end

  if timeout
    @timeout = timeout.to_s
  end
end
server() click to toggle source
# File lib/tidas/configuration.rb, line 47
def self.server
  @server
end
test_configure() click to toggle source
# File lib/tidas/configuration.rb, line 6
def self.test_configure #:nodoc#
  Configuration.configure(
    server: 'http://localhost:3000',
    api_key: 'test-api-key',
    application: 'Javelin',
    timeout: 1
  )
end
timeout() click to toggle source
# File lib/tidas/configuration.rb, line 59
def self.timeout
  if @timeout
    @timeout.to_i
  else
    20
  end
end