module NwmlsClient::Base

Constants

NWMLS_FILE

Public Class Methods

load_config() click to toggle source
# File lib/nwmls_client/base.rb, line 10
def self.load_config()
  if not File.exist?(NWMLS_FILE)
    puts "Generating config file: #{NWMLS_FILE}"        
    store = YAML::Store.new NWMLS_FILE
    store.transaction do 
      store["default"] = { 
        "mls" => "NWMLS", 
        "schema" => "StandardXML1_3",
        "user_id" => "your_nwmls_user_id",
        "password" => "your_nwmls_password"
      }
    end
  end

  if File.exist?(NWMLS_FILE)
    data = YAML::load_file(NWMLS_FILE)
  else
    raise "Unable to generate config file: #{NWMLS_FILE}"
  end

  return data['default']

end