Class: ModernTreasury::Direction5
- Inherits:
-
Object
- Object
- ModernTreasury::Direction5
- Defined in:
- lib/modern_treasury/models/direction5.rb
Overview
One of ‘credit`, `debit`. Describes the direction money is flowing in the transaction. A `credit` moves money from your account to someone else’s. A ‘debit` pulls money from someone else’s account to your own. Note that wire, rtp, and check payments will always be ‘credit`.
Constant Summary collapse
- DIRECTION5 =
[ # TODO: Write general description for CREDIT CREDIT = 'credit'.freeze, # TODO: Write general description for DEBIT DEBIT = 'debit'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = CREDIT) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/modern_treasury/models/direction5.rb', line 26 def self.from_value(value, default_value = CREDIT) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'credit' then CREDIT when 'debit' then DEBIT else default_value end end |
.validate(value) ⇒ Object
20 21 22 23 24 |
# File 'lib/modern_treasury/models/direction5.rb', line 20 def self.validate(value) return false if value.nil? DIRECTION5.include?(value) end |