Class: LunchMoney::Objects::Asset

Inherits:
Object
  • Object
show all
Includes:
Validators
Defined in:
lib/lunchmoney/objects/asset.rb

Overview

Constant Summary collapse

VALID_TYPE_NAMES =

Valid asset type names

T.let(
  [
    "cash",
    "credit",
    "investment",
    "real estate",
    "loan",
    "vehicle",
    "cryptocurrency",
    "employee compensation",
    "other liability",
    "other asset",
    "depository",
  ],
  T::Array[String],
)

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Validators

#validate_iso8601!, #validate_one_of!

Methods inherited from Object

#serialize

Constructor Details

#initialize(created_at:, type_name:, name:, balance:, balance_as_of:, currency:, exclude_transactions:, id:, subtype_name: nil, display_name: nil, closed_on: nil, institution_name: nil) ⇒ void

Parameters:

  • created_at (String)
  • type_name (String)
  • name (String)
  • balance (String)
  • balance_as_of (String)
  • currency (String)
  • exclude_transactions (Boolean)
  • id (Integer)
  • subtype_name (String, nil) (defaults to: nil)
  • display_name (String, nil) (defaults to: nil)
  • closed_on (String, nil) (defaults to: nil)
  • institution_name (String, nil) (defaults to: nil)


59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/lunchmoney/objects/asset.rb', line 59

def initialize(created_at:, type_name:, name:, balance:, balance_as_of:, currency:, exclude_transactions:, id:,
  subtype_name: nil, display_name: nil, closed_on: nil, institution_name: nil)
  super()
  @created_at = T.let(validate_iso8601!(created_at), String)
  @type_name = T.let(validate_one_of!(type_name, VALID_TYPE_NAMES), String)
  @name = name
  @balance = balance
  @balance_as_of = T.let(validate_iso8601!(balance_as_of), String)
  @currency = currency
  @exclude_transactions = exclude_transactions
  @id = id
  @subtype_name = subtype_name
  @display_name = display_name
  @closed_on = closed_on
  @institution_name = institution_name
end

Instance Attribute Details

#balanceString

Returns:

  • (String)


17
18
19
# File 'lib/lunchmoney/objects/asset.rb', line 17

def balance
  @balance
end

#balance_as_ofString

Returns:

  • (String)


14
15
16
# File 'lib/lunchmoney/objects/asset.rb', line 14

def balance_as_of
  @balance_as_of
end

#closed_onString?

Returns:

  • (String, nil)


20
21
22
# File 'lib/lunchmoney/objects/asset.rb', line 20

def closed_on
  @closed_on
end

#created_atString

Returns:

  • (String)


14
15
16
# File 'lib/lunchmoney/objects/asset.rb', line 14

def created_at
  @created_at
end

#currencyString

Returns:

  • (String)


17
18
19
# File 'lib/lunchmoney/objects/asset.rb', line 17

def currency
  @currency
end

#display_nameString?

Returns:

  • (String, nil)


20
21
22
# File 'lib/lunchmoney/objects/asset.rb', line 20

def display_name
  @display_name
end

#exclude_transactionsBoolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/lunchmoney/objects/asset.rb', line 23

def exclude_transactions
  @exclude_transactions
end

#idInteger

Returns:

  • (Integer)


11
12
13
# File 'lib/lunchmoney/objects/asset.rb', line 11

def id
  @id
end

#institution_nameString?

Returns:

  • (String, nil)


20
21
22
# File 'lib/lunchmoney/objects/asset.rb', line 20

def institution_name
  @institution_name
end

#nameString

Returns:

  • (String)


17
18
19
# File 'lib/lunchmoney/objects/asset.rb', line 17

def name
  @name
end

#subtype_nameString?

Returns:

  • (String, nil)


20
21
22
# File 'lib/lunchmoney/objects/asset.rb', line 20

def subtype_name
  @subtype_name
end

#type_nameString

Returns:

  • (String)


14
15
16
# File 'lib/lunchmoney/objects/asset.rb', line 14

def type_name
  @type_name
end