Class: NVX::SDS::FSFolderList
- Inherits:
-
Object
- Object
- NVX::SDS::FSFolderList
- Defined in:
- lib/nvx/sds/APIClasses/fsfolderlist.rb
Overview
FSFolderList is an internal class used to extract file and folder information from a ListFolders call.
Instance Method Summary collapse
-
#file_attributes ⇒ Object
The file attributes array.
-
#folder_attributes ⇒ Object
The folder attributes array.
-
#initialize(xml) ⇒ FSFolderList
constructor
Extracts count and file / folder arrays from the ListFolders response.
-
#page_file_count ⇒ Object
the paging file count.
-
#page_folder_count ⇒ Object
The paging folder count.
-
#total_file_count ⇒ Object
The total file count outside of paging.
-
#total_folder_count ⇒ Object
The total folder count outside of paging.
Constructor Details
#initialize(xml) ⇒ FSFolderList
Extracts count and file / folder arrays from the ListFolders response.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/nvx/sds/APIClasses/fsfolderlist.rb', line 15 def initialize(xml) doc = REXML::Document.new(xml) @total_folder_count = (text = doc.root.elements["//Response/ListFolder/TotalFolderCount"].get_text and text.value) @total_file_count = (text = doc.root.elements["//Response/ListFolder/TotalFileCount"].get_text and text.value) @page_folder_count = (text = doc.root.elements["//Response/ListFolder/PageFolderCount"].get_text and text.value) @page_file_count = (text = doc.root.elements["//Response/ListFolder/PageFileCount"].get_text and text.value) @folder_attributes = Array.new @file_attributes = Array.new if doc.root.elements["//Response/ListFolder/Folder"] doc.root.elements.each("//Response/ListFolder/Folder") do |folder| @folder_attributes << FSFolderAttributes.new(folder.to_s) end end if doc.root.elements["//Response/ListFolder/File"] doc.root.elements.each("//Response/ListFolder/File") do |file| @file_attributes << FSFileAttributes.new(file.to_s) end end end |
Instance Method Details
#file_attributes ⇒ Object
The file attributes array.
65 66 67 |
# File 'lib/nvx/sds/APIClasses/fsfolderlist.rb', line 65 def file_attributes @file_attributes end |
#folder_attributes ⇒ Object
The folder attributes array.
60 61 62 |
# File 'lib/nvx/sds/APIClasses/fsfolderlist.rb', line 60 def folder_attributes @folder_attributes end |
#page_file_count ⇒ Object
the paging file count
55 56 57 |
# File 'lib/nvx/sds/APIClasses/fsfolderlist.rb', line 55 def page_file_count @page_file_count.nil? ? 0 : @page_file_count.to_i end |
#page_folder_count ⇒ Object
The paging folder count
50 51 52 |
# File 'lib/nvx/sds/APIClasses/fsfolderlist.rb', line 50 def page_folder_count @page_folder_count.nil? ? 0 : @page_folder_count.to_i end |
#total_file_count ⇒ Object
The total file count outside of paging.
45 46 47 |
# File 'lib/nvx/sds/APIClasses/fsfolderlist.rb', line 45 def total_file_count @total_file_count.nil? ? 0 : @total_file_count.to_i end |
#total_folder_count ⇒ Object
The total folder count outside of paging.
40 41 42 |
# File 'lib/nvx/sds/APIClasses/fsfolderlist.rb', line 40 def total_folder_count @total_folder_count.nil? ? 0 : @total_folder_count.to_i end |