Class: Rmega::Nodes::File

Inherits:
Node
  • Object
show all
Includes:
Deletable, Downloadable
Defined in:
lib/rmega/nodes/file.rb

Constant Summary

Constants inherited from Node

Node::TYPES

Instance Attribute Summary

Attributes inherited from Node

#data, #session

Instance Method Summary collapse

Methods included from Downloadable

#allocate, #allocated?, #calculate_chunck_mac, #decrypt_chunk, #download, #download_chunk, #file_io_synchronize, #read_chunk, #write_chunk

Methods included from Options

included, #options

Methods included from Rmega::Net

#http_get_content, #http_post, #survive

Methods included from Loggable

included, #logger

Methods included from Deletable

#delete, #trash

Methods inherited from Node

#attributes, #decrypted_file_key, each_chunk, #each_chunk, #file_key, #file_keys, #handle, #initialize, #name, #parent_handle, #process_shared_key, #public_handle, #public_url, #rename, #serialize_attributes, #shared_root?, #type

Methods included from Crypto::Rsa

#powm, #rsa_decrypt

Methods included from Crypto::AesCtr

#aes_ctr_cipher, #aes_ctr_decrypt, #aes_ctr_encrypt

Methods included from Crypto::AesEcb

#aes_ecb_cipher, #aes_ecb_decrypt, #aes_ecb_encrypt

Methods included from Crypto::AesCbc

#aes_cbc_cipher, #aes_cbc_decrypt, #aes_cbc_encrypt, #aes_cbc_mac

Methods included from Traversable

#children, #empty?, #files, #folders, #parent

Methods included from Rmega::NotInspectable

#inspect

Constructor Details

This class inherits a constructor from Rmega::Nodes::Node

Instance Method Details

#filesizeObject



18
19
20
# File 'lib/rmega/nodes/file.rb', line 18

def filesize
  size
end

#sizeObject



14
15
16
# File 'lib/rmega/nodes/file.rb', line 14

def size
  data['s']
end

#storage_urlObject



7
8
9
10
11
12
# File 'lib/rmega/nodes/file.rb', line 7

def storage_url
  @storage_url ||= begin
    query_params = data["__n"] ? {n: data["__n"]} : {}
    data['g'] || request({a: 'g', g: 1, n: handle}, query_params)['g']
  end
end