class B2::File

Attributes

account_id[R]
bucket_id[R]
id[R]
metadata[R]
mime_type[R]
name[R]
sha1[R]
size[R]
uploaded_at[R]

Public Class Methods

new(attrs, connection) click to toggle source
# File lib/b2/file.rb, line 6
def initialize(attrs, connection)
  @id = attrs['fileId']
  @name = B2.decode(attrs['fileName'])
  @account_id = attrs['accountId']
  @bucket_id = attrs['bucketId']
  @size = attrs['contentLength']
  @sha1 = attrs['contentSha1']
  @mime_type = attrs['contentType']
  @uploaded_at = attrs['uploadTimestamp']
  @metadata = attrs['fileInfo']
  
  @connection = connection
end

Public Instance Methods

delete!() click to toggle source
# File lib/b2/file.rb, line 20
def delete!
  @connection.post('/b2api/v2/b2_delete_file_version', {
    fileId: @id,
    fileName: @name
  })
end