Class: NVX::SDS::SearchItem
- Inherits:
-
Object
- Object
- NVX::SDS::SearchItem
- Defined in:
- lib/nvx/sds/searchitem.rb
Overview
Overview
The SearchItem object is used for all search results. The object is returned from calls to either
session.SearchFileSystem
session.SearchMetadata
session.SearchTags
Usage
session = Session.new("APP-KEY", "USERNAME", "APP NAME", "PASSWORD")
search_results_array = session.SearchFileSystem("Beatles*", "Image")
search_results_array.each do |search_item|
print search_item.name
end
Instance Method Summary collapse
-
#created_date ⇒ Object
Date created or uploaded.
-
#file_type ⇒ Object
The file type.
-
#initialize(xml) ⇒ SearchItem
constructor
Takes a single search item in an xml string fragment and populates the object with the values.
-
#is_file ⇒ Object
If the result is a file or a folder.
-
#name ⇒ Object
The file / folder name.
-
#path ⇒ Object
The full path.
-
#size_bytes ⇒ Object
The size.
Constructor Details
#initialize(xml) ⇒ SearchItem
Takes a single search item in an xml string fragment and populates the object with the values.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/nvx/sds/searchitem.rb', line 37 def initialize(xml) doc = REXML::Document.new(xml) @name = (text = doc.root.elements["//Item/ItemName"].get_text and text.value) @path = (text = doc.root.elements["//Item/ItemPath"].get_text and text.value) @created_date = (text = doc.root.elements["//Item/CreatedDate"].get_text and text.value) @size_bytes = (text = doc.root.elements["//Item/SizeBytes"].get_text and text.value) @file_type = (text = doc.root.elements["//Item/FileType"].get_text and text.value) @is_file = (text = doc.root.elements["//Item/IsFile"].get_text and text.value) == "true" end |
Instance Method Details
#created_date ⇒ Object
Date created or uploaded.
59 60 61 |
# File 'lib/nvx/sds/searchitem.rb', line 59 def created_date @created_date end |
#file_type ⇒ Object
The file type
69 70 71 |
# File 'lib/nvx/sds/searchitem.rb', line 69 def file_type @file_type end |
#is_file ⇒ Object
If the result is a file or a folder.
74 75 76 |
# File 'lib/nvx/sds/searchitem.rb', line 74 def is_file @is_file end |
#name ⇒ Object
The file / folder name.
49 50 51 |
# File 'lib/nvx/sds/searchitem.rb', line 49 def name @name end |
#path ⇒ Object
The full path.
54 55 56 |
# File 'lib/nvx/sds/searchitem.rb', line 54 def path @path end |
#size_bytes ⇒ Object
The size
64 65 66 |
# File 'lib/nvx/sds/searchitem.rb', line 64 def size_bytes @size_bytes end |