fs-gitlab 4.18.1 → 4.19.1
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/gitlab/client/merge_requests.rb +12 -0
- data/lib/gitlab/client/pipelines.rb +12 -0
- data/lib/gitlab/client/repositories.rb +17 -0
- data/lib/gitlab/client/users.rb +33 -0
- data/lib/gitlab/client.rb +1 -0
- data/lib/gitlab/headers/page_links.rb +37 -0
- data/lib/gitlab/headers/total.rb +29 -0
- data/lib/gitlab/paginated_response.rb +6 -1
- data/lib/gitlab/request.rb +1 -1
- data/lib/gitlab/version.rb +1 -1
- data/lib/gitlab.rb +5 -2
- metadata +5 -4
- data/lib/gitlab/page_links.rb +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e4984e7691363572b1a54014c75add8440ab4c240e730d387d22bdc93e86b71
|
4
|
+
data.tar.gz: f8a78ba35922b97efd3b329b8a92b8357c473cce70da430aca68782e2a002325
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58860a5afdb7c24d9897fc0f932e7ab430d1e6e6c8fd072c384b28ebe421f75bbafb5e71c42f9d50982ca690596ed5e71dfd32621d188ca69f6075aa46309132
|
7
|
+
data.tar.gz: 2c9ca3f8ac27a033992fe13be4a9c9fce3e8bc546a2d451b25149e95bf5d9c14d7d06d12658df0b4181d7ffa466cac4ec9894a627433623360e6372141f63d15
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Gitlab
|
2
2
|
|
3
|
-
[![Build Status](https://img.shields.io/github/workflow/status/NARKOZ/gitlab/
|
3
|
+
[![Build Status](https://img.shields.io/github/actions/workflow/status/NARKOZ/gitlab/ci.yml?branch=master)](https://github.com/NARKOZ/gitlab/actions/workflows/ci.yml)
|
4
4
|
[![Gem version](https://img.shields.io/gem/v/gitlab.svg)](https://rubygems.org/gems/gitlab)
|
5
5
|
[![License](https://img.shields.io/badge/license-BSD-red.svg)](https://github.com/NARKOZ/gitlab/blob/master/LICENSE.txt)
|
6
6
|
|
@@ -344,6 +344,18 @@ class Gitlab::Client
|
|
344
344
|
delete("/projects/#{url_encode project}/merge_requests/#{merge_request_id}")
|
345
345
|
end
|
346
346
|
|
347
|
+
# Gets a list of merge request diffs
|
348
|
+
#
|
349
|
+
# @example
|
350
|
+
# Gitlab.merge_request_diffs(5, 1)
|
351
|
+
# Gitlab.merge_request_diffs('gitlab', 1)
|
352
|
+
# @param [Integer, String] project The ID or name of a project.
|
353
|
+
# @param [Integer] id The ID of a merge request.
|
354
|
+
# @return [Gitlab::ObjectifiedHash] A list of the merge request diffs.
|
355
|
+
def merge_request_diffs(project, merge_request_id)
|
356
|
+
get("/projects/#{url_encode project}/merge_requests/#{merge_request_id}/diffs")
|
357
|
+
end
|
358
|
+
|
347
359
|
# Gets a list of merge request diff versions
|
348
360
|
#
|
349
361
|
# @example
|
@@ -101,5 +101,17 @@ class Gitlab::Client
|
|
101
101
|
def delete_pipeline(project, id)
|
102
102
|
delete("/projects/#{url_encode project}/pipelines/#{id}")
|
103
103
|
end
|
104
|
+
|
105
|
+
# Gets a single pipeline's variables.
|
106
|
+
#
|
107
|
+
# @example
|
108
|
+
# Gitlab.pipeline_variables(5, 36)
|
109
|
+
#
|
110
|
+
# @param [Integer, String] project The ID or name of a project.
|
111
|
+
# @param [Integer] id The ID of a pipeline.
|
112
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
113
|
+
def pipeline_variables(project, id)
|
114
|
+
get("/projects/#{url_encode project}/pipelines/#{id}/variables")
|
115
|
+
end
|
104
116
|
end
|
105
117
|
end
|
@@ -109,5 +109,22 @@ class Gitlab::Client
|
|
109
109
|
def generate_changelog(project, version, options = {})
|
110
110
|
post("/projects/#{url_encode project}/repository/changelog", body: options.merge(version: version))
|
111
111
|
end
|
112
|
+
|
113
|
+
# Get changelog data
|
114
|
+
#
|
115
|
+
# @example
|
116
|
+
# Gitlab.get_changelog(42, 'v1.0.0')
|
117
|
+
#
|
118
|
+
# @param [Integer, String] project The ID or name of a project
|
119
|
+
# @param [String] version The version to generate the changelog for
|
120
|
+
# @param [Hash] options A customizable set of options
|
121
|
+
# @option options [String] :from The start of the range of commits (SHA)
|
122
|
+
# @option options [String] :to The end of the range of commits (as a SHA) to use for the changelog
|
123
|
+
# @option options [String] :date The date and time of the release, defaults to the current time
|
124
|
+
# @option options [String] :trailer The Git trailer to use for including commits
|
125
|
+
# @return [Gitlab::ObjectifiedHash]
|
126
|
+
def get_changelog(project, version, options = {})
|
127
|
+
get("/projects/#{url_encode project}/repository/changelog", body: options.merge(version: version))
|
128
|
+
end
|
112
129
|
end
|
113
130
|
end
|
data/lib/gitlab/client/users.rb
CHANGED
@@ -110,6 +110,28 @@ class Gitlab::Client
|
|
110
110
|
post("/users/#{user_id}/unblock")
|
111
111
|
end
|
112
112
|
|
113
|
+
# Deactivates the specified user. Available only for admin.
|
114
|
+
#
|
115
|
+
# @example
|
116
|
+
# Gitlab.deactivate_user(15)
|
117
|
+
#
|
118
|
+
# @param [Integer] user_id The Id of user
|
119
|
+
# @return [Boolean] success or not
|
120
|
+
def deactivate_user(user_id)
|
121
|
+
post("/users/#{user_id}/deactivate")
|
122
|
+
end
|
123
|
+
|
124
|
+
# Activate the specified user. Available only for admin.
|
125
|
+
#
|
126
|
+
# @example
|
127
|
+
# Gitlab.activate_user(15)
|
128
|
+
#
|
129
|
+
# @param [Integer] user_id The Id of user
|
130
|
+
# @return [Boolean] success or not
|
131
|
+
def activate_user(user_id)
|
132
|
+
post("/users/#{user_id}/activate")
|
133
|
+
end
|
134
|
+
|
113
135
|
# Approves the specified user. Available only for admin.
|
114
136
|
#
|
115
137
|
# @example
|
@@ -393,5 +415,16 @@ class Gitlab::Client
|
|
393
415
|
def revoke_user_impersonation_token(user_id, impersonation_token_id)
|
394
416
|
delete("/users/#{user_id}/impersonation_tokens/#{impersonation_token_id}")
|
395
417
|
end
|
418
|
+
|
419
|
+
# Disables two factor authentication (2FA) for the specified user.
|
420
|
+
#
|
421
|
+
# @example
|
422
|
+
# Gitlab.disable_two_factor(1)
|
423
|
+
#
|
424
|
+
# @param [Integer] id The ID of a user.
|
425
|
+
# @return [Gitlab::ObjectifiedHash]
|
426
|
+
def disable_two_factor(user_id)
|
427
|
+
patch("/users/#{user_id}/disable_two_factor")
|
428
|
+
end
|
396
429
|
end
|
397
430
|
end
|
data/lib/gitlab/client.rb
CHANGED
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Gitlab
|
4
|
+
module Headers
|
5
|
+
# Parses link header.
|
6
|
+
#
|
7
|
+
# @private
|
8
|
+
class PageLinks
|
9
|
+
HEADER_LINK = 'Link'
|
10
|
+
DELIM_LINKS = ','
|
11
|
+
LINK_REGEX = /<([^>]+)>; rel="([^"]+)"/.freeze
|
12
|
+
METAS = %w[last next first prev].freeze
|
13
|
+
|
14
|
+
attr_accessor(*METAS)
|
15
|
+
|
16
|
+
def initialize(headers)
|
17
|
+
link_header = headers[HEADER_LINK]
|
18
|
+
|
19
|
+
extract_links(link_header) if link_header && link_header =~ /(next|first|last|prev)/
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def extract_links(header)
|
25
|
+
header.split(DELIM_LINKS).each do |link|
|
26
|
+
LINK_REGEX.match(link.strip) do |match|
|
27
|
+
url = match[1]
|
28
|
+
meta = match[2]
|
29
|
+
next if !url || !meta || METAS.index(meta).nil?
|
30
|
+
|
31
|
+
send("#{meta}=", url)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Gitlab
|
4
|
+
module Headers
|
5
|
+
# Parses total header.
|
6
|
+
#
|
7
|
+
# @private
|
8
|
+
class Total
|
9
|
+
HEADER_TOTAL = 'x-total'
|
10
|
+
TOTAL_REGEX = /^\d+$/.freeze
|
11
|
+
|
12
|
+
attr_accessor :total
|
13
|
+
|
14
|
+
def initialize(headers)
|
15
|
+
header_total = headers[HEADER_TOTAL]
|
16
|
+
|
17
|
+
extract_total(header_total) if header_total
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def extract_total(header_total)
|
23
|
+
TOTAL_REGEX.match(header_total.strip) do |match|
|
24
|
+
@total = match[0]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -30,7 +30,8 @@ module Gitlab
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def parse_headers!(headers)
|
33
|
-
@links = PageLinks.new headers
|
33
|
+
@links = Headers::PageLinks.new headers
|
34
|
+
@total = Headers::Total.new headers
|
34
35
|
end
|
35
36
|
|
36
37
|
def each_page
|
@@ -58,6 +59,10 @@ module Gitlab
|
|
58
59
|
lazy_paginate.take(limit).each(&block)
|
59
60
|
end
|
60
61
|
|
62
|
+
def total
|
63
|
+
@total.total
|
64
|
+
end
|
65
|
+
|
61
66
|
def last_page?
|
62
67
|
!(@links.nil? || @links.last.nil?)
|
63
68
|
end
|
data/lib/gitlab/request.rb
CHANGED
data/lib/gitlab/version.rb
CHANGED
data/lib/gitlab.rb
CHANGED
@@ -4,7 +4,8 @@ require 'gitlab/version'
|
|
4
4
|
require 'gitlab/objectified_hash'
|
5
5
|
require 'gitlab/configuration'
|
6
6
|
require 'gitlab/error'
|
7
|
-
require 'gitlab/page_links'
|
7
|
+
require 'gitlab/headers/page_links'
|
8
|
+
require 'gitlab/headers/total'
|
8
9
|
require 'gitlab/paginated_response'
|
9
10
|
require 'gitlab/file_response'
|
10
11
|
require 'gitlab/request'
|
@@ -49,8 +50,10 @@ module Gitlab
|
|
49
50
|
#
|
50
51
|
# @return [Array<Symbol>]
|
51
52
|
def self.actions
|
53
|
+
# rubocop:disable Layout/LineLength
|
52
54
|
hidden =
|
53
|
-
/endpoint|private_token|auth_token|user_agent|sudo|get|post|put|\Adelete\z|validate\z|request_defaults|httparty/
|
55
|
+
/endpoint|private_token|auth_token|user_agent|sudo|get|post|put|patch|\Adelete\z|validate\z|request_defaults|httparty/
|
56
|
+
# rubocop:enable Layout/LineLength
|
54
57
|
(Gitlab::Client.instance_methods - Object.methods).reject { |e| e[hidden] }
|
55
58
|
end
|
56
59
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fs-gitlab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.19.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nihad Abbasov
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-03-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
@@ -165,9 +165,10 @@ files:
|
|
165
165
|
- lib/gitlab/configuration.rb
|
166
166
|
- lib/gitlab/error.rb
|
167
167
|
- lib/gitlab/file_response.rb
|
168
|
+
- lib/gitlab/headers/page_links.rb
|
169
|
+
- lib/gitlab/headers/total.rb
|
168
170
|
- lib/gitlab/help.rb
|
169
171
|
- lib/gitlab/objectified_hash.rb
|
170
|
-
- lib/gitlab/page_links.rb
|
171
172
|
- lib/gitlab/paginated_response.rb
|
172
173
|
- lib/gitlab/request.rb
|
173
174
|
- lib/gitlab/shell.rb
|
@@ -197,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
197
198
|
- !ruby/object:Gem::Version
|
198
199
|
version: '0'
|
199
200
|
requirements: []
|
200
|
-
rubygems_version: 3.
|
201
|
+
rubygems_version: 3.3.7
|
201
202
|
signing_key:
|
202
203
|
specification_version: 4
|
203
204
|
summary: A Ruby wrapper and CLI for the GitLab API
|
data/lib/gitlab/page_links.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Gitlab
|
4
|
-
# Parses link header.
|
5
|
-
#
|
6
|
-
# @private
|
7
|
-
class PageLinks
|
8
|
-
HEADER_LINK = 'Link'
|
9
|
-
DELIM_LINKS = ','
|
10
|
-
LINK_REGEX = /<([^>]+)>; rel="([^"]+)"/.freeze
|
11
|
-
METAS = %w[last next first prev].freeze
|
12
|
-
|
13
|
-
attr_accessor(*METAS)
|
14
|
-
|
15
|
-
def initialize(headers)
|
16
|
-
link_header = headers[HEADER_LINK]
|
17
|
-
|
18
|
-
extract_links(link_header) if link_header && link_header =~ /(next|first|last|prev)/
|
19
|
-
end
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
def extract_links(header)
|
24
|
-
header.split(DELIM_LINKS).each do |link|
|
25
|
-
LINK_REGEX.match(link.strip) do |match|
|
26
|
-
url = match[1]
|
27
|
-
meta = match[2]
|
28
|
-
next if !url || !meta || METAS.index(meta).nil?
|
29
|
-
|
30
|
-
send("#{meta}=", url)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|