Class: Akatus::Configuration
- Inherits:
-
Object
- Object
- Akatus::Configuration
- Includes:
- Singleton
- Defined in:
- lib/akatus/configuration.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#email ⇒ Object
Returns the value of attribute email.
-
#env ⇒ Object
Returns the value of attribute env.
-
#sandbox ⇒ Object
Returns the value of attribute sandbox.
Instance Method Summary collapse
- #api_url ⇒ Object
- #base_url ⇒ Object
- #config_file_path ⇒ Object
- #environment ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/akatus/configuration.rb', line 14 def initialize @env = environment conf = File.exists?(config_file_path) ? YAML.load_file(config_file_path)[@env] : {} @sandbox = conf['sandbox'] == true @api_key = conf['api_key'] @email = conf['email'] end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
12 13 14 |
# File 'lib/akatus/configuration.rb', line 12 def api_key @api_key end |
#email ⇒ Object
Returns the value of attribute email.
12 13 14 |
# File 'lib/akatus/configuration.rb', line 12 def email @email end |
#env ⇒ Object
Returns the value of attribute env.
12 13 14 |
# File 'lib/akatus/configuration.rb', line 12 def env @env end |
#sandbox ⇒ Object
Returns the value of attribute sandbox.
12 13 14 |
# File 'lib/akatus/configuration.rb', line 12 def sandbox @sandbox end |
Instance Method Details
#api_url ⇒ Object
37 38 39 |
# File 'lib/akatus/configuration.rb', line 37 def api_url base_url + "api/v1/" end |
#base_url ⇒ Object
33 34 35 |
# File 'lib/akatus/configuration.rb', line 33 def base_url sandbox ? 'https://sandbox.akatus.com/' : 'https://www.akatus.com/' end |
#config_file_path ⇒ Object
25 26 27 |
# File 'lib/akatus/configuration.rb', line 25 def config_file_path "#{Dir.pwd}/config/akatus.yml" end |
#environment ⇒ Object
29 30 31 |
# File 'lib/akatus/configuration.rb', line 29 def environment ENV['AKATUS_ENV'] || 'development' end |