Class: Captivus::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/captivus/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}, &block) ⇒ Configuration

Returns a new instance of Configuration.



3
4
5
6
7
8
9
10
11
# File 'lib/captivus/configuration.rb', line 3

def initialize(attrs = {}, &block)
  defaults = {
    :scheme => 'http',
    :host => 'api.captiv.us',
    :environment => 'production',
    :development_environments => %w[development test]
  }
  configure defaults.merge(attrs), &block
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



13
14
15
# File 'lib/captivus/configuration.rb', line 13

def api_key
  @api_key
end

#api_secret_keyObject

Returns the value of attribute api_secret_key.



13
14
15
# File 'lib/captivus/configuration.rb', line 13

def api_secret_key
  @api_secret_key
end

#development_environmentsObject

Returns the value of attribute development_environments.



13
14
15
# File 'lib/captivus/configuration.rb', line 13

def development_environments
  @development_environments
end

#environmentObject

Returns the value of attribute environment.



13
14
15
# File 'lib/captivus/configuration.rb', line 13

def environment
  @environment
end

#hostObject

Returns the value of attribute host.



13
14
15
# File 'lib/captivus/configuration.rb', line 13

def host
  @host
end

#schemeObject

Returns the value of attribute scheme.



13
14
15
# File 'lib/captivus/configuration.rb', line 13

def scheme
  @scheme
end

Instance Method Details

#==(other) ⇒ Object



21
22
23
# File 'lib/captivus/configuration.rb', line 21

def ==(other)
  other.is_a?(Captivus::Configuration) && host == other.host
end

#configure(attrs = {}) {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



15
16
17
18
19
# File 'lib/captivus/configuration.rb', line 15

def configure(attrs = {})
  attrs.each { |attr, value| send "#{attr}=", value }
  yield self if block_given?
  self
end