lib/aptly_snapshot.rb in aptly_cli-0.4.2 vs lib/aptly_snapshot.rb in aptly_cli-0.5.0
- old
+ new
@@ -1,15 +1,15 @@
require 'aptly_cli/version'
require 'aptly_command'
require 'aptly_load'
-require 'httmultiparty'
+require 'httparty'
require 'json'
module AptlyCli
# Aptly class to work with Snapshot API
class AptlySnapshot < AptlyCommand
- include HTTMultiParty
+ include HTTParty
def snapshot_delete(name, force=nil)
uri = "/snapshots/#{name}"
uri += '?force=1' if force == true
self.class.delete(uri)
@@ -23,25 +23,25 @@
def snapshot_create(name, repo, description=nil)
# Build uri to create snapshot, requires name of snap and name of repo
uri = "/repos/#{repo}/" + 'snapshots'
- self.class.post(uri, query:
+ self.class.post(uri, :body =>
{ 'Name' => name,
'Description' => description }.to_json,
- headers: { 'Content-Type' => 'application/json' })
+ :headers => { 'Content-Type' => 'application/json' })
end
def snapshot_create_ref(name, description=nil,
sourcesnapshots=[], packagerefs=[])
uri = '/snapshots'
begin
self.class.post(uri,
- query: { 'Name' => name, 'Description' => description,
+ :body => { 'Name' => name, 'Description' => description,
'SourceSnapshots' => sourcesnapshots,
'PackageRefs' => packagerefs }.to_json,
- headers: { 'Content-Type' => 'application/json' })
+ :headers => { 'Content-Type' => 'application/json' })
rescue HTTParty::Error => e
return e
end
end
@@ -81,10 +81,10 @@
@query = {}
@query[:Name] = snap_name
@query[:Description] = description unless description.nil?
@query_json = @query.to_json
begin
- self.class.put(uri, query: @query_json, headers:
+ self.class.put(uri, :body => @query_json, :headers =>
{ 'Content-Type' => 'application/json' })
rescue HTTParty::Error => e
puts e
end
end