Class: LoyaltyApIs::Environment
- Inherits:
-
Object
- Object
- LoyaltyApIs::Environment
- Defined in:
- lib/loyalty_ap_is/configuration.rb
Overview
An enum for SDK environments.
Constant Summary collapse
- ENVIRONMENT =
[ SIT = 'SIT'.freeze, PRODUCTION = 'Production'.freeze, UAT = 'UAT'.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.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/loyalty_ap_is/configuration.rb', line 16 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 when 'uat' then UAT else warn "[Environment] Unknown environment '#{value}', falling back to #{default_value} " default_value end end |