Class: FE::Configuration
- Inherits:
-
Object
- Object
- FE::Configuration
- Defined in:
- lib/facturacr/configuration.rb
Instance Attribute Summary collapse
-
#api_client_id ⇒ Object
Returns the value of attribute api_client_id.
-
#api_password ⇒ Object
Returns the value of attribute api_password.
-
#api_username ⇒ Object
Returns the value of attribute api_username.
-
#authentication_endpoint ⇒ Object
Returns the value of attribute authentication_endpoint.
-
#documents_endpoint ⇒ Object
Returns the value of attribute documents_endpoint.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#file_path ⇒ Object
Returns the value of attribute file_path.
-
#key_password ⇒ Object
Returns the value of attribute key_password.
-
#key_path ⇒ Object
Returns the value of attribute key_path.
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #file? ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #manual? ⇒ Boolean
- #read_config_file ⇒ Object
- #version_42? ⇒ Boolean
- #version_43? ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/facturacr/configuration.rb', line 19 def initialize @environment = "development" @mode = :manual @api_username = "changeme" @api_password = "changeme" @key_path = "resources/test.p12" @key_password = "test123" @api_client_id = 'api-stag' @documents_endpoint = "https://api.comprobanteselectronicos.go.cr/recepcion-sandbox/v1" @authentication_endpoint = "https://idp.comprobanteselectronicos.go.cr/auth/realms/rut-stag/protocol/openid-connect" end |
Instance Attribute Details
#api_client_id ⇒ Object
Returns the value of attribute api_client_id.
12 13 14 |
# File 'lib/facturacr/configuration.rb', line 12 def api_client_id @api_client_id end |
#api_password ⇒ Object
Returns the value of attribute api_password.
7 8 9 |
# File 'lib/facturacr/configuration.rb', line 7 def api_password @api_password end |
#api_username ⇒ Object
Returns the value of attribute api_username.
6 7 8 |
# File 'lib/facturacr/configuration.rb', line 6 def api_username @api_username end |
#authentication_endpoint ⇒ Object
Returns the value of attribute authentication_endpoint.
11 12 13 |
# File 'lib/facturacr/configuration.rb', line 11 def authentication_endpoint @authentication_endpoint end |
#documents_endpoint ⇒ Object
Returns the value of attribute documents_endpoint.
10 11 12 |
# File 'lib/facturacr/configuration.rb', line 10 def documents_endpoint @documents_endpoint end |
#environment ⇒ Object
Returns the value of attribute environment.
13 14 15 |
# File 'lib/facturacr/configuration.rb', line 13 def environment @environment end |
#file_path ⇒ Object
Returns the value of attribute file_path.
14 15 16 |
# File 'lib/facturacr/configuration.rb', line 14 def file_path @file_path end |
#key_password ⇒ Object
Returns the value of attribute key_password.
9 10 11 |
# File 'lib/facturacr/configuration.rb', line 9 def key_password @key_password end |
#key_path ⇒ Object
Returns the value of attribute key_path.
8 9 10 |
# File 'lib/facturacr/configuration.rb', line 8 def key_path @key_path end |
#mode ⇒ Object
Returns the value of attribute mode.
15 16 17 |
# File 'lib/facturacr/configuration.rb', line 15 def mode @mode end |
#version ⇒ Object
Returns the value of attribute version.
16 17 18 |
# File 'lib/facturacr/configuration.rb', line 16 def version @version end |
Instance Method Details
#file? ⇒ Boolean
47 48 49 |
# File 'lib/facturacr/configuration.rb', line 47 def file? @mode.to_sym.eql?(:file) end |
#manual? ⇒ Boolean
43 44 45 |
# File 'lib/facturacr/configuration.rb', line 43 def manual? @mode.to_sym.eql?(:manual) end |
#read_config_file ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/facturacr/configuration.rb', line 31 def read_config_file if file? && @file_path && File.exist?(@file_path) template = ERB.new(File.read(@file_path)) result = YAML.load(template.result(binding)) result[@environment].each do |k,v| if respond_to?(k) self.send("#{k}=",v) end end end end |
#version_42? ⇒ Boolean
51 52 53 |
# File 'lib/facturacr/configuration.rb', line 51 def version_42? version.eql?('4.2') end |
#version_43? ⇒ Boolean
55 56 57 |
# File 'lib/facturacr/configuration.rb', line 55 def version_43? version.eql?('4.3') end |