packagecloud-ruby 0.2.19 → 0.2.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/packagecloud/client.rb +25 -1
- data/lib/packagecloud/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d6df1597844084334f7991d65799802672be0e8
|
4
|
+
data.tar.gz: e7803cbe3239ab5633f2825b5adbd511c16013d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adcd8e0065313f4f56b261245112fd2feb5a7f5fbd206374517f74a32708afda899b6a77bea18883924dda20a051b91412192c487b9ff17d0b072007288daec9
|
7
|
+
data.tar.gz: b0e7b9d97351739c69f028aa41f9f6094fdaf8b43445c40f7e2602031a371a11018e8bcadfb5891aa982bde837736becf7246c5918bf098b46be95ead81e9603
|
data/README.md
CHANGED
@@ -111,7 +111,7 @@ go to your [Account Settings](https://packagecloud.io/api_token) to see your API
|
|
111
111
|
distro_id = @client.find_distribution_id("ubuntu/trusty")
|
112
112
|
source_files = { "jake_1.0.orig.tar.bz2" => open("/path/jake_1.0.orig.tar.bz2"),
|
113
113
|
"jake_1.0-7.debian.tar.gz" => open("/path/jake_1.0-7.debian.tar.gz") }
|
114
|
-
dsc_package = Packagecloud::Package.new("jake_1.0-7.dsc", distro_id, source_files)
|
114
|
+
dsc_package = Packagecloud::Package.new(open("jake_1.0-7.dsc"), distro_id, source_files)
|
115
115
|
|
116
116
|
# Upload Packages
|
117
117
|
@client.put_package("test_repo", gem_package)
|
data/lib/packagecloud/client.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'json/pure'
|
1
|
+
require 'json/pure' unless JSON::Ext
|
2
2
|
require 'mime'
|
3
3
|
require 'excon'
|
4
4
|
require 'packagecloud/result'
|
@@ -103,6 +103,19 @@ module Packagecloud
|
|
103
103
|
parsed_json_result(response)
|
104
104
|
end
|
105
105
|
|
106
|
+
def list_packages(repo)
|
107
|
+
assert_valid_repo_name(repo)
|
108
|
+
response = get("/api/v1/repos/#{username}/#{repo}/packages.json")
|
109
|
+
parsed_json_result(response)
|
110
|
+
end
|
111
|
+
|
112
|
+
def delete_package(repo, distro, distro_release, package_filename)
|
113
|
+
assert_valid_repo_name(repo)
|
114
|
+
url = "/api/v1/repos/#{username}/#{repo}/#{distro}/#{distro_release}/#{package_filename}"
|
115
|
+
response = delete(url)
|
116
|
+
parsed_json_result(response)
|
117
|
+
end
|
118
|
+
|
106
119
|
def put_package(repo, package)
|
107
120
|
assert_valid_repo_name(repo)
|
108
121
|
|
@@ -147,6 +160,13 @@ module Packagecloud
|
|
147
160
|
end
|
148
161
|
end
|
149
162
|
|
163
|
+
def create_read_tokens(repo, master_token_id, read_token_name)
|
164
|
+
assert_valid_repo_name(repo)
|
165
|
+
url = "/api/v1/repos/#{username}/#{repo}/master_tokens/#{master_token_id}/read_tokens.json"
|
166
|
+
response = post(url, "read_token[name]=#{read_token_name}", "application/x-www-form-urlencoded")
|
167
|
+
parsed_json_result(response)
|
168
|
+
end
|
169
|
+
|
150
170
|
private
|
151
171
|
def assert_valid_repo_name(repo)
|
152
172
|
if repo.include?("/")
|
@@ -212,6 +232,10 @@ module Packagecloud
|
|
212
232
|
request(url, :get)
|
213
233
|
end
|
214
234
|
|
235
|
+
def delete(url)
|
236
|
+
request(url, 'DELETE')
|
237
|
+
end
|
238
|
+
|
215
239
|
def username
|
216
240
|
self.credentials.username
|
217
241
|
end
|
data/lib/packagecloud/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: packagecloud-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Damato
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|