Module: Enviso::Config
- Defined in:
- lib/enviso/config.rb
Overview
Configuration object for storing some parameters required for making transactions
Class Attribute Summary collapse
-
.api_key ⇒ Object
Returns the value of attribute api_key.
-
.api_link ⇒ Object
Returns the value of attribute api_link.
-
.api_secret ⇒ Object
Returns the value of attribute api_secret.
-
.api_version ⇒ Object
Returns the value of attribute api_version.
-
.environment ⇒ Object
Returns the value of attribute environment.
-
.tenant_key ⇒ Object
Returns the value of attribute tenant_key.
-
.verbose ⇒ Object
Returns the value of attribute verbose.
Class Method Summary collapse
-
.init! ⇒ Hash
Set’s the default value’s to nil and false.
-
.reset! ⇒ Hash
Resets the value’s to there previous value (instance_variable).
-
.update! ⇒ Hash
Set’s the new value’s as instance variables.
Class Attribute Details
.api_key ⇒ Object
Returns the value of attribute api_key.
7 8 9 |
# File 'lib/enviso/config.rb', line 7 def api_key @api_key end |
.api_link ⇒ Object
Returns the value of attribute api_link.
11 12 13 |
# File 'lib/enviso/config.rb', line 11 def api_link @api_link end |
.api_secret ⇒ Object
Returns the value of attribute api_secret.
8 9 10 |
# File 'lib/enviso/config.rb', line 8 def api_secret @api_secret end |
.api_version ⇒ Object
Returns the value of attribute api_version.
12 13 14 |
# File 'lib/enviso/config.rb', line 12 def api_version @api_version end |
.environment ⇒ Object
Returns the value of attribute environment.
13 14 15 |
# File 'lib/enviso/config.rb', line 13 def environment @environment end |
.tenant_key ⇒ Object
Returns the value of attribute tenant_key.
9 10 11 |
# File 'lib/enviso/config.rb', line 9 def tenant_key @tenant_key end |
.verbose ⇒ Object
Returns the value of attribute verbose.
10 11 12 |
# File 'lib/enviso/config.rb', line 10 def verbose @verbose end |
Class Method Details
.init! ⇒ Hash
Set’s the default value’s to nil and false
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/enviso/config.rb', line 19 def init! @defaults = { :@api_key => nil, :@api_secret => nil, :@tenant_key => nil, :@verbose => false, :@environment => :test, :@api_version => 1, :@api_link => "https://api.staging-enviso.io/resellingapi/" } end |
.reset! ⇒ Hash
Resets the value’s to there previous value (instance_variable)
33 34 35 |
# File 'lib/enviso/config.rb', line 33 def reset! @defaults.each { |key, value| instance_variable_set(key, value) } end |
.update! ⇒ Hash
Set’s the new value’s as instance variables
39 40 41 42 43 |
# File 'lib/enviso/config.rb', line 39 def update! @defaults.each do |key, value| instance_variable_set(key, value) unless instance_variable_defined?(key) end end |