Class: MoneyKit::AccountType

Inherits:
Object
  • Object
show all
Defined in:
lib/moneykit/models/account_type.rb

Constant Summary collapse

DEPOSITORY_CASH =
'depository.cash'.freeze
DEPOSITORY_CHECKING =
'depository.checking'.freeze
DEPOSITORY_SAVINGS =
'depository.savings'.freeze
DEPOSITORY_PREPAID =
'depository.prepaid'.freeze
DEPOSITORY_OTHER =
'depository.other'.freeze
CREDIT_CARD =
'credit_card'.freeze
LOAN_GENERAL =
'loan.general'.freeze
LOAN_MORTGAGE =
'loan.mortgage'.freeze
LOAN_OTHER =
'loan.other'.freeze
INVESTMENT =
'investment'.freeze
OTHER =
'other'.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.all_varsObject



28
29
30
31
# File 'lib/moneykit/models/account_type.rb', line 28

def self.all_vars
  @all_vars ||= [DEPOSITORY_CASH, DEPOSITORY_CHECKING, DEPOSITORY_SAVINGS, DEPOSITORY_PREPAID, DEPOSITORY_OTHER,
                 CREDIT_CARD, LOAN_GENERAL, LOAN_MORTGAGE, LOAN_OTHER, INVESTMENT, OTHER].freeze
end

.build_from_hash(value) ⇒ String

Builds the enum from string

Parameters:

  • The (String)

    enum value in the form of the string

Returns:

  • (String)

    The enum value



36
37
38
# File 'lib/moneykit/models/account_type.rb', line 36

def self.build_from_hash(value)
  new.build_from_hash(value)
end

Instance Method Details

#build_from_hash(value) ⇒ String

Builds the enum from string

Parameters:

  • The (String)

    enum value in the form of the string

Returns:

  • (String)

    The enum value



43
44
45
46
47
# File 'lib/moneykit/models/account_type.rb', line 43

def build_from_hash(value)
  return value if AccountType.all_vars.include?(value)

  raise "Invalid ENUM value #{value} for class #AccountType"
end