Sha256: 206ddee4b10234680a1d0da84bf7a11c806dd39467153d22367e17ca85155b13
Contents?: true
Size: 793 Bytes
Versions: 5
Compression:
Stored size: 793 Bytes
Contents
module Rbox module Response class AccountTree include Base include CollectNestedKey def root_folder @root_folder ||= Folder.new(@body_response['tree']['folder'], @client) end alias :tree :root_folder def files @files ||= collect_nested_key(@body_response['tree'], 'file').map {|f| File.new(f, @client) } end def folders @folder ||= collect_nested_key(@body_response['tree'], 'folder').map {|f| Folder.new(f, @client) } end def to_array root_folder.folders.map {|f| f.to_hash } + root_folder.files.map {|f| f.to_hash } end alias :to_a :to_array def to_hash root_folder.to_hash end alias :to_h :to_hash alias :attributes :to_hash end end end
Version data entries
5 entries across 5 versions & 1 rubygems