module Monzo::Client::Attachments

Overview

Exposes methods for dealing with and manipulating Attachments as defined in the Attachments API documentation.

Attachments can be registered with a remote URL for their image content, but it is also possible to host that image with Monzo directly, the full flow for doing so is as follows:

NOTE: This client does not perform any upload on behalf of the user, as there is nothing special about posting to the S3 bucket URL, choices regarding how to do so are left to the developer.

Direct including types

Defined in:

monzo/client/attachments.cr

Instance Method Summary

Instance Method Detail

def deregister_attachment(attachment : Monzo::Attachment) #

Unregisters the specified attachment.

account = client.accounts.first
transaction = client.transactions(account)
attachment = transaction.attachments.first
client.deregister_attachment(attachment) # => true

[View source]
def deregister_attachment(attachment_id : String) #

Unregisters an Attachment with the specified attachment_id.


[View source]
def register_attachment(transaction_id : String, file_url : String, file_type : String) #

Registers an Attachment against the specified transacion_id.


[View source]
def register_attachment(transaction : Monzo::Transaction, file_url : String, file_type : String) #

Registers an Attachment against the specified transaction.

account = client.accounts.first
transaction = client.transactions.first
attachment = client.register_attachment(transaction, "https://www.github.com/logo.png", "image/png")
attachment # => #<Monzo::Attachment:0x110bc9700 @id="attach_ATTACHMENTID", @user_id="user_USERID", ...>

[View source]
def upload_attachment(filename : String, file_type : String) #

Generates a TemporaryAttachmentData object.

data = client.upload_attachment("avatar.png", "image/png")
data # => #<Monzo::TemporaryAttachmentData:0x10e76f540 @file_url="...-avatar.png", @upload_url="...avatar.png">

[View source]