Sha256: ab27cab39075305e9c5b19659d60758a6c34da00f40e9b07a8c1ea35b4741cd2
Contents?: true
Size: 1.03 KB
Versions: 3
Compression:
Stored size: 1.03 KB
Contents
module AfipWsfe class AuthData class << self attr_accessor :todays_data_file_name def fetch todays_data_file_exists = if File.exists?(todays_data_file_name) true else wsaa = AfipWsfe::Wsaa.new wsaa.login end YAML.load_file(todays_data_file_name).each do |k, v| AfipWsfe.const_set(k.to_s.upcase, v) unless AfipWsfe.const_defined?(k.to_s.upcase) end if todays_data_file_exists end def auth_hash fetch unless AfipWsfe.constants.include?(:TOKEN) && AfipWsfe.constants.include?(:SIGN) { 'Token' => AfipWsfe::TOKEN, 'Sign' => AfipWsfe::SIGN, 'Cuit' => AfipWsfe.cuit } end def todays_data_file_name @todays_data_file ||= "/tmp/bravo_#{ AfipWsfe.cuit }_#{ Time.zone.today.strftime('%Y_%m_%d') }.yml" end def remove AfipWsfe.remove_const(:TOKEN) AfipWsfe.remove_const(:SIGN) File.delete(@todays_data_file) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
afip_wsfe-0.1.3 | lib/afip_wsfe/auth_data.rb |
afip_wsfe-0.1.2 | lib/afip_wsfe/auth_data.rb |
afip_wsfe-0.1.1 | lib/afip_wsfe/auth_data.rb |