Skip to content

Commit

Permalink
update crypto object to have to_base attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
mmenanno committed Apr 10, 2024
1 parent ef94a52 commit 4f11c06
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/lunchmoney/objects/crypto.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ class Crypto < CryptoBase
sig { returns(String) }
attr_accessor :currency, :status

sig { returns(T.nilable(Number)) }
attr_accessor :to_base

sig do
params(
created_at: String,
Expand All @@ -27,14 +30,16 @@ class Crypto < CryptoBase
id: T.nilable(Integer),
zabo_account_id: T.nilable(Integer),
display_name: T.nilable(String),
to_base: T.nilable(Number),
).void
end
def initialize(created_at:, source:, name:, balance:, balance_as_of:, currency:,
status:, institution_name: nil, id: nil, zabo_account_id: nil, display_name: nil)
status:, institution_name: nil, id: nil, zabo_account_id: nil, display_name: nil, to_base: nil)
super(created_at:, source:, name:, balance:, institution_name:, id:, zabo_account_id:, display_name:)
@balance_as_of = T.let(validate_iso8601!(balance_as_of), String)
@currency = currency
@status = status
@to_base = to_base
end

sig { params(time: String).void }
Expand Down
1 change: 1 addition & 0 deletions test/lunchmoney/objects/crypto_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def create_crypto(source: "manual", balance_as_of: "2023-01-01T01:01:01.000Z", s
"institution_name": nil,
"status": status,
"created_at": created_at,
"to_base": 1.0,
)
end
end
Expand Down

0 comments on commit 4f11c06

Please sign in to comment.