Class: Verizon::FirmwareProtocol

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

Overview

Firmware protocol. Valid values include: LWM2M, OMD-DM, all.

Constant Summary collapse

FIRMWARE_PROTOCOL =
[
  # TODO: Write general description for LW_M2M
  LW_M2M = 'LWM2M'.freeze,

  # TODO: Write general description for OMDDM
  OMDDM = 'OMD-DM'.freeze,

  # TODO: Write general description for ALL
  ALL = 'all'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = LW_M2M) ⇒ Object



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

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

  str = value.to_s.strip

  case str.downcase
  when 'lw_m2m' then LW_M2M
  when 'omddm' then OMDDM
  when 'all' then ALL
  else
    default_value
  end
end

.validate(value) ⇒ Object



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

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

  FIRMWARE_PROTOCOL.include?(value)
end