class Netdocuments::Cabinet
Attributes
id[R]
Public Class Methods
new(opts = {})
click to toggle source
# File lib/netdocuments/cabinet.rb, line 6 def initialize(opts = {}) validate_config! @id = opts[:id] if opts[:id] end
Public Instance Methods
find_folder_tree_and_update_file_path()
click to toggle source
# File lib/netdocuments/cabinet.rb, line 12 def find_folder_tree_and_update_file_path Netdocuments.logger.info "Starting: find_folder_tree_and_update_file_path" subfolders_count = 0 Parallel.map(folders,in_threads: 50) do |folder| subfolders = folder.subfolders Netdocuments.logger.info "Collected: #{subfolders.count} subfolders in #{folder.name}" subfolders_count += subfolders.count Parallel.map(subfolders,in_threads: 75){|node| node.update } end subfolders_count end
folder_tree()
click to toggle source
# File lib/netdocuments/cabinet.rb, line 24 def folder_tree folders.collect {|folder| folder.subfolders} end
folders()
click to toggle source
# File lib/netdocuments/cabinet.rb, line 28 def folders Netdocuments.logger.info "Fetching folders..." response = get(url: "/v1/Cabinet/#{@id}/folders", query: {'$select' => "standardAttributes"}, headers: headers) response["ndList"]["standardList"]["ndProfile.DocumentStat"].collect {|i| Netdocuments::Folder.new(id: i['id'],name: i['name'])} end
headers()
click to toggle source
# File lib/netdocuments/cabinet.rb, line 41 def headers {'Authorization' => "Bearer #{client.access_token.token}"} end
info()
click to toggle source
# File lib/netdocuments/cabinet.rb, line 37 def info get(url: "/v1/Cabinet/#{@id}/info",headers: headers) end