Module: ShakeTheCounter::Config

Defined in:
lib/shake_the_counter/config.rb

Overview

Configuration object for storing some parameters required for making transactions

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.client_idObject

Returns the value of attribute client_id.



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

def client_id
  @client_id
end

.client_secretObject

Returns the value of attribute client_secret.



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

def client_secret
  @client_secret
end

.environmentObject

Returns the value of attribute environment.



9
10
11
# File 'lib/shake_the_counter/config.rb', line 9

def environment
  @environment
end

.language_codeObject

Returns the value of attribute language_code.



10
11
12
# File 'lib/shake_the_counter/config.rb', line 10

def language_code
  @language_code
end

.refresh_tokenObject

Returns the value of attribute refresh_token.



8
9
10
# File 'lib/shake_the_counter/config.rb', line 8

def refresh_token
  @refresh_token
end

.verboseObject

if set, give more output in the log/console



12
13
14
# File 'lib/shake_the_counter/config.rb', line 12

def verbose
  @verbose
end

.versionObject

Returns the value of attribute version.



11
12
13
# File 'lib/shake_the_counter/config.rb', line 11

def version
  @version
end

Class Method Details

.init!Hash

Set’s the default value’s to nil and false

Returns:

  • (Hash)

    configuration options



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/shake_the_counter/config.rb', line 16

def init!
  @defaults = {
    :@refresh_token => ENV["STC_REFRESH_TOKEN"],
    :@client_id     => ENV["STC_CLIENT_ID"],
    :@client_secret => ENV["STC_CLIENT_SECRET"],
    :@language_code => "nl-NL",
    :@environment => 'test',
    :@version => 1,
    :@verbose => false,
  }
end

.reset!Hash

Resets the value’s to there previous value (instance_variable)

Returns:

  • (Hash)

    configuration options



30
31
32
# File 'lib/shake_the_counter/config.rb', line 30

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



36
37
38
39
40
# File 'lib/shake_the_counter/config.rb', line 36

def update!
  @defaults.each do |key, value|
    instance_variable_set(key, value) unless instance_variable_defined?(key)
  end
end