class Padron::AuthData

Attributes

environment[RW]
todays_data_file_name[RW]

Public Class Methods

auth_hash() click to toggle source
# File lib/padron/auth_data.rb, line 27
def auth_hash
  fetch unless Padron.constants.include?(:TOKEN) && Padron.constants.include?(:SIGN)
  { 'token' => Padron::TOKEN, 'sign'  => Padron::SIGN, 'cuitRepresentado'  => Padron.cuit }
end
fetch() click to toggle source
# File lib/padron/auth_data.rb, line 9
def fetch
  unless File.exists?(Padron.pkey)
    raise "Archivo de llave privada no encontrado en #{ Padron.pkey }"
  end

  unless File.exists?(Padron.cert)
    raise "Archivo certificado no encontrado en #{ Padron.cert }"
  end

  unless File.exists?(todays_data_file_name)
    Padron::Wsaa.login
  end

  YAML.load_file(todays_data_file_name).each do |k, v|
    Padron.const_set(k.to_s.upcase, v) #unless Padron.const_defined?(k.to_s.upcase)
  end
end
wsaa_url() click to toggle source
# File lib/padron/auth_data.rb, line 33
def wsaa_url
  Padron::URLS[Padron.environment][:wsaa]
end
wsfe_url() click to toggle source
# File lib/padron/auth_data.rb, line 37
def wsfe_url
  raise 'Environment not sent to either :test or :production' unless Padron::URLS.keys.include? environment
  Padron::URLS[Padron.environment][:wsfe]
end