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
30
31
32
# 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'
  # Set to 'true' to see the raw output of the httparty call
  @access_debug_output = ENV['ACCESS_DEBUG_OUTPUT'] || 'false'
  @access_used_fields = ENV['ACCESS_USED_FIELDS'] || 'false'
end

Instance Attribute Details

#access_debug_outputObject

Returns the value of attribute access_debug_output.



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

def access_debug_output
  @access_debug_output
end

#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

#access_used_fieldsObject

Returns the value of attribute access_used_fields.



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

def access_used_fields
  @access_used_fields
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



34
35
36
37
38
39
40
41
42
43
# File 'lib/access/config.rb', line 34

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'
  self.access_debug_output = ENV['ACCESS_DEBUG_OUTPUT'] || 'false'
  self.access_used_fields = ENV['ACCESS_USED_FIELDS'] || 'false'
end