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) ⇒ Asset

Returns a new instance of Asset.



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

#balanceObject

Returns the value of attribute balance.



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

def balance
  @balance
end

#balance_as_ofObject

Returns the value of attribute balance_as_of.



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

def balance_as_of
  @balance_as_of
end

#closed_onObject

Returns the value of attribute closed_on.



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

def closed_on
  @closed_on
end

#created_atObject

Returns the value of attribute created_at.



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

def created_at
  @created_at
end

#currencyObject

Returns the value of attribute currency.



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

def currency
  @currency
end

#display_nameObject

Returns the value of attribute display_name.



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

def display_name
  @display_name
end

#exclude_transactionsObject

Returns the value of attribute exclude_transactions.



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

def exclude_transactions
  @exclude_transactions
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#institution_nameObject

Returns the value of attribute institution_name.



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

def institution_name
  @institution_name
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#subtype_nameObject

Returns the value of attribute subtype_name.



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

def subtype_name
  @subtype_name
end

#type_nameObject

Returns the value of attribute type_name.



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

def type_name
  @type_name
end