class Barite::B2

Overview

The B2 class is the main API interface.

This object is lazy, in that it will only access Backblaze whien it needs to. If you just create the object then destroy it, no connections will be made to Backblaze.

This also means that you wont know that your authentication is correct until you make an access.

Defined in:

barite.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(key_id : String, key : String) #

Initialise with authentication keys. The key_id and key are created from your Backblaze login. Ensure that this key has the capabilities that you will need. For example the ability to read and/or write files is the buckets that you'll be using.


[View source]

Instance Method Detail

def account_id : String #

Retrieve the account_id. Caches result on first access.


[View source]
def api_token : String #

Retrieve the API token. Caches the result on first access.


[View source]
def api_url : String #

Retrieve the API URL. Caches result on first access.


[View source]
def authorize_account #

Access backblaze to authenticate. Initialises @account_id, @api_url and @api_token on success.


[View source]
def file(bucket_name : String, file_name : String) : Barite::B2File #

Return a B2File object referencing the selected file in the named bucket.


[View source]
def get_bucket_id(bucket_name) #

Retrieve the bucket ID for a bucket name.


[View source]
def get_upload_url(bucket_id) #

Retrieve an upload URL for a specific bucket. Raises a Barite::NotFoundException on error.


[View source]