Module: Globalticket::Config
- Defined in:
- lib/globalticket/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_secret ⇒ Object
Returns the value of attribute api_secret.
-
.environment ⇒ Object
Returns the value of attribute environment.
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.
6 7 8 |
# File 'lib/globalticket/config.rb', line 6 def api_key @api_key end |
.api_secret ⇒ Object
Returns the value of attribute api_secret.
7 8 9 |
# File 'lib/globalticket/config.rb', line 7 def api_secret @api_secret end |
.environment ⇒ Object
Returns the value of attribute environment.
8 9 10 |
# File 'lib/globalticket/config.rb', line 8 def environment @environment end |
Class Method Details
.init! ⇒ Hash
Set’s the default value’s to nil and false
13 14 15 16 17 18 19 |
# File 'lib/globalticket/config.rb', line 13 def init! @defaults = { :@api_key => nil, :@api_secret => nil, :@environment => 'test' } end |
.reset! ⇒ Hash
Resets the value’s to there previous value (instance_variable)
23 24 25 |
# File 'lib/globalticket/config.rb', line 23 def reset! @defaults.each { |key, value| instance_variable_set(key, value) } end |
.update! ⇒ Hash
Set’s the new value’s as instance variables
29 30 31 32 33 |
# File 'lib/globalticket/config.rb', line 29 def update! @defaults.each do |key, value| instance_variable_set(key, value) unless instance_variable_defined?(key) end end |