labclient 0.3.1 → 0.3.2

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: 0c77fa948bc39c9ec7d677340949a7bc52ed03999c4cb5286d125154edb06f9b
4
- data.tar.gz: fa96ed5df9a9ddf7eea56cd7eb7a34832b4a9509d982159fd8069c5ae49de241
3
+ metadata.gz: afae2688a4bc4ee88d958081de2aa6a0f836023de31f0893b0027c95d4b25ac3
4
+ data.tar.gz: b89c9b5de0143fdcb4efe0ca599d3c585f0166a5d43b56f379a78680e45fb459
5
5
  SHA512:
6
- metadata.gz: 2148330fb1c533956e2f51085729c7c8e96b8fc27e21b43bbbac2b492906047bc52d964b203fe42ac86fc2f041310ab6c6b4e7f90ae5935efcedaf11674a4363
7
- data.tar.gz: 004cbd92b60fd45996a4ecd9ae38039b3bae703a22f4d804e34390a56662a0f0859992295a83bf0d53f7e4e6191e2c9f416fcc4b7618e54e1b944c73aa4478fc
6
+ metadata.gz: d35822a7a216bc2b35be35480c22a2c2a887218f36b6ff719fefd94d953c1711c3c190005e601d4d9380385c16e65ea632737076ef00767be7a66b0f5a035abb
7
+ data.tar.gz: ca0b0b31a2ab8669c2413468a942d4c24170a41fbdaa76e9cfbb7d13f5fea7f3341fd55e2d007e02e37a851a2981a7af34e33ead97762a9d3682d6bba9a1a3d3
@@ -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
@@ -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
@@ -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(:get, "projects/#{project_id}/environments/#{environment_id}/stop", nil)
24
+ client.request(:post, "projects/#{project_id}/environments/#{environment_id}/stop", nil)
25
25
  end
26
26
  end
27
27
  end
@@ -1,3 +1,3 @@
1
1
  module LabClient
2
- VERSION = '0.3.1'.freeze
2
+ VERSION = '0.3.2'.freeze
3
3
  end
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.1
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: 2020-10-19 00:00:00.000000000 Z
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.1.4
916
+ rubygems_version: 3.0.3
917
917
  signing_key:
918
918
  specification_version: 4
919
919
  summary: Gitlab API Client