Class: MistApi::WebhookDeliveryTopicEnum

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

Overview

webhook topic. enum: ‘alarms`, `audits`, `device-updowns`, `occupancy-alerts`, `ping`

Constant Summary collapse

WEBHOOK_DELIVERY_TOPIC_ENUM =
[
  # TODO: Write general description for ALARMS
  ALARMS = 'alarms'.freeze,

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

  # TODO: Write general description for DEVICEUPDOWNS
  DEVICEUPDOWNS = 'device-updowns'.freeze,

  # TODO: Write general description for OCCUPANCYALERTS
  OCCUPANCYALERTS = 'occupancy-alerts'.freeze,

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = ALARMS) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/mist_api/models/webhook_delivery_topic_enum.rb', line 33

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

  str = value.to_s.strip

  case str.downcase
  when 'alarms' then ALARMS
  when 'audits' then AUDITS
  when 'deviceupdowns' then DEVICEUPDOWNS
  when 'occupancyalerts' then OCCUPANCYALERTS
  when 'ping' then PING
  else
    default_value
  end
end

.validate(value) ⇒ Object



27
28
29
30
31
# File 'lib/mist_api/models/webhook_delivery_topic_enum.rb', line 27

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

  WEBHOOK_DELIVERY_TOPIC_ENUM.include?(value)
end