Module: Rmega::Nodes::Expandable

Includes:
Uploadable
Included in:
Folder, Root
Defined in:
lib/rmega/nodes/expandable.rb

Instance Method Summary collapse

Methods included from Uploadable

#encrypt_chunck, #read_chunk, #upload, #upload_chunk

Instance Method Details

#create_folder(name) ⇒ Object


10
11
12
13
14
15
16
17
# File 'lib/rmega/nodes/expandable.rb', line 10

def create_folder(name)
  key = Crypto.random_key
  encrypted_attributes = Utils.a32_to_base64 Crypto.encrypt_attributes(key[0..3], {n: name.strip})
  encrypted_key = Utils.a32_to_base64 Crypto.encrypt_key(session.master_key, key)
  n = [{h: 'xxxxxxxx', t: 1, a: encrypted_attributes, k: encrypted_key}]
  data = session.request a: 'p', t: handle, n: n
  Folder.new(session, data['f'][0])
end

#upload_url(filesize) ⇒ Object


19
20
21
# File 'lib/rmega/nodes/expandable.rb', line 19

def upload_url(filesize)
  session.request(a: 'u', s: filesize)['p']
end