Class: Access::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/access/config.rb

Constant Summary collapse

DOMAINS =
{'production' => '', 'demo' => '-demo', 'stage' => '-stage', 'staging' => '-stage', 'development' => '' }

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/access/config.rb', line 19

def initialize
  @access_token = ENV['ACCESS_TOKEN']
  # demo, stage, production
  @api_environment = ENV['ACCESS_ENVIRONMENT'] || 'demo'
  # @api_version = ENV['ACCESS_VERSION'] || 'v1'
  @return_json = ENV['ACCESS_RETURN_JSON'] || 'false'
  # only used when return_json is true
  @hashify = ENV['ACCESS_HASHIFY'] || 'false'
  # how many seconds till we raise a Access::Error::Timeout
  @access_timeout = ENV['ACCESS_TIMEOUT'] || '10'
end

Instance Attribute Details

#access_timeoutObject

Returns the value of attribute access_timeout.



17
18
19
# File 'lib/access/config.rb', line 17

def access_timeout
  @access_timeout
end

#access_tokenObject

Returns the value of attribute access_token.



17
18
19
# File 'lib/access/config.rb', line 17

def access_token
  @access_token
end

#api_environmentObject

Returns the value of attribute api_environment.



17
18
19
# File 'lib/access/config.rb', line 17

def api_environment
  @api_environment
end

#hashifyObject

Returns the value of attribute hashify.



17
18
19
# File 'lib/access/config.rb', line 17

def hashify
  @hashify
end

#return_jsonObject

Returns the value of attribute return_json.



17
18
19
# File 'lib/access/config.rb', line 17

def return_json
  @return_json
end

Instance Method Details

#resetObject



31
32
33
34
35
36
37
38
# File 'lib/access/config.rb', line 31

def reset
  self.access_token = ENV['ACCESS_TOKEN']
  self.api_environment = ENV['ACCESS_ENVIRONMENT'] || 'demo'
  # self.api_version = 'v1'
  self.return_json = ENV['ACCESS_RETURN_JSON'] || 'false'
  self.hashify = ENV['ACCESS_HASHIFY'] || 'false'
  self.access_timeout = ENV['ACCESS_TIMEOUT'] || '10'
end