Class: CalendarApi::AutoDeclineMode

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

Overview

Whether to auto-decline conflicting meeting invitations.

Constant Summary collapse

AUTO_DECLINE_MODE =
[
  # TODO: Write general description for DECLINENONE
  DECLINENONE = 'declineNone'.freeze,

  # TODO: Write general description for DECLINEALLCONFLICTINGINVITATIONS
  DECLINEALLCONFLICTINGINVITATIONS = 'declineAllConflictingInvitations'.freeze,

  # TODO: Write general description for DECLINEONLYNEWCONFLICTINGINVITATIONS
  DECLINEONLYNEWCONFLICTINGINVITATIONS = 'declineOnlyNewConflictingInvitations'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = DECLINENONE) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/calendar_api/models/auto_decline_mode.rb', line 26

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

  str = value.to_s.strip

  case str.downcase
  when 'declinenone' then DECLINENONE
  when 'declineallconflictinginvitations' then DECLINEALLCONFLICTINGINVITATIONS
  when 'declineonlynewconflictinginvitations' then DECLINEONLYNEWCONFLICTINGINVITATIONS
  else
    default_value
  end
end

.validate(value) ⇒ Object



20
21
22
23
24
# File 'lib/calendar_api/models/auto_decline_mode.rb', line 20

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

  AUTO_DECLINE_MODE.include?(value)
end