Class: Sumologic::Metadata::Folder
- Inherits:
-
Object
- Object
- Sumologic::Metadata::Folder
- Includes:
- Loggable
- Defined in:
- lib/sumologic/metadata/folder.rb
Overview
Handles folder/content library operations Folders organize dashboards, searches, and other content NOTE: Content API uses v2, not v1
Instance Method Summary collapse
-
#get(folder_id) ⇒ Hash
Get a specific folder by ID Returns folder details with children.
-
#initialize(http_client:) ⇒ Folder
constructor
A new instance of Folder.
-
#personal ⇒ Hash
Get the personal folder for the current user Returns folder with children.
-
#tree(folder_id: nil, max_depth: 3) ⇒ Hash
List all items in a folder (recursive tree) Builds a tree structure of all content.
Constructor Details
#initialize(http_client:) ⇒ Folder
Returns a new instance of Folder.
15 16 17 |
# File 'lib/sumologic/metadata/folder.rb', line 15 def initialize(http_client:) @http = http_client end |
Instance Method Details
#get(folder_id) ⇒ Hash
Get a specific folder by ID Returns folder details with children
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/sumologic/metadata/folder.rb', line 40 def get(folder_id) data = @http.request( method: :get, path: "/content/folders/#{folder_id}" ) log_info "Retrieved folder: #{data['name']} (#{folder_id})" data rescue StandardError => e raise Error, "Failed to get folder #{folder_id}: #{e.}" end |
#personal ⇒ Hash
Get the personal folder for the current user Returns folder with children
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/sumologic/metadata/folder.rb', line 23 def personal data = @http.request( method: :get, path: '/content/folders/personal' ) log_info "Retrieved personal folder: #{data['name']}" data rescue StandardError => e raise Error, "Failed to get personal folder: #{e.}" end |
#tree(folder_id: nil, max_depth: 3) ⇒ Hash
List all items in a folder (recursive tree) Builds a tree structure of all content
58 59 60 61 62 63 |
# File 'lib/sumologic/metadata/folder.rb', line 58 def tree(folder_id: nil, max_depth: 3) root = folder_id ? get(folder_id) : personal build_tree(root, 0, max_depth) rescue StandardError => e raise Error, "Failed to build folder tree: #{e.}" end |