Module: Enviso::Config

Defined in:
lib/enviso/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.



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

def api_key
  @api_key
end

Returns the value of attribute api_link.



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

def api_link
  @api_link
end

.api_secretObject

Returns the value of attribute api_secret.



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

def api_secret
  @api_secret
end

.api_versionObject

Returns the value of attribute api_version.



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

def api_version
  @api_version
end

.environmentObject

Returns the value of attribute environment.



13
14
15
# File 'lib/enviso/config.rb', line 13

def environment
  @environment
end

.tenant_keyObject

Returns the value of attribute tenant_key.



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

def tenant_key
  @tenant_key
end

.verboseObject

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

Returns:

  • (Hash)

    configuration options



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)

Returns:

  • (Hash)

    configuration options



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

Returns:

  • (Hash)

    configuration options



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