Class: Fog::Storage::External::Files

Inherits:
Collection
  • Object
show all
Defined in:
lib/fog/external/models/storage/files.rb

Instance Method Summary collapse

Instance Method Details

#allObject



12
13
14
15
16
# File 'lib/fog/external/models/storage/files.rb', line 12

def all
  requires :directory
  
  load(connection.remote.list_files(directory.key))
end

#get(id) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/fog/external/models/storage/files.rb', line 18

def get(id)
  requires :directory
  
  data = connection.remote.get_file(file_key(id))
  if data
    new(data)
  else
    nil
  end
end

#head(id) ⇒ Object

hackish!



29
30
31
32
33
34
35
36
37
38
# File 'lib/fog/external/models/storage/files.rb', line 29

def head(id) # hackish!
  requires :directory
  
  data = connection.remote.head_file(file_key(id))
  if data
    new(data)
  else
    nil
  end
end

#new(attributes = {}) ⇒ Object



40
41
42
43
# File 'lib/fog/external/models/storage/files.rb', line 40

def new(attributes = {})
  requires :directory
  super({ :directory => directory }.merge!(attributes))
end