Class: ModernTreasury::DocumentableType
- Inherits:
-
Object
- Object
- ModernTreasury::DocumentableType
- Defined in:
- lib/modern_treasury/models/documentable_type.rb
Overview
The type of the associated object. Currently can be one of ‘payment_order`, `transaction`, `paper_item`, `expected_payment`, `counterparty`, `organization`, `case`, `internal_account`, `decision`, or `external_account`.
Constant Summary collapse
- DOCUMENTABLE_TYPE =
[ # TODO: Write general description for ENUM_CASE ENUM_CASE = 'case'.freeze, # TODO: Write general description for COUNTERPARTY COUNTERPARTY = 'counterparty'.freeze, # TODO: Write general description for EXPECTED_PAYMENT EXPECTED_PAYMENT = 'expected_payment'.freeze, # TODO: Write general description for EXTERNAL_ACCOUNT EXTERNAL_ACCOUNT = 'external_account'.freeze, # TODO: Write general description for INTERNAL_ACCOUNT INTERNAL_ACCOUNT = 'internal_account'.freeze, # TODO: Write general description for ORGANIZATION ORGANIZATION = 'organization'.freeze, # TODO: Write general description for PAPER_ITEM PAPER_ITEM = 'paper_item'.freeze, # TODO: Write general description for PAYMENT_ORDER PAYMENT_ORDER = 'payment_order'.freeze, # TODO: Write general description for TRANSACTION TRANSACTION = 'transaction'.freeze, # TODO: Write general description for DECISION DECISION = 'decision'.freeze, # TODO: Write general description for CONNECTION CONNECTION = 'connection'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = ENUM_CASE) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/modern_treasury/models/documentable_type.rb', line 53 def self.from_value(value, default_value = ENUM_CASE) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'enum_case' then ENUM_CASE when 'counterparty' then COUNTERPARTY when 'expected_payment' then EXPECTED_PAYMENT when 'external_account' then EXTERNAL_ACCOUNT when 'internal_account' then INTERNAL_ACCOUNT when 'organization' then ORGANIZATION when 'paper_item' then PAPER_ITEM when 'payment_order' then PAYMENT_ORDER when 'transaction' then TRANSACTION when 'decision' then DECISION when 'connection' then CONNECTION else default_value end end |
.validate(value) ⇒ Object
47 48 49 50 51 |
# File 'lib/modern_treasury/models/documentable_type.rb', line 47 def self.validate(value) return false if value.nil? DOCUMENTABLE_TYPE.include?(value) end |