module Monzo::Client::Transactions
Overview
Exposes methods for dealing with Transaction
s and manipulating their annotations/metadata, as defined by
the Transaction API documentation.
Direct including types
Defined in:
monzo/client/transactions.crInstance Method Summary
-
#annotate(transaction_id : String, name : String, value : String)
Applies an annotation to a
Transaction
with the specified transaction_id. -
#annotate(transaction : Monzo::Transaction, name : String, value : String)
Applies an annotation to the specified transaction.
-
#annotate(transaction_id : String, annotations : Array(Tuple(String, String)))
Applies multiple annotations to a
Transaction
with the specifiedtransaction_id
. -
#annotate(transaction : Monzo::Transaction, annotations : Array(Tuple(String, String)))
Applies multiple annotations to the specified transaction.
-
#remove_annotation(transaction_id : String, key : String)
Remvoes an annotation from a
Transaction
with the specified transaction_id. -
#remove_annotation(transaction : Monzo::Transaction, key : String)
Removes an annotation from the specified transaction.
-
#remove_annotations(transaction_id : String, keys : Array(String))
Remove multiple anntatons from a
Transaction
with the specifed transaction_id. -
#remove_annotations(transaction : Monzo::Transaction, keys : Array(String))
Removes multiple annotations from the specified transaction.
-
#transaction(transaction_id : String)
Returns a
Transaction
for the specified transaction_id. -
#transactions(account : Account)
Returns
Transaction
s for the specified account. -
#transactions(account_id : String)
Returns
Transaction
s for the specified account_id.
Instance Method Detail
Applies an annotation to a Transaction
with the specified transaction_id.
Applies an annotation to the specified transaction.
transaction = client.transactions.first
client.annotate(transaction, "Rating", "Best coffee in London") # => #<Monzo::Transaction:0x104163f00 @id="tx_TRANSACTIONID", @metadata={"Rating"=>"Best coffee in London"}, ... >]
Applies multiple annotations to a Transaction
with the specified transaction_id
.
Applies multiple annotations to the specified transaction.
transaction = client.transactions.first
client.annotate(transaction, [{"Vegan", "Pretty good"}, {"Veggie", "Everything is veggie"}]) # => #<Monzo::Transaction:0x104163f00 @id="tx_TRANSACTIONID", @metadata={"Vegan"=>"Pretty good.", "Veggie"=>"Everything is veggie."}, ... >]
Remvoes an annotation from a Transaction
with the specified transaction_id.
Removes an annotation from the specified transaction.
transaction = client.transactions.first # => #<Monzo::Transaction:0x104163f00 @id="tx_TRANSACTIONID", @metadata={"Rating"=>"Best coffee in London"}, ... >]
client.remove_annotation(transaction, "Rating") # => #<Monzo::Transaction:0x104163f00 @id="tx_TRANSACTIONID", @metadata={}, ... >]
Remove multiple anntatons from a Transaction
with the specifed transaction_id.
Removes multiple annotations from the specified transaction.
transaction = client.transactions.first # => #<Monzo::Transaction:0x104163f00 @id="tx_TRANSACTIONID", @metadata={"Vegan"=>"Pretty good.", "Veggie"=>"Everything is veggie."}, ... >]
client.remove_annotations(transaction, ["Vegan", "Veggie"]) # => #<Monzo::Transaction:0x104163f00 @id="tx_TRANSACTIONID", @metadata={}, ... >]
Returns a Transaction
for the specified transaction_id.
client.transaction("tx_TRANSACTIONID") #=> #<Monzo::Transaction:0x104163f00 @id="tx_TRANSACTIONID", @amount=10000, ... >]
Returns Transaction
s for the specified account.
account = client.accounts.first
client.transactions(account) # => [#<Monzo::Transaction:0x104163f00 @id="tx_TRANSACTIONID", @amount=10000, @currency="GBP", ... >]