Class: ThePlaidApi::ConsentEventInitiator

Inherits:
Object
  • Object
show all
Defined in:
lib/the_plaid_api/models/consent_event_initiator.rb

Overview

The entity that initiated collection of consent.

Constant Summary collapse

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = PLAID) ⇒ Object



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

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

  str = value.to_s.strip

  case str.downcase
  when 'plaid' then PLAID
  when 'data_provider' then DATA_PROVIDER
  when 'customer' then CUSTOMER
  when 'end_user' then END_USER
  else
    default_value
  end
end

.validate(value) ⇒ Object



23
24
25
26
27
# File 'lib/the_plaid_api/models/consent_event_initiator.rb', line 23

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

  CONSENT_EVENT_INITIATOR.include?(value)
end