Class: FdxV660Api::ConsentDurationType

Inherits:
Object
  • Object
show all
Defined in:
lib/fdx_v660_api/models/consent_duration_type.rb

Overview

Duration of the Consent Grant, per FDX UX Guidelines v1.0 (pp 18 - 20)

Constant Summary collapse

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = ONE_TIME) ⇒ Object



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

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

  str = value.to_s.strip

  case str.downcase
  when 'one_time' then ONE_TIME
  when 'persistent' then PERSISTENT
  when 'time_bound' then TIME_BOUND
  else
    default_value
  end
end

.validate(value) ⇒ Object



20
21
22
23
24
# File 'lib/fdx_v660_api/models/consent_duration_type.rb', line 20

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

  true
end