-
-
Notifications
You must be signed in to change notification settings - Fork 1
Assets
Asset calls were made in reference to the LunchMoney Developer documentation for Assets.
The LunchMoney::Asset Object is implemented with a few validations based on the developer documentation.
-
type_name
must be one of the valid type names for this field -
subtype_name
must be one of the valid subtype names for this field -
balance_as_of
must be in ISO 8601 extended format -
created_at
must be in ISO 8601 extended format
Like all LunchMoney::DataObject
descendants, this class can be serialized into a hash with the .serialize
method, and optionally have the keys symbolized with .serialize(symbolize_keys: true)
.
You can get all assets using the assets
method:
api = LunchMoney::Api.new
api.assets
Unless there are errors returned this will return an array of LunchMoney::Asset
.
You can create an asset using the create_asset
method, passing the required type_name
, name
, and balance
attributes, as well as any optional attributes you might want to create the asset with:
api = LunchMoney::Api.new
api.create_asset(type_name: "cash", name: "Test Asset", balance: "1234.5678")
api = LunchMoney::Api.new
api.create_asset(
type_name: "cash",
subtype_name: "retirement",
name: "Test Asset",
balance: "1234.5678",
currency: "cad",
institution_name: "Bank of Me",
exclude_transactions: false,
)
This will return a LunchMoney::Asset
.
You can create an update using the update_asset
method, passing the required asset_id
attribute, as well as any attributes you want to update on the asset:
api = LunchMoney::Api.new
api.update_asset(
asset_id: 1
type_name: "other asset",
subtype_name: nil,
name: "Test Asset Updated",
balance: "8765.4321",
currency: "usd",
institution_name: "Piggy Bank",
exclude_transactions: true,
)
Unless there are errors returned this will return a LunchMoney::Asset
.