Class: Verizon::EtxNetworkType

Inherits:
Object
  • Object
show all
Defined in:
lib/verizon/models/etx_network_type.rb

Overview

The type of the device’s network connection at the time of the request. If the device is on the Verizon cellular network it should use the “VZ” value otherwise the “non-VZ” value. Devices on the Verizon network can directly access the ETX Message Exchange on the MEC (Mobile Edge Compute server)

Constant Summary collapse

ETX_NETWORK_TYPE =
[
  # TODO: Write general description for VZ
  VZ = 'VZ'.freeze,

  # TODO: Write general description for NONVZ
  NONVZ = 'non-VZ'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = VZ) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/verizon/models/etx_network_type.rb', line 26

def self.from_value(value, default_value = VZ)
  return default_value if value.nil?

  str = value.to_s.strip

  case str.downcase
  when 'vz' then VZ
  when 'nonvz' then NONVZ
  else
    default_value
  end
end

.validate(value) ⇒ Object



20
21
22
23
24
# File 'lib/verizon/models/etx_network_type.rb', line 20

def self.validate(value)
  return false if value.nil?

  ETX_NETWORK_TYPE.include?(value)
end