Module: LeisureKing::Config

Defined in:
lib/leisureking/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/leisureking/config.rb', line 7

def api_key
  @api_key
end

.api_secretObject

Returns the value of attribute api_secret.



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

def api_secret
  @api_secret
end

.api_versionObject

Returns the value of attribute api_version.



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

def api_version
  @api_version
end

.client_emailObject

Who is making the request? For optional HTTP Header



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

def client_email
  @client_email
end

.environmentObject

Returns the value of attribute environment.



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

def environment
  @environment
end

.verboseObject

Returns the value of attribute verbose.



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

def verbose
  @verbose
end

Class Method Details

.init!Hash

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



18
19
20
21
22
23
24
25
26
27
# File 'lib/leisureking/config.rb', line 18

def init!
  @defaults = {
    :@api_key       => nil,
    :@api_secret    => nil,
    :@verbose       => false,
    :@environment   => :test,
    :@client_email  => '',
    :@api_version   => '1l'
  }
end

.reset!Hash

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



31
32
33
# File 'lib/leisureking/config.rb', line 31

def reset!
  @defaults.each { |key, value| instance_variable_set(key, value) }
end

.update!Hash

Set’s the new value’s as instance variables



37
38
39
40
41
# File 'lib/leisureking/config.rb', line 37

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