Class: CalendarApi::EventVisibility

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

Overview

Visibility of the event.

Constant Summary collapse

EVENT_VISIBILITY =
[
  # TODO: Write general description for DEFAULT
  DEFAULT = 'default'.freeze,

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = DEFAULT) ⇒ Object



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

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

  str = value.to_s.strip

  case str.downcase
  when 'default' then DEFAULT
  when 'public' then PUBLIC
  when 'private' then PRIVATE
  when 'confidential' then CONFIDENTIAL
  else
    default_value
  end
end

.validate(value) ⇒ Object



23
24
25
26
27
# File 'lib/calendar_api/models/event_visibility.rb', line 23

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

  EVENT_VISIBILITY.include?(value)
end