Module: Rmega::Nodes::Expandable
Instance Method Summary collapse
Methods included from Uploadable
#encrypt_chunck, #read_chunk, #upload, #upload_chunk, #upload_dir
Methods included from Rmega::Net
#http_get_content, #http_post, #survive
Methods included from Options
Methods included from Loggable
Instance Method Details
#create_folder(name) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/rmega/nodes/expandable.rb', line 6 def create_folder(name) node_key = NodeKey.random # encrypt attributes _attr = serialize_attributes(:n => Utils.utf8(name).strip) _attr = aes_cbc_encrypt(node_key.aes_key, _attr) # Encrypt node key encrypted_key = aes_ecb_encrypt(session.master_key, node_key.aes_key) n = [{h: 'xxxxxxxx', t: 1, a: Utils.base64urlencode(_attr), k: Utils.base64urlencode(encrypted_key)}] data = session.request(a: 'p', t: handle, n: n) return Folder.new(session, data['f'][0]) end |
#upload_url(filesize) ⇒ Object
21 22 23 |
# File 'lib/rmega/nodes/expandable.rb', line 21 def upload_url(filesize) session.request(a: 'u', s: filesize)['p'] end |