Class: AdvancedBilling::Environment
- Inherits:
-
Object
- Object
- AdvancedBilling::Environment
- Defined in:
- lib/advanced_billing/configuration.rb
Overview
An enum for SDK environments.
Constant Summary collapse
- ENVIRONMENT =
US: Default Advanced Billing environment hosted in US. Valid for the majority of our customers. EU: Advanced Billing environment hosted in EU. Use only when you requested EU hosting for your AB account.
[ US = 'US'.freeze, EU = 'EU'.freeze ].freeze
Class Method Summary collapse
-
.from_value(value, default_value = US) ⇒ Object
Converts a string or symbol into a valid Environment constant.
Class Method Details
.from_value(value, default_value = US) ⇒ 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/advanced_billing/configuration.rb', line 17 def self.from_value(value, default_value = US) return default_value if value.nil? str = value.to_s.strip.downcase case str when 'us' then US when 'eu' then EU else warn "[Environment] Unknown environment '#{value}', falling back to #{default_value} " default_value end end |