gitlab 4.13.1 → 4.14.0

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
  SHA256:
3
- metadata.gz: b2504adea709074810ff6508709ad14415fe1084dee353f3bd2ca53757220ba8
4
- data.tar.gz: 2783c2afff1b5aa5898d1be19e29124ea1cddcf79fedbaae003c9066cb97116e
3
+ metadata.gz: c77e29621138a7c5468d44f3753d6bb7e6ead353b384d2e10ed7230999323651
4
+ data.tar.gz: 44831812bcb2d53fb7adad0762a7822ba00f0a0dc064afa0ae7a3cc53d9b3eb4
5
5
  SHA512:
6
- metadata.gz: 415a2de181363d3a0612c78a94dfa7c13f3c812f6a1a214ab910cfc92927ba414eabeba07b52bb7469c67cd91f03bc42422a676c7026bbfd414c250377d04ce0
7
- data.tar.gz: abe3f75d8d8bd649a10004de7ba09179b0e135c4b604bf32c237d53a60516566778e95e4ee7f2368f5fe8bbf077df15cc93426b7a77582985fa243d039dd1d1a
6
+ metadata.gz: bfb8f5b817ce9e73c35de24e28a9d5f98fdcdf2a1071f06cefaa238aec71f7e33eff9b5611f1d7cb0eac33a70baa87410a37536c1015a1d4663392dafb1fcca2
7
+ data.tar.gz: 937c02a461ec9c6b472542ce4576296afe660c3797533fd6ad0d3dc93b5f78b44809bbdc2acfe1ba800125cb8e26d063a56bceca3b4f62d4bd2bacb95be09fcb
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012-2019 Nihad Abbasov <nihad@42na.in>
1
+ Copyright (c) 2012-2020 Nihad Abbasov <nihad@42na.in>
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without
@@ -73,8 +73,12 @@ module Gitlab
73
73
  inspected
74
74
  end
75
75
 
76
+ # Utility method for URL encoding of a string.
77
+ # Copied from https://ruby-doc.org/stdlib-2.7.0/libdoc/erb/rdoc/ERB/Util.html
78
+ #
79
+ # @return [String]
76
80
  def url_encode(url)
77
- URI.encode(url.to_s, /\W/)
81
+ url.to_s.b.gsub(/[^a-zA-Z0-9_\-.~]/n) { |m| sprintf('%%%02X', m.unpack1('C')) } # rubocop:disable Style/FormatString, Style/FormatStringToken
78
82
  end
79
83
 
80
84
  private
@@ -181,7 +181,7 @@ class Gitlab::Client
181
181
  # @param [Integer] id The ID of an issue.
182
182
  # @param [String] duration The time spent in human format. e.g: 3h30m
183
183
  def add_time_spent_on_issue(project, id, duration)
184
- post("/projects/#{url_encode project}/issues/#{id}/add_spent_time", body: { duration: url_encode(duration) })
184
+ post("/projects/#{url_encode project}/issues/#{id}/add_spent_time", body: { duration: duration })
185
185
  end
186
186
 
187
187
  # Resets the total spent time for this issue to 0 seconds.
@@ -163,5 +163,19 @@ class Gitlab::Client
163
163
  def job_artifacts_keep(project_id, job_id)
164
164
  post("/projects/#{url_encode project_id}/jobs/#{job_id}/artifacts/keep")
165
165
  end
166
+
167
+ # Delete Artifacts
168
+ # Deletes the artifacts associated with a job.
169
+ #
170
+ # @example
171
+ # Gitlab.job_artifacts_delete(1,1)
172
+ # Gitlab.job_artifacts_delete("project", 1)
173
+ #
174
+ # @param [Integer, String] The ID or name of a project.
175
+ # @param [Integer] the id of the job
176
+ # @return [Array<Gitlab::ObjectifiedHash>]
177
+ def job_artifacts_delete(project_id, job_id)
178
+ delete("/projects/#{url_encode project_id}/jobs/#{job_id}/artifacts")
179
+ end
166
180
  end
167
181
  end
@@ -380,6 +380,20 @@ class Gitlab::Client
380
380
  post("/projects/#{url_encode project}/deploy_keys/#{key}/disable", body: { id: project, key_id: key })
381
381
  end
382
382
 
383
+ # Updates an existing deploy key.
384
+ #
385
+ # @example
386
+ # Gitlab.edit_deploy_key(42, 66, 'New key name', can_push: false)
387
+ #
388
+ # @param [Integer, String] project The ID or path of a project.
389
+ # @param [Integer] id The ID of a deploy key.
390
+ # @param [String] title The title of a deploy key.
391
+ # @param [Hash] options A customizable set of options.
392
+ # @return [Gitlab::ObjectifiedHash] Information about created deploy key.
393
+ def edit_deploy_key(project, id, title, options = {})
394
+ put("/projects/#{url_encode project}/deploy_keys/#{id}", body: { title: title }.merge(options))
395
+ end
396
+
383
397
  # Deletes a deploy key from project.
384
398
  #
385
399
  # @example
@@ -72,5 +72,21 @@ class Gitlab::Client
72
72
  def merge_base(project, refs)
73
73
  get("/projects/#{url_encode project}/repository/merge_base", query: { refs: refs })
74
74
  end
75
+
76
+ # Get project repository contributors.
77
+ #
78
+ # @example
79
+ # Gitlab.contributors(42)
80
+ # Gitlab.contributors(42, { order: 'name' })
81
+ #
82
+ # @param [Integer, String] project The ID or name of a project.
83
+ # @param [Hash] options A customizable set of options.
84
+ # @option options [String] :order_by Order by name, email or commits (default = commits).
85
+ # @option options [String] :sort Sort order asc or desc (default = asc).
86
+ # @return [Array<Gitlab::ObjectifiedHash>]
87
+ def contributors(project, options = {})
88
+ get("/projects/#{url_encode project}/repository/contributors", query: options)
89
+ end
90
+ alias repo_contributors contributors
75
91
  end
76
92
  end
@@ -41,14 +41,16 @@ module Gitlab
41
41
 
42
42
  %w[get post put delete].each do |method|
43
43
  define_method method do |path, options = {}|
44
- httparty_config(options)
44
+ params = options.dup
45
45
 
46
- unless options[:unauthenticated]
47
- options[:headers] ||= {}
48
- options[:headers].merge!(authorization_header)
46
+ httparty_config(params)
47
+
48
+ unless params[:unauthenticated]
49
+ params[:headers] ||= {}
50
+ params[:headers].merge!(authorization_header)
49
51
  end
50
52
 
51
- validate self.class.send(method, @endpoint + path, options)
53
+ validate self.class.send(method, @endpoint + path, params)
52
54
  end
53
55
  end
54
56
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gitlab
4
- VERSION = '4.13.1'
4
+ VERSION = '4.14.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.13.1
4
+ version: 4.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nihad Abbasov
@@ -9,28 +9,28 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2019-12-19 00:00:00.000000000 Z
12
+ date: 2020-03-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ">="
19
- - !ruby/object:Gem::Version
20
- version: 0.14.0
21
18
  - - "~>"
22
19
  - !ruby/object:Gem::Version
23
20
  version: '0.14'
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.14.0
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
27
27
  requirements:
28
- - - ">="
29
- - !ruby/object:Gem::Version
30
- version: 0.14.0
31
28
  - - "~>"
32
29
  - !ruby/object:Gem::Version
33
30
  version: '0.14'
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.14.0
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: terminal-table
36
36
  requirement: !ruby/object:Gem::Requirement
@@ -226,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
226
  - !ruby/object:Gem::Version
227
227
  version: '0'
228
228
  requirements: []
229
- rubygems_version: 3.0.6
229
+ rubygems_version: 3.1.2
230
230
  signing_key:
231
231
  specification_version: 4
232
232
  summary: A Ruby wrapper and CLI for the GitLab API