class Feathr::Config

Constants

DEFAULT_API_KEY
DEFAULT_HOST
DEFAULT_SCHEME

Attributes

api_email[RW]
api_key[RW]
api_password[RW]
host[RW]
scheme[RW]

Public Class Methods

default() click to toggle source
# File lib/feathr/config.rb, line 17
def self.default
  @@default ||= Feathr::Config.new
end
new() { |self| ... } click to toggle source
# File lib/feathr/config.rb, line 9
def initialize
  @scheme     = DEFAULT_SCHEME
  @host       = DEFAULT_HOST
  @api_key    = DEFAULT_API_KEY

  yield(self) if block_given?
end

Public Instance Methods

base_url() click to toggle source
# File lib/feathr/config.rb, line 35
def base_url
  url = "#{ scheme }://#{ host }".sub(/\/+\z/, '')
end
configure() { |self| ... } click to toggle source
# File lib/feathr/config.rb, line 21
def configure
  yield(self) if block_given?
end
host=(host) click to toggle source
# File lib/feathr/config.rb, line 30
def host=(host)
  # remove http(s):// and anything after a slash
  @host = host.sub(/https?:\/\//, '').split('/').first
end
scheme=(scheme) click to toggle source
# File lib/feathr/config.rb, line 25
def scheme=(scheme)
  # remove :// from scheme
  @scheme = scheme.sub(/:\/\//, '')
end