class Egnyte::Item
Attributes
session[RW]
Public Class Methods
fs_path(session, mode='fs')
click to toggle source
# File lib/egnyte/item.rb, line 25 def self.fs_path(session, mode='fs') "https://#{session.domain}.#{EGNYTE_DOMAIN}/#{session.api}/v1/#{mode}/" end
new(data, session)
click to toggle source
# File lib/egnyte/item.rb, line 6 def initialize(data, session) @data = data @session = session end
Public Instance Methods
copy(destination_path)
click to toggle source
# File lib/egnyte/item.rb, line 38 def copy(destination_path) move_or_copy(destination_path, 'copy') end
fs_path(mode='fs')
click to toggle source
mode can be either fs, or fs-content.
# File lib/egnyte/item.rb, line 21 def fs_path(mode='fs') Egnyte::Item.fs_path(@session, mode) end
method_missing(method, *args, &block)
click to toggle source
# File lib/egnyte/item.rb, line 11 def method_missing(method, *args, &block) @data[method.to_s] end
move(destination_path)
click to toggle source
# File lib/egnyte/item.rb, line 34 def move(destination_path) move_or_copy(destination_path, 'move') end
move_or_copy(destination_path, action)
click to toggle source
# File lib/egnyte/item.rb, line 29 def move_or_copy(destination_path, action) item_path = "#{fs_path}#{Egnyte::Helper.normalize_path(path)}" @session.post(item_path, { action: action, destination: destination_path }.to_json, return_parsed_response=true) end
update_data(data)
click to toggle source
# File lib/egnyte/item.rb, line 15 def update_data(data) @data = @data.update(data) self end