lib/aptly_snapshot.rb in aptly_cli-0.2.9 vs lib/aptly_snapshot.rb in aptly_cli-0.3.0
- old
+ new
@@ -1,25 +1,14 @@
require 'aptly_cli/version'
+require 'aptly_command'
require 'aptly_load'
require 'httmultiparty'
require 'json'
module AptlyCli
- # Aplty class to work with Snapshot API
- class AptlySnapshot
+ # Aptly class to work with Snapshot API
+ class AptlySnapshot < AptlyCommand
include HTTMultiParty
-
- # Load aptly-cli.conf and establish base_uri
- @config = AptlyCli::AptlyLoad.new.configure_with('/etc/aptly-cli.conf')
- base_uri "#{@config[:proto]}://#{@config[:server]}:#{@config[:port]}/api"
-
- if @config[:username]
- if @config[:password]
- basic_auth @config[:username].to_s, @config[:password].to_s
- end
- end
-
- debug_output $stdout if @config[:debug] == true
def snapshot_delete(name, force=nil)
uri = "/snapshots/#{name}"
uri += '?force=1' if force == true
self.class.delete(uri)