Class: CcipDirectoryAndConfigurationRestApiV1::Environment
- Inherits:
-
Object
- Object
- CcipDirectoryAndConfigurationRestApiV1::Environment
- Defined in:
- lib/ccip_directory_and_configuration_rest_api_v1/configuration.rb,
lib/ccip_directory_and_configuration_rest_api_v1/models/environment.rb
Overview
The network environment
Constant Summary collapse
- ENVIRONMENT =
PRODUCTION: Production server ENVIRONMENT2: Development server
[ # TODO: Write general description for MAINNET MAINNET = 'mainnet'.freeze, # TODO: Write general description for TESTNET TESTNET = 'testnet'.freeze ].freeze
Class Method Summary collapse
-
.from_value(value, default_value = MAINNET) ⇒ Object
Converts a string or symbol into a valid Environment constant.
- .validate(value) ⇒ Object
Class Method Details
.from_value(value, default_value = MAINNET) ⇒ Object
Converts a string or symbol into a valid Environment constant.
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/configuration.rb', line 17 def self.from_value(value, default_value = PRODUCTION) return default_value if value.nil? str = value.to_s.strip.downcase case str when 'production' then PRODUCTION when 'environment2' then ENVIRONMENT2 else warn "[Environment] Unknown environment '#{value}', falling back to #{default_value} " default_value end end |
.validate(value) ⇒ Object
17 18 19 20 21 |
# File 'lib/ccip_directory_and_configuration_rest_api_v1/models/environment.rb', line 17 def self.validate(value) return false if value.nil? ENVIRONMENT.include?(value) end |