Class: Rbox::Response::AccountTree
- Inherits:
-
Object
- Object
- Rbox::Response::AccountTree
show all
- Includes:
- CollectNestedKey, Base
- Defined in:
- lib/rbox/response/items/account_tree.rb
Instance Method Summary
collapse
#collect_nested_key
Methods included from Base
#initialize, #method_missing, #status, #success?
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Rbox::Response::Base
Instance Method Details
#files ⇒ Object
12
13
14
|
# File 'lib/rbox/response/items/account_tree.rb', line 12
def files
@files ||= collect_nested_key(@body_response['tree'], 'file').map {|f| File.new(f, @client) }
end
|
#folders ⇒ Object
16
17
18
|
# File 'lib/rbox/response/items/account_tree.rb', line 16
def folders
@folder ||= collect_nested_key(@body_response['tree'], 'folder').map {|f| Folder.new(f, @client) }
end
|
#root_folder ⇒ Object
Also known as:
tree
7
8
9
|
# File 'lib/rbox/response/items/account_tree.rb', line 7
def root_folder
@root_folder ||= Folder.new(@body_response['tree']['folder'], @client)
end
|
#to_array ⇒ Object
Also known as:
to_a
20
21
22
|
# File 'lib/rbox/response/items/account_tree.rb', line 20
def to_array
root_folder.folders.map {|f| f.to_hash } + root_folder.files.map {|f| f.to_hash }
end
|
#to_hash ⇒ Object
Also known as:
to_h, attributes
25
26
27
|
# File 'lib/rbox/response/items/account_tree.rb', line 25
def to_hash
root_folder.to_hash
end
|