Class: MistApi::CountPbnDistinctEnum

Inherits:
Object
  • Object
show all
Defined in:
lib/mist_api/models/count_pbn_distinct_enum.rb

Overview

count_pbn_distinct.

Constant Summary collapse

COUNT_PBN_DISTINCT_ENUM =
[
  # TODO: Write general description for VERSIONS
  VERSIONS = 'versions'.freeze,

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = VERSIONS) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/mist_api/models/count_pbn_distinct_enum.rb', line 29

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

  str = value.to_s.strip

  case str.downcase
  when 'versions' then VERSIONS
  when 'models' then MODELS
  when 'customer_risk' then CUSTOMER_RISK
  when 'bug_type' then BUG_TYPE
  else
    default_value
  end
end

.validate(value) ⇒ Object



23
24
25
26
27
# File 'lib/mist_api/models/count_pbn_distinct_enum.rb', line 23

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

  COUNT_PBN_DISTINCT_ENUM.include?(value)
end