Class: CalendarApi::CalendarNotificationType

Inherits:
Object
  • Object
show all
Defined in:
lib/calendar_api/models/calendar_notification_type.rb

Overview

The type of notification.

Constant Summary collapse

CALENDAR_NOTIFICATION_TYPE =
[
  # TODO: Write general description for EVENTCREATION
  EVENTCREATION = 'eventCreation'.freeze,

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = EVENTCREATION) ⇒ Object



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

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

  str = value.to_s.strip

  case str.downcase
  when 'eventcreation' then EVENTCREATION
  when 'eventchange' then EVENTCHANGE
  when 'eventcancellation' then EVENTCANCELLATION
  when 'eventresponse' then EVENTRESPONSE
  when 'agenda' then AGENDA
  else
    default_value
  end
end

.validate(value) ⇒ Object



26
27
28
29
30
# File 'lib/calendar_api/models/calendar_notification_type.rb', line 26

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

  CALENDAR_NOTIFICATION_TYPE.include?(value)
end