labclient 0.3.1 → 0.3.2
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.
- checksums.yaml +4 -4
- data/lib/labclient/client.rb +1 -0
- data/lib/labclient/http.rb +8 -2
- data/lib/labclient/overview.rb +11 -0
- data/lib/labclient/projects/environments/stop.rb +1 -1
- data/lib/labclient/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: afae2688a4bc4ee88d958081de2aa6a0f836023de31f0893b0027c95d4b25ac3
|
4
|
+
data.tar.gz: b89c9b5de0143fdcb4efe0ca599d3c585f0166a5d43b56f379a78680e45fb459
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d35822a7a216bc2b35be35480c22a2c2a887218f36b6ff719fefd94d953c1711c3c190005e601d4d9380385c16e65ea632737076ef00767be7a66b0f5a035abb
|
7
|
+
data.tar.gz: ca0b0b31a2ab8669c2413468a942d4c24170a41fbdaa76e9cfbb7d13f5fea7f3341fd55e2d007e02e37a851a2981a7af34e33ead97762a9d3682d6bba9a1a3d3
|
data/lib/labclient/client.rb
CHANGED
@@ -136,6 +136,7 @@ module LabClient
|
|
136
136
|
@settings[:paginate] = true if @settings[:paginate].nil?
|
137
137
|
@settings[:ssl_verify] = true if @settings[:ssl_verify].nil?
|
138
138
|
@settings[:quiet] = false if @settings[:quiet].nil?
|
139
|
+
@settings[:token_type] = 'Private-Token' if @settings[:token_type].nil?
|
139
140
|
end
|
140
141
|
|
141
142
|
def home_file
|
data/lib/labclient/http.rb
CHANGED
@@ -42,13 +42,19 @@ module LabClient
|
|
42
42
|
def headers(dump_json)
|
43
43
|
default_headers = {
|
44
44
|
|
45
|
-
'Private-Token' => settings[:token],
|
46
|
-
|
47
45
|
'Accept' => 'application/json',
|
48
46
|
'User-Agent' => "LabClient #{LabClient::VERSION}"
|
49
47
|
}
|
50
48
|
|
49
|
+
token_type = settings[:token_type]
|
50
|
+
default_headers[token_type] = if token_type == 'Authorization'
|
51
|
+
"Bearer #{settings[:token]}"
|
52
|
+
else
|
53
|
+
settings[:token]
|
54
|
+
end
|
55
|
+
|
51
56
|
default_headers['Content-Type'] = 'application/json' if dump_json
|
57
|
+
|
52
58
|
default_headers
|
53
59
|
end
|
54
60
|
end
|
data/lib/labclient/overview.rb
CHANGED
@@ -102,6 +102,17 @@ module LabClient
|
|
102
102
|
DOC
|
103
103
|
end
|
104
104
|
|
105
|
+
doc 'Authentication' do
|
106
|
+
title 'OAuth Authorization'
|
107
|
+
desc 'Use OAuth access tokens to make requests to the API on behalf of a user. '
|
108
|
+
example <<~DOC
|
109
|
+
client = LabClient::Client.new(
|
110
|
+
url: 'https://gitlab.labclient',
|
111
|
+
token: 'gitlab oauth token',
|
112
|
+
token_type: 'Authorization'
|
113
|
+
)
|
114
|
+
DOC
|
115
|
+
end
|
105
116
|
doc 'Pagination' do
|
106
117
|
desc 'Pagination is enabled by default if not specified. Can be explicitly enabled or disabled'
|
107
118
|
example <<~DOC
|
@@ -21,7 +21,7 @@ module LabClient
|
|
21
21
|
project_id = format_id(project_id)
|
22
22
|
environment_id = format_id(environment_id)
|
23
23
|
|
24
|
-
client.request(:
|
24
|
+
client.request(:post, "projects/#{project_id}/environments/#{environment_id}/stop", nil)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
data/lib/labclient/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: labclient
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Davin Walker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -913,7 +913,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
913
913
|
- !ruby/object:Gem::Version
|
914
914
|
version: '0'
|
915
915
|
requirements: []
|
916
|
-
rubygems_version: 3.
|
916
|
+
rubygems_version: 3.0.3
|
917
917
|
signing_key:
|
918
918
|
specification_version: 4
|
919
919
|
summary: Gitlab API Client
|