Class: BoxnetApi::FileNode
- Inherits:
-
Object
- Object
- BoxnetApi::FileNode
- Defined in:
- lib/boxnet.rb
Instance Attribute Summary collapse
-
#files ⇒ Object
readonly
Returns the value of attribute files.
Instance Method Summary collapse
Instance Attribute Details
#files ⇒ Object (readonly)
Returns the value of attribute files.
44 45 46 |
# File 'lib/boxnet.rb', line 44 def files @files end |
Instance Method Details
#process_node(data) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/boxnet.rb', line 46 def process_node(data) # return data.nil? @files = [] @folders = [] if data.has_key?("folder") self.folders << BoxnetApi::Folder.new(data["folder"]) elsif data.has_key?("folders") folder = data["folders"]["folder"] if folder.class == Array folder.each do |f| self.folders << BoxnetApi::Folder.new(f) end elsif folder.class == Hash self.folders << BoxnetApi::Folder.new(folder) end end if data.has_key?("files") file = data["files"]["file"] if file.class == Array file.each do |f| self.files << BoxnetApi::File.new(f) end elsif file.class == Hash self.files << BoxnetApi::File.new(file) end end end |