Class: MistApi::WebhookDeliveryDistinctEnum

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

Overview

webhook topic. enum: ‘status`, `status_code`, `topic`, `webhook_id`

Constant Summary collapse

WEBHOOK_DELIVERY_DISTINCT_ENUM =
[
  # TODO: Write general description for STATUS
  STATUS = 'status'.freeze,

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = STATUS) ⇒ Object



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

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

  str = value.to_s.strip

  case str.downcase
  when 'status' then STATUS
  when 'status_code' then STATUS_CODE
  when 'topic' then TOPIC
  when 'webhook_id' then WEBHOOK_ID
  else
    default_value
  end
end

.validate(value) ⇒ Object



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

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

  WEBHOOK_DELIVERY_DISTINCT_ENUM.include?(value)
end