Class: ThePlaidApi::ConsentEventCode

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

Overview

Codes describing the object of a consent event.

Constant Summary collapse

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

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = USER_AGREEMENT) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/the_plaid_api/models/consent_event_code.rb', line 32

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

  str = value.to_s.strip

  case str.downcase
  when 'user_agreement' then USER_AGREEMENT
  when 'use_cases' then USE_CASES
  when 'data_scopes' then DATA_SCOPES
  when 'account_scopes' then ACCOUNT_SCOPES
  when 'revocation' then REVOCATION
  else
    default_value
  end
end

.validate(value) ⇒ Object



26
27
28
29
30
# File 'lib/the_plaid_api/models/consent_event_code.rb', line 26

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

  CONSENT_EVENT_CODE.include?(value)
end