Class: Evvnt::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/evvnt/configuration.rb

Overview

Handles configuration for the gem

Constant Summary collapse

ENVIRONMENTS =
%i[sandbox live].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Configuration

Returns a new instance of Configuration.



26
27
28
# File 'lib/evvnt/configuration.rb', line 26

def initialize(&block)
  instance_eval(&block) if block_given?
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



20
21
22
# File 'lib/evvnt/configuration.rb', line 20

def api_key
  @api_key
end

#api_secretObject

Returns the value of attribute api_secret.



24
25
26
# File 'lib/evvnt/configuration.rb', line 24

def api_secret
  @api_secret
end

#debugObject



49
50
51
# File 'lib/evvnt/configuration.rb', line 49

def debug
  defined?(@debug) ? @debug : @debug = false
end

#loggerObject



43
44
45
# File 'lib/evvnt/configuration.rb', line 43

def logger
  @logger ||= Logger.new($stdout)
end

Instance Method Details

#environmentObject



37
38
39
# File 'lib/evvnt/configuration.rb', line 37

def environment
  @environment ||= :sandbox
end

#environment=(value) ⇒ Object

Raises:

  • (ArgumentError)


32
33
34
35
# File 'lib/evvnt/configuration.rb', line 32

def environment=(value)
  raise ArgumentError unless value.to_sym.in?(ENVIRONMENTS)
  @environment = value
end