Class: ThePlaidApi::WebhookEnvironmentValues

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

Overview

The Plaid environment the webhook was sent from

Constant Summary collapse

WEBHOOK_ENVIRONMENT_VALUES =
[
  # TODO: Write general description for SANDBOX
  SANDBOX = 'sandbox'.freeze,

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = SANDBOX) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/the_plaid_api/models/webhook_environment_values.rb', line 23

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

  str = value.to_s.strip

  case str.downcase
  when 'sandbox' then SANDBOX
  when 'production' then PRODUCTION
  else
    default_value
  end
end

.validate(value) ⇒ Object



17
18
19
20
21
# File 'lib/the_plaid_api/models/webhook_environment_values.rb', line 17

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

  WEBHOOK_ENVIRONMENT_VALUES.include?(value)
end