Class: LogaltyCertificateIssuanceApiCerty::NoticeMethod

Inherits:
Object
  • Object
show all
Defined in:
lib/logalty_certificate_issuance_api_certy/models/notice_method.rb

Overview

Notification channel used to give the end-user access to the system: - ‘NONE`: No notification is sent; only a synchronous access URL is returned.

  • ‘EMAIL`: An asynchronous access link is sent by e-mail. - `SMS`: An

asynchronous access link is sent by SMS.

Constant Summary collapse

NOTICE_METHOD =
[
  # TODO: Write general description for NONE
  NONE = 'NONE'.freeze,

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = NONE) ⇒ Object



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

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

  str = value.to_s.strip

  case str.downcase
  when 'none' then NONE
  when 'email' then EMAIL
  when 'sms' then SMS
  else
    default_value
  end
end

.validate(value) ⇒ Object



23
24
25
26
27
# File 'lib/logalty_certificate_issuance_api_certy/models/notice_method.rb', line 23

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

  NOTICE_METHOD.include?(value)
end