class PuntosPoint::Config

Configuration variables wsdl_url, api user, api password

Constants

BASE_WSDL_URL

Attributes

api_password[RW]
api_user[RW]
config_filepath[RW]
wsdl_url[RW]

Public Class Methods

new(env = nil) click to toggle source

Public: Loads the configuration file puntospoint.yml If it's a rails application it will take the file from the config/ directory

env - Environment.

Returns a Config object.

# File lib/puntospoint/config.rb, line 16
def initialize(env = nil)
  if env
    # For non-rails apps
    @config_filepath = File.join(File.dirname(__FILE__), "..", "..", "config", "puntospoint.yml")
    load(env)
  else
    @config_filepath = File.join(Rails.root, "config", "puntospoint.yml")
    load(Rails.env)
  end
end

Private Instance Methods

load(env) click to toggle source

Public: Initialize variables based on puntospoint.yml

env - Environment.

Returns nothing.

# File lib/puntospoint/config.rb, line 34
def load(env)
  config = YAML.load_file(@config_filepath)[env]
  @wsdl_url = config['wsdl_url'] || BASE_WSDL_URL
  @api_user = config['api_user']
  @api_password = config['api_password']
end