Class: ApiConfiguration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_config, env) ⇒ ApiConfiguration

initializes a configuration object from given YAML file for given environment



6
7
8
9
10
11
12
13
# File 'lib/api_configuration.rb', line 6

def initialize(raw_config, env)
  raw_config[env.to_s].each { |key, value| self.instance_variable_set("@#{key}", value) }
  self.verbosity = raw_config['general']['verbosity'].first
  self.priority = raw_config['general']['priority'] || 0
  self.substitution = raw_config['general']['substitution']
  self.csv_mode = raw_config['general']['csv_mode'].first rescue "none"
  self
end

Instance Attribute Details

#csv_modeObject

Returns the value of attribute csv_mode.



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

def csv_mode
  @csv_mode
end

#hostObject

Returns the value of attribute host.



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

def host
  @host
end

#namespaceObject

Returns the value of attribute namespace.



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

def namespace
  @namespace
end

#portObject

Returns the value of attribute port.



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

def port
  @port
end

#priorityObject

Returns the value of attribute priority.



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

def priority
  @priority
end

#protocolObject

Returns the value of attribute protocol.



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

def protocol
  @protocol
end

#substitutionObject

Returns the value of attribute substitution.



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

def substitution
  @substitution
end

#verbosityObject

Returns the value of attribute verbosity.



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

def verbosity
  @verbosity
end