Class: Feathr::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/feathr/config.rb

Constant Summary collapse

DEFAULT_SCHEME =
'https'
DEFAULT_HOST =
'staging.qwil.co'
DEFAULT_API_KEY =
''

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Config

Returns a new instance of Config.

Yields:

  • (_self)

Yield Parameters:



9
10
11
12
13
14
15
# 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

Instance Attribute Details

#api_emailObject

Returns the value of attribute api_email.



3
4
5
# File 'lib/feathr/config.rb', line 3

def api_email
  @api_email
end

#api_keyObject

Returns the value of attribute api_key.



3
4
5
# File 'lib/feathr/config.rb', line 3

def api_key
  @api_key
end

#api_passwordObject

Returns the value of attribute api_password.



3
4
5
# File 'lib/feathr/config.rb', line 3

def api_password
  @api_password
end

#hostObject

Returns the value of attribute host.



3
4
5
# File 'lib/feathr/config.rb', line 3

def host
  @host
end

#schemeObject

Returns the value of attribute scheme.



3
4
5
# File 'lib/feathr/config.rb', line 3

def scheme
  @scheme
end

Class Method Details

.defaultObject



17
18
19
# File 'lib/feathr/config.rb', line 17

def self.default
  @@default ||= Feathr::Config.new
end

Instance Method Details

#base_urlObject



35
36
37
# File 'lib/feathr/config.rb', line 35

def base_url
  url = "#{ scheme }://#{ host }".sub(/\/+\z/, '')
end

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



21
22
23
# File 'lib/feathr/config.rb', line 21

def configure
  yield(self) if block_given?
end