Class: Verizon::Server
- Inherits:
-
Object
- Object
- Verizon::Server
- Defined in:
- lib/verizon/configuration.rb
Overview
An enum for API servers.
Constant Summary collapse
- SERVER =
[ HYPER_PRECISE_CREDENTIALS = 'Hyper Precise Credentials'.freeze, IMP_SERVER = 'IMP Server'.freeze, THINGSPACE = 'Thingspace'.freeze, OAUTH_SERVER = 'OAuth Server'.freeze, M2M = 'M2M'.freeze, DEVICE_LOCATION = 'Device Location'.freeze, SUBSCRIPTION_SERVER = 'Subscription Server'.freeze, SOFTWARE_MANAGEMENT_V1 = 'Software Management V1'.freeze, SOFTWARE_MANAGEMENT_V2 = 'Software Management V2'.freeze, SOFTWARE_MANAGEMENT_V3 = 'Software Management V3'.freeze, DEVICE_DIAGNOSTICS = 'Device Diagnostics'.freeze, CLOUD_CONNECTOR = 'Cloud Connector'.freeze, HYPER_PRECISE_LOCATION = 'Hyper Precise Location'.freeze, SERVICES = 'Services'.freeze, QUALITY_OF_SERVICE = 'Quality Of Service'.freeze ].freeze
Class Method Summary collapse
-
.from_value(value, default_value = HYPER_PRECISE_CREDENTIALS) ⇒ Object
Converts a string or symbol into a valid Server constant.
Class Method Details
.from_value(value, default_value = HYPER_PRECISE_CREDENTIALS) ⇒ Object
Converts a string or symbol into a valid Server constant.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/verizon/configuration.rb', line 57 def self.from_value(value, default_value = HYPER_PRECISE_CREDENTIALS) return default_value if value.nil? str = value.to_s.strip.downcase case str when 'hyper_precise_credentials' then HYPER_PRECISE_CREDENTIALS when 'imp_server' then IMP_SERVER when 'thingspace' then THINGSPACE when 'oauth_server' then OAUTH_SERVER when 'm2m' then M2M when 'device_location' then DEVICE_LOCATION when 'subscription_server' then SUBSCRIPTION_SERVER when 'software_management_v1' then SOFTWARE_MANAGEMENT_V1 when 'software_management_v2' then SOFTWARE_MANAGEMENT_V2 when 'software_management_v3' then SOFTWARE_MANAGEMENT_V3 when 'device_diagnostics' then DEVICE_DIAGNOSTICS when 'cloud_connector' then CLOUD_CONNECTOR when 'hyper_precise_location' then HYPER_PRECISE_LOCATION when 'services' then SERVICES when 'quality_of_service' then QUALITY_OF_SERVICE else warn "[Server] Unknown server '#{value}', falling back to #{default_value} " default_value end end |