Class: SendSonar::Configuration
- Inherits:
-
Object
- Object
- SendSonar::Configuration
- Defined in:
- lib/send_sonar/configuration.rb
Constant Summary collapse
- ENV_URLS =
YAML.load_file(File.('../endpoints.yml', __FILE__))
- ALLOWED_ENVS =
ENV_URLS.keys
Instance Attribute Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#token ⇒ Object
14 15 16 |
# File 'lib/send_sonar/configuration.rb', line 14 def token @token || raise(SendSonar::ConfigurationError.new('You need to set your token, see SendSonar Readme')) end |
Instance Method Details
#env ⇒ Object
10 11 12 |
# File 'lib/send_sonar/configuration.rb', line 10 def env @env || :sandbox end |
#env=(env_sym) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/send_sonar/configuration.rb', line 18 def env=(env_sym) if ALLOWED_ENVS.include?(env_sym.to_s) @env = env_sym.to_s else raise SendSonar::ConfigurationError.new("You attempted to set SendSonar env to #{env_sym}. Should be one of #{env_choices}") end end |