lib/rmega/storage.rb in rmega-0.1.5 vs lib/rmega/storage.rb in rmega-0.1.6
- old
+ new
@@ -22,10 +22,23 @@
session.request(a: 'uq', strg: 1)
end
def nodes
results = session.request(a: 'f', c: 1)['f']
- results.map { |node_data| Nodes::Factory.build(session, node_data) }
+
+ results.map do |node_data|
+ node = Nodes::Factory.build(session, node_data)
+ node.process_shared_key if node.shared_root?
+ node
+ end
+ end
+
+ def folders
+ list = nodes
+ root_handle = list.find { |node| node.type == :root }.handle
+ list.select do |node|
+ node.shared_root? || (node.type == :folder && node.parent_handle == root_handle)
+ end
end
def trash
@trash ||= nodes.find { |n| n.type == :trash }
end