artifactory-ruby 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e7fb4a1236baecc54d9ab25da7b99660644dd021
4
- data.tar.gz: 3e334fcd05595c34cb74568107545f5aa103923f
3
+ metadata.gz: 3382f6c152f0409dc4d73404f92fa97fbf18ca5d
4
+ data.tar.gz: 0255ee37ab9d9d5acd917c53e0ae16b1957af7d0
5
5
  SHA512:
6
- metadata.gz: 2612da8023f66c6fba9efc1a85d322756bf378420a0bee1bcdd8efca5ddd969f9f58256c1c8a5e70389f2d8f061fa57f2d140c44b19a3bbb73a90a767f77c5b5
7
- data.tar.gz: d47ed4e9cd064ca90f1061a010165a1085b15f8b37e1bc9bedf67a45353e00fde235ef99f99828d8398fb47ff9eab1ecde0056555b2c698d6ab447b29544a325
6
+ metadata.gz: e5de3ff8707ce655fa809074259c316b5f8e5069d64cb8740c1536e40579630a548d29ddce83c5423c0e5c06913fe38b173f46953d722f91a6dbdeb88afe9add
7
+ data.tar.gz: 21464871d23c541fcdb4db6c39d53d85f36464b4af746fd4d4d1fe14211e6891e38153aafdc34c733194c49004596551ebda32628e698cc1f189608d07792ca9
@@ -210,7 +210,7 @@ module Artifactory
210
210
  # @return [Hash] Artifacts matching search criteria
211
211
  #
212
212
  def search_usage(repo_key:, not_used_since:, created_before: nil)
213
- ret = {}
213
+ ret = []
214
214
 
215
215
  path = File.join("/search", "usage")
216
216
  params = []
@@ -219,18 +219,25 @@ module Artifactory
219
219
  params << "repos=#{repo_key.is_a?(Array) ? repo_key.join(',') : repo_key}"
220
220
 
221
221
  api_get([path, params.join('&')].join('?'))['results'].each do |result|
222
+ path = result['uri'].scan(/\/storage\/(.+?)(\/.*)/).flatten
223
+
224
+ file = {
225
+ "path" => path.join,
226
+ "repo_key" => path[0],
227
+ "name" => path[1]
228
+ }
229
+
222
230
  result.each do |k, v|
223
231
  case k
224
232
  when "lastDownloaded", "remoteLastDownloaded"
225
- ret[result['uri']] = Time.parse(v)
226
-
227
- when "uri"
228
- next
233
+ file[k] = Time.parse(v)
229
234
 
230
235
  else
231
- ret[result['uri']] = v
236
+ file[k] = v
232
237
  end
233
238
  end
239
+
240
+ ret << file
234
241
  end
235
242
 
236
243
  ret
@@ -241,11 +248,11 @@ module Artifactory
241
248
  # @param repo_key [String, Array<String>] Repository key(s)
242
249
  # @param from_date [Time] Return artifacts that have not been used since the given date
243
250
  # @param to_date [Time] Return artifacts that have been created before the given date
244
- # @param fields [created, lastModified, lastDownloaded] Date fields that specify which fields the from_date and to_date values should be applied to
251
+ # @param date_fields [created, lastModified, lastDownloaded] Date fields that specify which fields the from_date and to_date values should be applied to
245
252
  # @return [Hash] Artifacts matching search criteria
246
253
  #
247
254
  def search_dates(repo_key:, from_date: nil, to_date: Time.now, date_fields:)
248
- ret = {}
255
+ ret = []
249
256
 
250
257
  valid_date_fields = ["created", "lastModified", "lastDownloaded"]
251
258
 
@@ -260,20 +267,26 @@ module Artifactory
260
267
  params << "repos=#{repo_key.is_a?(Array) ? repo_key.join(',') : repo_key}"
261
268
  params << "dateFields=#{date_fields.join(',')}"
262
269
 
263
- puts([path, params.join('&')].join('?'))
264
270
  api_get([path, params.join('&')].join('?'))['results'].each do |result|
271
+ path = result['uri'].scan(/\/storage\/(.+?)(\/.*)/).flatten
272
+
273
+ file = {
274
+ "path" => path.join,
275
+ "repo_key" => path[0],
276
+ "name" => path[1]
277
+ }
278
+
265
279
  result.each do |k, v|
266
280
  case k
267
281
  when *valid_date_fields
268
- ret[result['uri']] = Time.parse(v)
269
-
270
- when "uri"
271
- next
282
+ file[k] = Time.parse(v)
272
283
 
273
284
  else
274
- ret[result['uri']] = v
285
+ file[k] = v
275
286
  end
276
287
  end
288
+
289
+ ret << file
277
290
  end
278
291
 
279
292
  ret
@@ -287,7 +300,7 @@ module Artifactory
287
300
  # @return [Hash] Artifacts matching search criteria
288
301
  #
289
302
  def search_creation(repo_key:, from_date: nil, to_date: Time.now)
290
- ret = {}
303
+ ret = []
291
304
 
292
305
  path = File.join("/search", "creation")
293
306
  params = []
@@ -296,18 +309,25 @@ module Artifactory
296
309
  params << "repos=#{repo_key.is_a?(Array) ? repo_key.join(',') : repo_key}"
297
310
 
298
311
  api_get([path, params.join('&')].join('?'))['results'].each do |result|
312
+ path = result['uri'].scan(/\/storage\/(.+?)(\/.*)/).flatten
313
+
314
+ file = {
315
+ "path" => path.join,
316
+ "repo_key" => path[0],
317
+ "name" => path[1]
318
+ }
319
+
299
320
  result.each do |k, v|
300
321
  case k
301
322
  when "created"
302
- ret[result['uri']] = Time.parse(v)
303
-
304
- when "uri"
305
- next
323
+ file[k] = Time.parse(v)
306
324
 
307
325
  else
308
- ret[result['uri']] = v
326
+ file[k] = v
309
327
  end
310
328
  end
329
+
330
+ ret << file
311
331
  end
312
332
 
313
333
  ret
@@ -3,7 +3,7 @@
3
3
  #
4
4
 
5
5
  module Artifactory
6
- VERSION = "0.0.3"
6
+ VERSION = "0.0.4"
7
7
 
8
8
  def self.version
9
9
  VERSION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: artifactory-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matteo Cerutti