Class: Fog::Storage::Artifactory::Files

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

Instance Method Summary collapse

Instance Method Details

#all(options = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/fog/artifactory/models/storage/files.rb', line 12

def all(options = {})
  requires :directory
  options = options.reject { |_key, value| value.nil? || value.to_s.empty? }
  merge_attributes(options)
  load(service.client.get('/api/search/artifact', name: '.*', repos: directory.key)['results'].map do |artifact|
    path = URI.parse(artifact['uri']).path
    endpoint_path = URI.parse(service.client.endpoint).path
    path.slice!(endpoint_path)
    service.client.get(path)
  end)
end

#get(key, _options = {}, &_block) ⇒ Object



24
25
26
27
# File 'lib/fog/artifactory/models/storage/files.rb', line 24

def get(key, _options = {}, &_block)
  requires :directory
  new(service.client.get("/api/storage/#{directory.key}#{key}"))
end

#head(key, options = {}) ⇒ Object



29
30
31
# File 'lib/fog/artifactory/models/storage/files.rb', line 29

def head(key, options = {})
  # TODO: implement
end

#new(attributes = {}) ⇒ Object



33
34
35
36
# File 'lib/fog/artifactory/models/storage/files.rb', line 33

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