Class: NewStoreApi::Server
- Inherits:
-
Object
- Object
- NewStoreApi::Server
- Defined in:
- lib/new_store_api/configuration.rb
Overview
An enum for API servers.
Constant Summary collapse
- SERVER =
[ API = 'api'.freeze, ACCESS_TOKEN_SERVER = 'access token server'.freeze ].freeze
Class Method Summary collapse
-
.from_value(value, default_value = API) ⇒ Object
Converts a string or symbol into a valid Server constant.
Class Method Details
.from_value(value, default_value = API) ⇒ Object
Converts a string or symbol into a valid Server constant.
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/new_store_api/configuration.rb', line 29 def self.from_value(value, default_value = API) return default_value if value.nil? str = value.to_s.strip.downcase case str when 'api' then API when 'access_token_server' then ACCESS_TOKEN_SERVER else warn "[Server] Unknown server '#{value}', falling back to #{default_value} " default_value end end |