Class: ShellDataReportingApIs::Environment
- Inherits:
-
Object
- Object
- ShellDataReportingApIs::Environment
- Defined in:
- lib/shell_data_reporting_ap_is/configuration.rb
Overview
An enum for SDK environments.
Constant Summary collapse
- ENVIRONMENT =
[ SIT = 'SIT'.freeze, PRODUCTION = 'Production'.freeze ].freeze
Class Method Summary collapse
-
.from_value(value, default_value = SIT) ⇒ Object
Converts a string or symbol into a valid Environment constant.
Class Method Details
.from_value(value, default_value = SIT) ⇒ Object
Converts a string or symbol into a valid Environment constant.
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/shell_data_reporting_ap_is/configuration.rb', line 15 def self.from_value(value, default_value = SIT) return default_value if value.nil? str = value.to_s.strip.downcase case str when 'sit' then SIT when 'production' then PRODUCTION else warn "[Environment] Unknown environment '#{value}', falling back to #{default_value} " default_value end end |