Class: Verizon::ProfileStatusFilter

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

Overview

The last status of the device’s profile as a filter.

Constant Summary collapse

PROFILE_STATUS_FILTER =
[
  # TODO: Write general description for ENABLE
  ENABLE = 'ENABLE'.freeze,

  # TODO: Write general description for DISABLE
  DISABLE = 'DISABLE'.freeze,

  # TODO: Write general description for DOWNLOAD_DISABLE
  DOWNLOAD_DISABLE = 'DOWNLOAD_DISABLE'.freeze,

  # TODO: Write general description for DOWNLOAD_ENABLE
  DOWNLOAD_ENABLE = 'DOWNLOAD_ENABLE'.freeze,

  # TODO: Write general description for NOT_DOWNLOADED
  NOT_DOWNLOADED = 'NOT_DOWNLOADED'.freeze,

  # TODO: Write general description for UNKNOWN
  UNKNOWN = 'UNKNOWN'.freeze,

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = ENABLE) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/verizon/models/profile_status_filter.rb', line 38

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

  str = value.to_s.strip

  case str.downcase
  when 'enable' then ENABLE
  when 'disable' then DISABLE
  when 'download_disable' then DOWNLOAD_DISABLE
  when 'download_enable' then DOWNLOAD_ENABLE
  when 'not_downloaded' then NOT_DOWNLOADED
  when 'unknown' then UNKNOWN
  when 'delete' then DELETE
  else
    default_value
  end
end

.validate(value) ⇒ Object



32
33
34
35
36
# File 'lib/verizon/models/profile_status_filter.rb', line 32

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

  PROFILE_STATUS_FILTER.include?(value)
end