Class: ModernTreasury::PartyType5

Inherits:
Object
  • Object
show all
Defined in:
lib/modern_treasury/models/party_type5.rb

Overview

Either individual or business.

Constant Summary collapse

PARTY_TYPE5 =
[
  # TODO: Write general description for BUSINESS
  BUSINESS = 'business'.freeze,

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = BUSINESS) ⇒ Object



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

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

  str = value.to_s.strip

  case str.downcase
  when 'business' then BUSINESS
  when 'individual' then INDIVIDUAL
  else
    default_value
  end
end

.validate(value) ⇒ Object



17
18
19
20
21
# File 'lib/modern_treasury/models/party_type5.rb', line 17

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

  PARTY_TYPE5.include?(value)
end