aptlyapi 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/server.rb +5 -5
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8e9dfdf35c1246cce5955ce78be6b6f5af50770e
4
- data.tar.gz: eb22ff8638880e4cd2bad325c94ce622c4eb5b64
3
+ metadata.gz: 93d7b13fdda599c52c66db1d7ea397e9d461ecd6
4
+ data.tar.gz: 4394ae85f2c9ed587126565593fc52dcae2e1064
5
5
  SHA512:
6
- metadata.gz: b7a17b0b046053c57cff2845da0dbd9cacf19ec3924b66d65a57ff2c5d539039cb63745c8ed642c30940a0f74a1e4e54d5502834ee979c2e3bc4bed43cb56266
7
- data.tar.gz: fdb4e151a3112fd5fd84422f2623106374666a645b84d21a1f8e12234aef68a56ebd0ea09951d3efffe34bb9f1d91cc37992a48dba8c400c985d29ca93778678
6
+ metadata.gz: 063a551bc31a73dd0b09b025e5cfaa910479331c755b44e8c9b1df2619b72dc503f46d7086c88201c0ddb4bfee74f424b6e27cf4d0bd8bf47eb825d1fb995df5
7
+ data.tar.gz: b05100cf0da1fe547eb8e85748a584382181b4b85c12820cc40c859fc8da082ab86f843c0e7cdbca4575cd07a74d6f8982e8d535b04b1622dd50d55613afaeb1
data/lib/server.rb CHANGED
@@ -100,14 +100,14 @@ module AptlyAPI
100
100
  # Publish a repo from +sources+ (hash of "Component/Name")
101
101
  #
102
102
  # TODO: There are bare minimum for the moment and will change
103
- def publish(kind, sources, distribution, keyid, password)
103
+ def publish(kind, prefix, sources, distribution, keyid, password)
104
104
  body = Hash.new
105
105
  body.merge!({"SourceKind" => kind})
106
106
  body.merge!({"Sources" => sources})
107
107
  body.merge!({"Distribution" => distribution})
108
108
  body.merge!({"ForceOverwrite" => true})
109
109
  body.merge!({"Signing" => { "Batch" => true, "GpgKey" => keyid, "Passphrase" => password}})
110
- return true if hpost('/api/publish', body) == 200
110
+ return true if hpost("/api/publish/#{prefix.to_s}", body).between?(200, 299)
111
111
  return false
112
112
  end
113
113
 
@@ -115,11 +115,11 @@ module AptlyAPI
115
115
  # Update a published repo
116
116
  #
117
117
  # TODO: There are bare minimum for the moment and will change
118
- def publish_update(distribution, keyid, password)
118
+ def publish_update(prefix, distribution, keyid, password)
119
119
  body = Hash.new
120
120
  body.merge!({"ForceOverwrite" => true})
121
121
  body.merge!({"Signing" => { "Batch" => true, "GpgKey" => keyid, "Passphrase" => password}})
122
- return true if hput("/api/publish//#{distribution}", body) == 200
122
+ return true if hput("/api/publish/#{prefix.to_s}/#{distribution.to_s}", body).between?(200, 299)
123
123
  return false
124
124
  end
125
125
 
@@ -137,7 +137,7 @@ module AptlyAPI
137
137
  def hget(path)
138
138
  request = Net::HTTP::Get.new("#{@server.path}#{path}")
139
139
  response = @http.request(request)
140
- if response.code.to_i != 200
140
+ if !response.code.to_i.between?(200, 299)
141
141
  return response.code.to_i
142
142
  end
143
143
  return JSON.parse(response.body)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aptlyapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander von Gluck IV