Module: Cloudpt::API::Fileops

Included in:
Dir, File
Defined in:
lib/cloudpt-api/objects/fileops.rb

Instance Method Summary collapse

Instance Method Details

#copy(to, options = {}) ⇒ Object



6
7
8
9
# File 'lib/cloudpt-api/objects/fileops.rb', line 6

def copy(to, options = {})
  response = client.raw.copy({ :from_path => "/#{self.path}", :to_path => "/#{Cloudpt::API::Util.strip_slash(to)}" }.merge(options))
  self.update response
end

#destroy(options = {}) ⇒ Object



16
17
18
19
# File 'lib/cloudpt-api/objects/fileops.rb', line 16

def destroy(options = {})
  response = client.raw.delete({ :path => "/#{self.path}" }.merge(options))
  self.update response
end

#move(to, options = {}) ⇒ Object



11
12
13
14
# File 'lib/cloudpt-api/objects/fileops.rb', line 11

def move(to, options = {})
  response = client.raw.move({ :from_path => "/#{self.path}", :to_path => "/#{Cloudpt::API::Util.strip_slash(to)}" }.merge(options))
  self.update response
end

#pathObject



21
22
23
# File 'lib/cloudpt-api/objects/fileops.rb', line 21

def path
  Cloudpt::API::Util.strip_slash(self['path'])
end