module Marathon

The top-level module for this gem. It's purpose is to hold global configuration variables that are used as defaults in other classes.

Constants

DEFAULT_URL
VERSION

Attributes

logger[RW]
singleton[R]
logger[RW]
singleton[R]

Public Class Methods

connection() click to toggle source

Set a new connection

# File lib/marathon.rb, line 136
def connection
  singleton.connection
end
env_options() click to toggle source

Get marathon options from environment

# File lib/marathon.rb, line 104
def env_options
  opts = {}
  opts[:username] = ENV['MARATHON_USER'] if ENV['MARATHON_USER']
  opts[:password] = ENV['MARATHON_PASSWORD'] if ENV['MARATHON_PASSWORD']
  opts[:insecure] = ENV['MARATHON_INSECURE'] == 'true' if ENV['MARATHON_INSECURE']
  opts
end
env_url() click to toggle source

Get the marathon url from environment

# File lib/marathon.rb, line 99
def env_url
  ENV['MARATHON_URL']
end
info() click to toggle source

Get information about the marathon server

# File lib/marathon.rb, line 150
def info
  singleton.info
end
metrics() click to toggle source
# File lib/marathon.rb, line 159
def metrics
  singleton.metrics
end
options() click to toggle source

Get options for connecting to marathon API

# File lib/marathon.rb, line 119
def options
  @options ||= env_options
end
options=(new_options) click to toggle source

Set new options

# File lib/marathon.rb, line 130
def options=(new_options)
  @options = env_options.merge(new_options || {})
  reset_singleton!
end
ping() click to toggle source

Ping marathon

# File lib/marathon.rb, line 155
def ping
  singleton.ping
end
reset_connection!() click to toggle source
# File lib/marathon.rb, line 145
def reset_connection!
  reset_singleton!
end
reset_singleton!() click to toggle source
# File lib/marathon.rb, line 141
def reset_singleton!
  @singleton = MarathonInstance.new(url, options)
end
url() click to toggle source

Get the marathon API URL

# File lib/marathon.rb, line 113
def url
  @url ||= env_url || DEFAULT_URL
  @url
end
url=(new_url) click to toggle source

Set a new url

# File lib/marathon.rb, line 124
def url=(new_url)
  @url = new_url
  reset_singleton!
end

Private Instance Methods

connection() click to toggle source

Set a new connection

# File lib/marathon.rb, line 136
def connection
  singleton.connection
end
env_options() click to toggle source

Get marathon options from environment

# File lib/marathon.rb, line 104
def env_options
  opts = {}
  opts[:username] = ENV['MARATHON_USER'] if ENV['MARATHON_USER']
  opts[:password] = ENV['MARATHON_PASSWORD'] if ENV['MARATHON_PASSWORD']
  opts[:insecure] = ENV['MARATHON_INSECURE'] == 'true' if ENV['MARATHON_INSECURE']
  opts
end
env_url() click to toggle source

Get the marathon url from environment

# File lib/marathon.rb, line 99
def env_url
  ENV['MARATHON_URL']
end
info() click to toggle source

Get information about the marathon server

# File lib/marathon.rb, line 150
def info
  singleton.info
end
metrics() click to toggle source
# File lib/marathon.rb, line 159
def metrics
  singleton.metrics
end
options() click to toggle source

Get options for connecting to marathon API

# File lib/marathon.rb, line 119
def options
  @options ||= env_options
end
options=(new_options) click to toggle source

Set new options

# File lib/marathon.rb, line 130
def options=(new_options)
  @options = env_options.merge(new_options || {})
  reset_singleton!
end
ping() click to toggle source

Ping marathon

# File lib/marathon.rb, line 155
def ping
  singleton.ping
end
reset_connection!() click to toggle source
# File lib/marathon.rb, line 145
def reset_connection!
  reset_singleton!
end
reset_singleton!() click to toggle source
# File lib/marathon.rb, line 141
def reset_singleton!
  @singleton = MarathonInstance.new(url, options)
end
url() click to toggle source

Get the marathon API URL

# File lib/marathon.rb, line 113
def url
  @url ||= env_url || DEFAULT_URL
  @url
end
url=(new_url) click to toggle source

Set a new url

# File lib/marathon.rb, line 124
def url=(new_url)
  @url = new_url
  reset_singleton!
end