Class: Bravo::AuthData

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

Class Method Summary collapse

Class Method Details

.fetchObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/bravo/auth_data.rb', line 5

def fetch
  todays_datafile = "/tmp/bravo_#{Time.new.strftime('%d_%m_%Y')}.yml"
  opts = "-u https://wsaahomo.afip.gov.ar/ws/services/LoginCms"
  keys_root = "/Users/leanucci/Xephstratus/afip/claves/"
  opts += " -k #{Bravo.pkey}"
  opts += " -c #{Bravo.cert}"

  unless File.exists?(todays_datafile)
    %x(#{File.dirname(__FILE__)}/../../wsaa-client.sh #{opts})
  end

  @data = YAML.load_file(todays_datafile).each do |k, v|
    Bravo.const_set(k.to_s.upcase, v) unless Bravo.const_defined?(k.to_s.upcase)
  end
end