Module: Globalticket::Config

Defined in:
lib/globalticket/config.rb

Overview

Configuration object for storing some parameters required for making transactions

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.api_keyObject

Returns the value of attribute api_key.



6
7
8
# File 'lib/globalticket/config.rb', line 6

def api_key
  @api_key
end

.api_secretObject

Returns the value of attribute api_secret.



7
8
9
# File 'lib/globalticket/config.rb', line 7

def api_secret
  @api_secret
end

.environmentObject

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

Returns:

  • (Hash)

    configuration options



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)

Returns:

  • (Hash)

    configuration options



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

Returns:

  • (Hash)

    configuration options



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