gitlab 4.12.0 → 4.20.1

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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +24 -16
  4. data/lib/gitlab/api.rb +2 -0
  5. data/lib/gitlab/cli.rb +6 -5
  6. data/lib/gitlab/cli_helpers.rb +10 -16
  7. data/lib/gitlab/client/build_variables.rb +17 -12
  8. data/lib/gitlab/client/commits.rb +42 -5
  9. data/lib/gitlab/client/container_registry.rb +1 -1
  10. data/lib/gitlab/client/epic_issues.rb +23 -0
  11. data/lib/gitlab/client/epics.rb +73 -0
  12. data/lib/gitlab/client/group_badges.rb +88 -0
  13. data/lib/gitlab/client/group_labels.rb +1 -1
  14. data/lib/gitlab/client/groups.rb +247 -2
  15. data/lib/gitlab/client/issue_links.rb +48 -0
  16. data/lib/gitlab/client/issues.rb +12 -1
  17. data/lib/gitlab/client/jobs.rb +91 -8
  18. data/lib/gitlab/client/keys.rb +11 -0
  19. data/lib/gitlab/client/labels.rb +1 -1
  20. data/lib/gitlab/client/merge_request_approvals.rb +155 -2
  21. data/lib/gitlab/client/merge_requests.rb +76 -4
  22. data/lib/gitlab/client/merge_trains.rb +55 -0
  23. data/lib/gitlab/client/notes.rb +27 -0
  24. data/lib/gitlab/client/packages.rb +95 -0
  25. data/lib/gitlab/client/pipeline_schedules.rb +16 -4
  26. data/lib/gitlab/client/pipelines.rb +37 -0
  27. data/lib/gitlab/client/project_exports.rb +54 -0
  28. data/lib/gitlab/client/project_releases.rb +11 -0
  29. data/lib/gitlab/client/projects.rb +119 -7
  30. data/lib/gitlab/client/remote_mirrors.rb +51 -0
  31. data/lib/gitlab/client/repositories.rb +56 -1
  32. data/lib/gitlab/client/repository_files.rb +16 -0
  33. data/lib/gitlab/client/resource_state_events.rb +57 -0
  34. data/lib/gitlab/client/runners.rb +126 -21
  35. data/lib/gitlab/client/search.rb +5 -1
  36. data/lib/gitlab/client/user_snippets.rb +114 -0
  37. data/lib/gitlab/client/users.rb +267 -12
  38. data/lib/gitlab/client.rb +16 -2
  39. data/lib/gitlab/configuration.rb +1 -1
  40. data/lib/gitlab/error.rb +36 -1
  41. data/lib/gitlab/headers/page_links.rb +37 -0
  42. data/lib/gitlab/headers/total.rb +29 -0
  43. data/lib/gitlab/help.rb +8 -8
  44. data/lib/gitlab/objectified_hash.rb +23 -7
  45. data/lib/gitlab/paginated_response.rb +29 -40
  46. data/lib/gitlab/request.rb +35 -21
  47. data/lib/gitlab/shell_history.rb +2 -2
  48. data/lib/gitlab/version.rb +1 -1
  49. data/lib/gitlab.rb +17 -6
  50. metadata +24 -48
  51. data/lib/gitlab/page_links.rb +0 -35
data/lib/gitlab/help.rb CHANGED
@@ -45,14 +45,13 @@ module Gitlab::Help
45
45
  #
46
46
  # @return [Hash<Array>]
47
47
  def help_map
48
- @help_map ||= begin
48
+ @help_map ||=
49
49
  actions.each_with_object({}) do |action, hsh|
50
50
  key = client.method(action)
51
51
  .owner.to_s.gsub(/Gitlab::(?:Client::)?/, '')
52
52
  hsh[key] ||= []
53
53
  hsh[key] << action.to_s
54
54
  end
55
- end
56
55
  end
57
56
 
58
57
  # Table with available commands.
@@ -74,21 +73,22 @@ module Gitlab::Help
74
73
  # Returns full namespace of a command (e.g. Gitlab::Client::Branches.cmd)
75
74
  def namespace(cmd)
76
75
  method_owners.select { |method| method[:name] == cmd }
77
- .map { |method| method[:owner] + '.' + method[:name] }
76
+ .map { |method| "#{method[:owner]}.#{method[:name]}" }
78
77
  .shift
79
78
  end
80
79
 
81
80
  # Massage output from 'ri'.
82
81
  def change_help_output!(cmd, output_str)
83
- output_str.gsub!(/#{cmd}\((.*?)\)/m, cmd + ' \1')
84
- output_str.gsub!(/\,[\s]*/, ' ')
82
+ output_str = +output_str
83
+ output_str.gsub!(/#{cmd}(\(.*?\))/m, "#{cmd}\\1")
84
+ output_str.gsub!(/,\s*/, ', ')
85
85
 
86
86
  # Ensure @option descriptions are on a single line
87
87
  output_str.gsub!(/\n\[/, " \[")
88
88
  output_str.gsub!(/\s(@)/, "\n@")
89
- output_str.gsub!(/(\])\n(\:)/, '\1 \2')
90
- output_str.gsub!(/(\:.*)(\n)(.*\.)/, '\1 \3')
91
- output_str.gsub!(/\{(.+)\}/, '"{\1}"')
89
+ output_str.gsub!(/(\])\n(:)/, '\\1 \\2')
90
+ output_str.gsub!(/(:.*)(\n)(.*\.)/, '\\1 \\3')
91
+ output_str.gsub!(/\{(.+)\}/, '"{\\1}"')
92
92
  end
93
93
  end
94
94
  end
@@ -7,29 +7,45 @@ module Gitlab
7
7
  def initialize(hash)
8
8
  @hash = hash
9
9
  @data = hash.each_with_object({}) do |(key, value), data|
10
- value = ObjectifiedHash.new(value) if value.is_a? Hash
10
+ value = self.class.new(value) if value.is_a? Hash
11
+ value = value.map { |v| v.is_a?(Hash) ? self.class.new(v) : v } if value.is_a? Array
11
12
  data[key.to_s] = value
12
13
  end
13
14
  end
14
15
 
15
16
  # @return [Hash] The original hash.
16
17
  def to_hash
17
- @hash
18
+ hash
18
19
  end
19
20
  alias to_h to_hash
20
21
 
21
22
  # @return [String] Formatted string with the class name, object id and original hash.
22
23
  def inspect
23
- "#<#{self.class}:#{object_id} {hash: #{@hash.inspect}}"
24
+ "#<#{self.class}:#{object_id} {hash: #{hash.inspect}}"
24
25
  end
25
26
 
26
- # Delegate to ObjectifiedHash.
27
- def method_missing(key)
28
- @data.key?(key.to_s) ? @data[key.to_s] : super
27
+ def [](key)
28
+ data[key]
29
+ end
30
+
31
+ private
32
+
33
+ attr_reader :hash, :data
34
+
35
+ # Respond to messages for which `self.data` has a key
36
+ def method_missing(method_name, *args, &block)
37
+ if data.key?(method_name.to_s)
38
+ data[method_name.to_s]
39
+ elsif data.respond_to?(method_name)
40
+ warn 'WARNING: Please convert ObjectifiedHash object to hash before calling Hash methods on it.'
41
+ data.send(method_name, *args, &block)
42
+ else
43
+ super
44
+ end
29
45
  end
30
46
 
31
47
  def respond_to_missing?(method_name, include_private = false)
32
- @hash.keys.map(&:to_sym).include?(method_name.to_sym) || super
48
+ hash.keys.map(&:to_sym).include?(method_name.to_sym) || super
33
49
  end
34
50
  end
35
51
  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
@@ -42,37 +43,24 @@ module Gitlab
42
43
  end
43
44
  end
44
45
 
45
- def auto_paginate
46
- response = block_given? ? nil : []
47
- each_page do |page|
48
- if block_given?
49
- page.each do |item|
50
- yield item
51
- end
52
- else
53
- response += page
54
- end
55
- end
56
- response
57
- end
58
-
59
- def paginate_with_limit(limit)
60
- response = block_given? ? nil : []
61
- count = 0
62
- each_page do |page|
63
- if block_given?
64
- page.each do |item|
65
- yield item
66
- count += 1
67
- break if count >= limit
68
- end
69
- else
70
- response += page[0, limit - count]
71
- count = response.length
72
- end
73
- break if count >= limit
74
- end
75
- response
46
+ def lazy_paginate
47
+ to_enum(:each_page).lazy.flat_map(&:to_ary)
48
+ end
49
+
50
+ def auto_paginate(&block)
51
+ return lazy_paginate.to_a unless block
52
+
53
+ lazy_paginate.each(&block)
54
+ end
55
+
56
+ def paginate_with_limit(limit, &block)
57
+ return lazy_paginate.take(limit).to_a unless block
58
+
59
+ lazy_paginate.take(limit).each(&block)
60
+ end
61
+
62
+ def total
63
+ @total.total
76
64
  end
77
65
 
78
66
  def last_page?
@@ -83,8 +71,7 @@ module Gitlab
83
71
  def last_page
84
72
  return nil if @client.nil? || !has_last_page?
85
73
 
86
- path = @links.last.sub(/#{@client.endpoint}/, '')
87
- @client.get(path)
74
+ @client.get(client_relative_path(@links.last))
88
75
  end
89
76
 
90
77
  def first_page?
@@ -95,8 +82,7 @@ module Gitlab
95
82
  def first_page
96
83
  return nil if @client.nil? || !has_first_page?
97
84
 
98
- path = @links.first.sub(/#{@client.endpoint}/, '')
99
- @client.get(path)
85
+ @client.get(client_relative_path(@links.first))
100
86
  end
101
87
 
102
88
  def next_page?
@@ -107,8 +93,7 @@ module Gitlab
107
93
  def next_page
108
94
  return nil if @client.nil? || !has_next_page?
109
95
 
110
- path = @links.next.sub(/#{@client.endpoint}/, '')
111
- @client.get(path)
96
+ @client.get(client_relative_path(@links.next))
112
97
  end
113
98
 
114
99
  def prev_page?
@@ -119,8 +104,12 @@ module Gitlab
119
104
  def prev_page
120
105
  return nil if @client.nil? || !has_prev_page?
121
106
 
122
- path = @links.prev.sub(/#{@client.endpoint}/, '')
123
- @client.get(path)
107
+ @client.get(client_relative_path(@links.prev))
108
+ end
109
+
110
+ def client_relative_path(link)
111
+ client_endpoint_path = URI.parse(@client.endpoint).request_uri # api/v4
112
+ URI.parse(link).request_uri.sub(client_endpoint_path, '')
124
113
  end
125
114
  end
126
115
  end
@@ -8,6 +8,7 @@ module Gitlab
8
8
  class Request
9
9
  include HTTParty
10
10
  format :json
11
+ maintain_method_across_redirects true
11
12
  headers 'Accept' => 'application/json', 'Content-Type' => 'application/x-www-form-urlencoded'
12
13
  parser(proc { |body, _| parse(body) })
13
14
 
@@ -25,8 +26,6 @@ module Gitlab
25
26
  true
26
27
  elsif !body
27
28
  false
28
- elsif body.nil?
29
- false
30
29
  else
31
30
  raise Error::Parsing, "Couldn't parse a response body"
32
31
  end
@@ -39,18 +38,36 @@ module Gitlab
39
38
  raise Error::Parsing, 'The response is not a valid JSON'
40
39
  end
41
40
 
42
- %w[get post put delete].each do |method|
41
+ %w[get post put patch delete].each do |method|
43
42
  define_method method do |path, options = {}|
44
- httparty_config(options)
45
- authorization_header(options)
46
- validate self.class.send(method, @endpoint + path, options)
43
+ params = options.dup
44
+
45
+ httparty_config(params)
46
+
47
+ unless params[:unauthenticated]
48
+ params[:headers] ||= {}
49
+ params[:headers].merge!(authorization_header)
50
+ end
51
+
52
+ retries_left = params[:ratelimit_retries] || 3
53
+ begin
54
+ response = self.class.send(method, endpoint + path, params)
55
+ validate response
56
+ rescue Gitlab::Error::TooManyRequests => e
57
+ retries_left -= 1
58
+ raise e if retries_left.zero?
59
+
60
+ wait_time = response.headers['Retry-After'] || 2
61
+ sleep(wait_time.to_i)
62
+ retry
63
+ end
47
64
  end
48
65
  end
49
66
 
50
67
  # Checks the response code for common errors.
51
68
  # Returns parsed response for successful requests.
52
69
  def validate(response)
53
- error_klass = Error::STATUS_MAPPINGS[response.code]
70
+ error_klass = Error.klass(response)
54
71
  raise error_klass, response if error_klass
55
72
 
56
73
  parsed = response.parsed_response
@@ -62,28 +79,25 @@ module Gitlab
62
79
  # Sets a base_uri and default_params for requests.
63
80
  # @raise [Error::MissingCredentials] if endpoint not set.
64
81
  def request_defaults(sudo = nil)
65
- self.class.default_params sudo: sudo
66
- raise Error::MissingCredentials, 'Please set an endpoint to API' unless @endpoint
82
+ raise Error::MissingCredentials, 'Please set an endpoint to API' unless endpoint
67
83
 
84
+ self.class.default_params sudo: sudo
68
85
  self.class.default_params.delete(:sudo) if sudo.nil?
69
86
  end
70
87
 
71
88
  private
72
89
 
73
- # Sets a PRIVATE-TOKEN or Authorization header for requests.
90
+ # Returns an Authorization header hash
74
91
  #
75
- # @param [Hash] options A customizable set of options.
76
- # @option options [Boolean] :unauthenticated true if the API call does not require user authentication.
77
92
  # @raise [Error::MissingCredentials] if private_token and auth_token are not set.
78
- def authorization_header(options)
79
- return if options[:unauthenticated]
80
- raise Error::MissingCredentials, 'Please provide a private_token or auth_token for user' unless @private_token
81
-
82
- options[:headers] = if @private_token.size < 21
83
- { 'PRIVATE-TOKEN' => @private_token }
84
- else
85
- { 'Authorization' => "Bearer #{@private_token}" }
86
- end
93
+ def authorization_header
94
+ raise Error::MissingCredentials, 'Please provide a private_token or auth_token for user' unless private_token
95
+
96
+ if private_token.size < 21
97
+ { 'PRIVATE-TOKEN' => private_token }
98
+ else
99
+ { 'Authorization' => "Bearer #{private_token}" }
100
+ end
87
101
  end
88
102
 
89
103
  # Set HTTParty configuration
@@ -42,10 +42,10 @@ class Gitlab::Shell
42
42
  File.expand_path(@file_path)
43
43
  end
44
44
 
45
- def read_from_file
45
+ def read_from_file(&block)
46
46
  path = history_file_path
47
47
 
48
- File.foreach(path) { |line| yield(line) } if File.exist?(path)
48
+ File.foreach(path, &block) if File.exist?(path)
49
49
  rescue StandardError => e
50
50
  warn "History file not loaded: #{e.message}"
51
51
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gitlab
4
- VERSION = '4.12.0'
4
+ VERSION = '4.20.1'
5
5
  end
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'
@@ -21,11 +22,18 @@ module Gitlab
21
22
  Gitlab::Client.new(options)
22
23
  end
23
24
 
24
- # Delegate to Gitlab::Client
25
- def self.method_missing(method, *args, &block)
26
- return super unless client.respond_to?(method)
25
+ if Gem::Version.new(RUBY_VERSION).release >= Gem::Version.new('3.0.0')
26
+ def self.method_missing(method, *args, **keywargs, &block)
27
+ return super unless client.respond_to?(method)
28
+
29
+ client.send(method, *args, **keywargs, &block)
30
+ end
31
+ else
32
+ def self.method_missing(method, *args, &block)
33
+ return super unless client.respond_to?(method)
27
34
 
28
- client.send(method, *args, &block)
35
+ client.send(method, *args, &block)
36
+ end
29
37
  end
30
38
 
31
39
  # Delegate to Gitlab::Client
@@ -42,7 +50,10 @@ module Gitlab
42
50
  #
43
51
  # @return [Array<Symbol>]
44
52
  def self.actions
45
- hidden = /endpoint|private_token|auth_token|user_agent|sudo|get|post|put|\Adelete\z|validate|request_defaults|httparty/
53
+ # rubocop:disable Layout/LineLength
54
+ hidden =
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
46
57
  (Gitlab::Client.instance_methods - Object.methods).reject { |e| e[hidden] }
47
58
  end
48
59
  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.12.0
4
+ version: 4.20.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nihad Abbasov
@@ -9,35 +9,26 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2019-07-11 00:00:00.000000000 Z
12
+ date: 2024-06-13 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
- version: '0.14'
20
+ version: '0.20'
24
21
  type: :runtime
25
22
  prerelease: false
26
23
  version_requirements: !ruby/object:Gem::Requirement
27
24
  requirements:
28
- - - ">="
29
- - !ruby/object:Gem::Version
30
- version: 0.14.0
31
25
  - - "~>"
32
26
  - !ruby/object:Gem::Version
33
- version: '0.14'
27
+ version: '0.20'
34
28
  - !ruby/object:Gem::Dependency
35
29
  name: terminal-table
36
30
  requirement: !ruby/object:Gem::Requirement
37
31
  requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '1.5'
41
32
  - - ">="
42
33
  - !ruby/object:Gem::Version
43
34
  version: 1.5.1
@@ -45,26 +36,9 @@ dependencies:
45
36
  prerelease: false
46
37
  version_requirements: !ruby/object:Gem::Requirement
47
38
  requirements:
48
- - - "~>"
49
- - !ruby/object:Gem::Version
50
- version: '1.5'
51
39
  - - ">="
52
40
  - !ruby/object:Gem::Version
53
41
  version: 1.5.1
54
- - !ruby/object:Gem::Dependency
55
- name: pry
56
- requirement: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- version: '0'
61
- type: :development
62
- prerelease: false
63
- version_requirements: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- version: '0'
68
42
  - !ruby/object:Gem::Dependency
69
43
  name: rake
70
44
  requirement: !ruby/object:Gem::Requirement
@@ -93,20 +67,6 @@ dependencies:
93
67
  - - ">="
94
68
  - !ruby/object:Gem::Version
95
69
  version: '0'
96
- - !ruby/object:Gem::Dependency
97
- name: rubocop
98
- requirement: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- version: '0'
103
- type: :development
104
- prerelease: false
105
- version_requirements: !ruby/object:Gem::Requirement
106
- requirements:
107
- - - ">="
108
- - !ruby/object:Gem::Version
109
- version: '0'
110
70
  - !ruby/object:Gem::Dependency
111
71
  name: webmock
112
72
  requirement: !ruby/object:Gem::Requirement
@@ -152,12 +112,16 @@ files:
152
112
  - lib/gitlab/client/container_registry.rb
153
113
  - lib/gitlab/client/deployments.rb
154
114
  - lib/gitlab/client/environments.rb
115
+ - lib/gitlab/client/epic_issues.rb
116
+ - lib/gitlab/client/epics.rb
155
117
  - lib/gitlab/client/events.rb
156
118
  - lib/gitlab/client/features.rb
119
+ - lib/gitlab/client/group_badges.rb
157
120
  - lib/gitlab/client/group_boards.rb
158
121
  - lib/gitlab/client/group_labels.rb
159
122
  - lib/gitlab/client/group_milestones.rb
160
123
  - lib/gitlab/client/groups.rb
124
+ - lib/gitlab/client/issue_links.rb
161
125
  - lib/gitlab/client/issues.rb
162
126
  - lib/gitlab/client/jobs.rb
163
127
  - lib/gitlab/client/keys.rb
@@ -166,22 +130,27 @@ files:
166
130
  - lib/gitlab/client/markdown.rb
167
131
  - lib/gitlab/client/merge_request_approvals.rb
168
132
  - lib/gitlab/client/merge_requests.rb
133
+ - lib/gitlab/client/merge_trains.rb
169
134
  - lib/gitlab/client/milestones.rb
170
135
  - lib/gitlab/client/namespaces.rb
171
136
  - lib/gitlab/client/notes.rb
137
+ - lib/gitlab/client/packages.rb
172
138
  - lib/gitlab/client/pipeline_schedules.rb
173
139
  - lib/gitlab/client/pipeline_triggers.rb
174
140
  - lib/gitlab/client/pipelines.rb
175
141
  - lib/gitlab/client/project_badges.rb
176
142
  - lib/gitlab/client/project_clusters.rb
143
+ - lib/gitlab/client/project_exports.rb
177
144
  - lib/gitlab/client/project_release_links.rb
178
145
  - lib/gitlab/client/project_releases.rb
179
146
  - lib/gitlab/client/projects.rb
180
147
  - lib/gitlab/client/protected_tags.rb
148
+ - lib/gitlab/client/remote_mirrors.rb
181
149
  - lib/gitlab/client/repositories.rb
182
150
  - lib/gitlab/client/repository_files.rb
183
151
  - lib/gitlab/client/repository_submodules.rb
184
152
  - lib/gitlab/client/resource_label_events.rb
153
+ - lib/gitlab/client/resource_state_events.rb
185
154
  - lib/gitlab/client/runners.rb
186
155
  - lib/gitlab/client/search.rb
187
156
  - lib/gitlab/client/services.rb
@@ -191,15 +160,17 @@ files:
191
160
  - lib/gitlab/client/tags.rb
192
161
  - lib/gitlab/client/templates.rb
193
162
  - lib/gitlab/client/todos.rb
163
+ - lib/gitlab/client/user_snippets.rb
194
164
  - lib/gitlab/client/users.rb
195
165
  - lib/gitlab/client/versions.rb
196
166
  - lib/gitlab/client/wikis.rb
197
167
  - lib/gitlab/configuration.rb
198
168
  - lib/gitlab/error.rb
199
169
  - lib/gitlab/file_response.rb
170
+ - lib/gitlab/headers/page_links.rb
171
+ - lib/gitlab/headers/total.rb
200
172
  - lib/gitlab/help.rb
201
173
  - lib/gitlab/objectified_hash.rb
202
- - lib/gitlab/page_links.rb
203
174
  - lib/gitlab/paginated_response.rb
204
175
  - lib/gitlab/request.rb
205
176
  - lib/gitlab/shell.rb
@@ -208,7 +179,12 @@ files:
208
179
  homepage: https://github.com/NARKOZ/gitlab
209
180
  licenses:
210
181
  - BSD-2-Clause
211
- metadata: {}
182
+ metadata:
183
+ homepage_uri: https://github.com/NARKOZ/gitlab
184
+ source_code_uri: https://github.com/NARKOZ/gitlab
185
+ bug_tracker_uri: https://github.com/NARKOZ/gitlab/issues
186
+ changelog_uri: https://github.com/NARKOZ/gitlab/releases
187
+ funding_uri: https://github.com/NARKOZ/SponsorMe
212
188
  post_install_message:
213
189
  rdoc_options: []
214
190
  require_paths:
@@ -217,14 +193,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
217
193
  requirements:
218
194
  - - ">="
219
195
  - !ruby/object:Gem::Version
220
- version: '2.3'
196
+ version: '2.6'
221
197
  required_rubygems_version: !ruby/object:Gem::Requirement
222
198
  requirements:
223
199
  - - ">="
224
200
  - !ruby/object:Gem::Version
225
201
  version: '0'
226
202
  requirements: []
227
- rubygems_version: 3.0.4
203
+ rubygems_version: 3.1.6
228
204
  signing_key:
229
205
  specification_version: 4
230
206
  summary: A Ruby wrapper and CLI for the GitLab API
@@ -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