Class: AdvancedBilling::Server
- Inherits:
-
Object
- Object
- AdvancedBilling::Server
- Defined in:
- lib/advanced_billing/configuration.rb
Overview
An enum for API servers.
Constant Summary collapse
- SERVER =
[ PRODUCTION = 'production'.freeze, EBB = 'ebb'.freeze ].freeze
Class Method Summary collapse
-
.from_value(value, default_value = PRODUCTION) ⇒ Object
Converts a string or symbol into a valid Server constant.
Class Method Details
.from_value(value, default_value = PRODUCTION) ⇒ Object
Converts a string or symbol into a valid Server constant.
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/advanced_billing/configuration.rb', line 40 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 'ebb' then EBB else warn "[Server] Unknown server '#{value}', falling back to #{default_value} " default_value end end |