lib/fog/artifactory/models/storage/file.rb in fog-artifactory-0.1.0 vs lib/fog/artifactory/models/storage/file.rb in fog-artifactory-0.2.0
- old
+ new
@@ -35,17 +35,15 @@
def destroy
requires :directory, :key
service.client.delete(attributes[:download_uri])
true
- rescue Error::HTTPError
- false
end
def save(_options = {})
requires :body, :directory, :key
- endpoint = ::File.join(attributes[:repo], attributes[:key])
+ endpoint = ::File.join(attributes[:directory].key, attributes[:key])
service.client.put(endpoint, attributes[:body])
true
end
@@ -53,11 +51,17 @@
requires :directory, :key
self.download_uri
end
alias_method :url, :public_url
- # def url
- # # TODO: implement
+ def download_uri
+ return attributes[:download_uri] if attributes[:download_uri].present?
+ requires :directory, :key
+ ::File.join(service.client.endpoint, attributes[:directory].key, attributes[:key])
+ end
+
+ # puts attributes[:directory].key
+ # URI.join(service.client.endpoint, attributes[:directory].key, attributes[:key]).to_s
# end
end
end
end
end