Class: Padron::AuthData
- Inherits:
-
Object
- Object
- Padron::AuthData
- Defined in:
- lib/padron/auth_data.rb
Class Attribute Summary collapse
-
.environment ⇒ Object
Returns the value of attribute environment.
-
.todays_data_file_name ⇒ Object
Returns the value of attribute todays_data_file_name.
Class Method Summary collapse
Class Attribute Details
.environment ⇒ Object
Returns the value of attribute environment.
7 8 9 |
# File 'lib/padron/auth_data.rb', line 7 def environment @environment end |
.todays_data_file_name ⇒ Object
Returns the value of attribute todays_data_file_name.
7 8 9 |
# File 'lib/padron/auth_data.rb', line 7 def todays_data_file_name @todays_data_file_name end |
Class Method Details
.auth_hash ⇒ Object
27 28 29 30 |
# 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 ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# 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 ⇒ Object
33 34 35 |
# File 'lib/padron/auth_data.rb', line 33 def wsaa_url Padron::URLS[Padron.environment][:wsaa] end |
.wsfe_url ⇒ Object
37 38 39 40 |
# 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 |