jira-ruby 2.1.0 → 2.1.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2fea6e6a55a6679e8dab6437b19ccb62d29f8d31ec4db8b36c449ce3cae78f44
4
- data.tar.gz: e4f8e7e6c1be0344db51d6a516c3da9db55343f93a49cb08072d0dbf5c462f16
3
+ metadata.gz: 293138e5626828e965e7862b82752fdcdc28a7f063b5e335dbcc1017f0ff371e
4
+ data.tar.gz: 8172bc08099f9a44bae653c69e347eab2356acbaa1df3aa001e5baa38b4e60fa
5
5
  SHA512:
6
- metadata.gz: 934781eb8ab9ec5bc4da7ad9b1c048dc52adaffd17c389046c10f1078e93495f248d4af219dd10fc105a87e8ef6d58c99ada61db40c86238ee7f844ab632c831
7
- data.tar.gz: 7ebaeb51adb377be540de240939188b3e88b85554958f3bd0cd187346778a3b45c0ee9cc70c23d4e5763f16fc2e96b36032a32253845c8a98d5c1c3de0bc2e7d
6
+ metadata.gz: 699f1f8410ab65069f4f0a569bf8c2d2f4ec5903f0487ee075014be3ba48dc940efa1b0ccace8523418b9199c18c0eb3cd4d9aa1dd3c3f5d6dcf14c460583211
7
+ data.tar.gz: d0c35fcd9ccf3dfce329809588ae3d245447d942167097a3f5aafe28e5dc253c39eb468166bcbf53d4dca0dd2a22882b103e7114917fd80b3a5696532741a6a8
@@ -6,7 +6,7 @@ module JIRA
6
6
  # This class is the main access point for all JIRA::Resource instances.
7
7
  #
8
8
  # The client must be initialized with an options hash containing
9
- # configuration options. The available options are:
9
+ # configuration options. The available options are:
10
10
  #
11
11
  # :site => 'http://localhost:2990',
12
12
  # :context_path => '/jira',
@@ -14,6 +14,7 @@ module JIRA
14
14
  # :request_token_path => "/plugins/servlet/oauth/request-token",
15
15
  # :authorize_path => "/plugins/servlet/oauth/authorize",
16
16
  # :access_token_path => "/plugins/servlet/oauth/access-token",
17
+ # :private_key => nil,
17
18
  # :private_key_file => "rsakey.pem",
18
19
  # :rest_base_path => "/rest/api/2",
19
20
  # :consumer_key => nil,
@@ -28,11 +29,17 @@ module JIRA
28
29
  # :proxy_port => nil,
29
30
  # :proxy_username => nil,
30
31
  # :proxy_password => nil,
32
+ # :use_cookies => nil,
31
33
  # :additional_cookies => nil,
32
34
  # :default_headers => {},
33
35
  # :use_client_cert => false,
36
+ # :read_timeout => nil,
34
37
  # :http_debug => false,
35
- # :shared_secret => nil
38
+ # :shared_secret => nil,
39
+ # :cert_path => nil,
40
+ # :key_path => nil,
41
+ # :ssl_client_cert => nil,
42
+ # :ssl_client_key => nil
36
43
  #
37
44
  # See the JIRA::Base class methods for all of the available methods on these accessor
38
45
  # objects.
@@ -58,6 +65,7 @@ module JIRA
58
65
  :request_token_path,
59
66
  :authorize_path,
60
67
  :access_token_path,
68
+ :private_key,
61
69
  :private_key_file,
62
70
  :rest_base_path,
63
71
  :consumer_key,
@@ -72,13 +80,19 @@ module JIRA
72
80
  :proxy_port,
73
81
  :proxy_username,
74
82
  :proxy_password,
83
+ :use_cookies,
75
84
  :additional_cookies,
76
85
  :default_headers,
77
86
  :use_client_cert,
87
+ :read_timeout,
78
88
  :http_debug,
79
89
  :issuer,
80
90
  :base_url,
81
- :shared_secret
91
+ :shared_secret,
92
+ :cert_path,
93
+ :key_path,
94
+ :ssl_client_cert,
95
+ :ssl_client_key
82
96
  ].freeze
83
97
 
84
98
  DEFAULT_OPTIONS = {
@@ -102,10 +116,11 @@ module JIRA
102
116
  raise ArgumentError, "Unknown option(s) given: #{unknown_options}" unless unknown_options.empty?
103
117
 
104
118
  if options[:use_client_cert]
105
- raise ArgumentError, 'Options: :cert_path must be set when :use_client_cert is true' unless @options[:cert_path]
106
- raise ArgumentError, 'Options: :key_path must be set when :use_client_cert is true' unless @options[:key_path]
107
- @options[:cert] = OpenSSL::X509::Certificate.new(File.read(@options[:cert_path]))
108
- @options[:key] = OpenSSL::PKey::RSA.new(File.read(@options[:key_path]))
119
+ @options[:ssl_client_cert] = OpenSSL::X509::Certificate.new(File.read(@options[:cert_path])) if @options[:cert_path]
120
+ @options[:ssl_client_key] = OpenSSL::PKey::RSA.new(File.read(@options[:key_path])) if @options[:key_path]
121
+
122
+ raise ArgumentError, 'Options: :cert_path or :ssl_client_cert must be set when :use_client_cert is true' unless @options[:ssl_client_cert]
123
+ raise ArgumentError, 'Options: :key_path or :ssl_client_key must be set when :use_client_cert is true' unless @options[:ssl_client_key]
109
124
  end
110
125
 
111
126
  case options[:auth_type]
@@ -286,6 +301,11 @@ module JIRA
286
301
  @request_client.request(http_method, path, body, headers)
287
302
  end
288
303
 
304
+ # Stops sensitive client information from being displayed in logs
305
+ def inspect
306
+ "#<JIRA::Client:#{object_id}>"
307
+ end
308
+
289
309
  protected
290
310
 
291
311
  def merge_default_headers(headers)
@@ -53,8 +53,8 @@ module JIRA
53
53
  http_conn = http_class.new(uri.host, uri.port)
54
54
  http_conn.use_ssl = @options[:use_ssl]
55
55
  if @options[:use_client_cert]
56
- http_conn.cert = @options[:cert]
57
- http_conn.key = @options[:key]
56
+ http_conn.cert = @options[:ssl_client_cert]
57
+ http_conn.key = @options[:ssl_client_key]
58
58
  end
59
59
  http_conn.verify_mode = @options[:ssl_verify_mode]
60
60
  http_conn.ssl_version = @options[:ssl_version] if @options[:ssl_version]
@@ -38,6 +38,8 @@ module JIRA
38
38
  @options[:request_token_path] = @options[:context_path] + @options[:request_token_path]
39
39
  @options[:authorize_path] = @options[:context_path] + @options[:authorize_path]
40
40
  @options[:access_token_path] = @options[:context_path] + @options[:access_token_path]
41
+ # proxy_address does not exist in oauth's gem context but proxy does
42
+ @options[:proxy] = @options[:proxy_address] if @options[:proxy_address]
41
43
  OAuth::Consumer.new(@options[:consumer_key], @options[:consumer_secret], @options)
42
44
  end
43
45
 
@@ -18,7 +18,7 @@ module JIRA
18
18
 
19
19
  # Cannot retrieve more than 1,000 users through the api, please see: https://jira.atlassian.com/browse/JRASERVER-65089
20
20
  def self.all(client)
21
- response = client.get("/rest/api/2/user/search?username=_&maxResults=#{MAX_RESULTS}")
21
+ response = client.get("/rest/api/2/users/search?username=_&maxResults=#{MAX_RESULTS}")
22
22
  all_users = JSON.parse(response.body)
23
23
 
24
24
  all_users.flatten.uniq.map do |user|
@@ -1,3 +1,3 @@
1
1
  module JIRA
2
- VERSION = '2.1.0'.freeze
2
+ VERSION = '2.1.5'.freeze
3
3
  end
@@ -21,18 +21,18 @@ describe JIRA::Resource::User do
21
21
  describe '#all' do
22
22
  let(:client) do
23
23
  client = double(options: { rest_base_path: '/jira/rest/api/2' })
24
- allow(client).to receive(:get).with('/rest/api/2/user/search?username=_&maxResults=1000').and_return(JIRA::Resource::UserFactory.new(client))
24
+ allow(client).to receive(:get).with('/rest/api/2/users/search?username=_&maxResults=1000').and_return(JIRA::Resource::UserFactory.new(client))
25
25
  client
26
26
  end
27
27
 
28
28
  before do
29
29
  allow(client).to receive(:get)
30
- .with('/rest/api/2/user/search?username=_&maxResults=1000') { OpenStruct.new(body: '["User1"]') }
30
+ .with('/rest/api/2/users/search?username=_&maxResults=1000') { OpenStruct.new(body: '["User1"]') }
31
31
  allow(client).to receive_message_chain(:User, :build).with('users') { [] }
32
32
  end
33
33
 
34
34
  it 'gets users with maxResults of 1000' do
35
- expect(client).to receive(:get).with('/rest/api/2/user/search?username=_&maxResults=1000')
35
+ expect(client).to receive(:get).with('/rest/api/2/users/search?username=_&maxResults=1000')
36
36
  expect(client).to receive_message_chain(:User, :build).with('User1')
37
37
  JIRA::Resource::User.all(client)
38
38
  end
@@ -59,6 +59,19 @@ RSpec.shared_examples 'Client Common Tests' do
59
59
  expect(subject.Project.find('123')).to eq(find_result)
60
60
  end
61
61
  end
62
+
63
+ describe 'SSL client options' do
64
+ context 'without certificate and key' do
65
+ let(:options) { { use_client_cert: true } }
66
+ subject { JIRA::Client.new(options) }
67
+
68
+ it 'raises an ArgumentError' do
69
+ expect { subject }.to raise_exception(ArgumentError, 'Options: :cert_path or :ssl_client_cert must be set when :use_client_cert is true')
70
+ options[:ssl_client_cert] = '<cert></cert>'
71
+ expect { subject }.to raise_exception(ArgumentError, 'Options: :key_path or :ssl_client_key must be set when :use_client_cert is true')
72
+ end
73
+ end
74
+ end
62
75
  end
63
76
 
64
77
  RSpec.shared_examples 'HttpClient tests' do
@@ -280,8 +280,8 @@ describe JIRA::HttpClient do
280
280
  expect(http_conn).to receive(:use_ssl=).with(basic_client.options[:use_ssl])
281
281
  expect(http_conn).to receive(:verify_mode=).with(basic_client.options[:ssl_verify_mode])
282
282
  expect(http_conn).to receive(:read_timeout=).with(basic_client.options[:read_timeout])
283
- expect(http_conn).to receive(:cert=).with(basic_client_cert_client.options[:cert])
284
- expect(http_conn).to receive(:key=).with(basic_client_cert_client.options[:key])
283
+ expect(http_conn).to receive(:cert=).with(basic_client_cert_client.options[:ssl_client_cert])
284
+ expect(http_conn).to receive(:key=).with(basic_client_cert_client.options[:ssl_client_key])
285
285
  expect(basic_client_cert_client.http_conn(uri)).to eq(http_conn)
286
286
  end
287
287
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jira-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - SUMO Heavy Industries
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-07-03 00:00:00.000000000 Z
12
+ date: 2021-01-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -57,42 +57,42 @@ dependencies:
57
57
  name: oauth
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: 0.5.0
63
60
  - - "~>"
64
61
  - !ruby/object:Gem::Version
65
62
  version: '0.5'
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: 0.5.0
66
66
  type: :runtime
67
67
  prerelease: false
68
68
  version_requirements: !ruby/object:Gem::Requirement
69
69
  requirements:
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- version: 0.5.0
73
70
  - - "~>"
74
71
  - !ruby/object:Gem::Version
75
72
  version: '0.5'
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 0.5.0
76
76
  - !ruby/object:Gem::Dependency
77
77
  name: guard
78
78
  requirement: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: 2.13.0
83
80
  - - "~>"
84
81
  - !ruby/object:Gem::Version
85
82
  version: '2.13'
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: 2.13.0
86
86
  type: :development
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
89
89
  requirements:
90
- - - ">="
91
- - !ruby/object:Gem::Version
92
- version: 2.13.0
93
90
  - - "~>"
94
91
  - !ruby/object:Gem::Version
95
92
  version: '2.13'
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: 2.13.0
96
96
  - !ruby/object:Gem::Dependency
97
97
  name: guard-rspec
98
98
  requirement: !ruby/object:Gem::Requirement
@@ -171,42 +171,42 @@ dependencies:
171
171
  name: rspec
172
172
  requirement: !ruby/object:Gem::Requirement
173
173
  requirements:
174
- - - ">="
175
- - !ruby/object:Gem::Version
176
- version: 3.0.0
177
174
  - - "~>"
178
175
  - !ruby/object:Gem::Version
179
176
  version: '3.0'
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ version: 3.0.0
180
180
  type: :development
181
181
  prerelease: false
182
182
  version_requirements: !ruby/object:Gem::Requirement
183
183
  requirements:
184
- - - ">="
185
- - !ruby/object:Gem::Version
186
- version: 3.0.0
187
184
  - - "~>"
188
185
  - !ruby/object:Gem::Version
189
186
  version: '3.0'
187
+ - - ">="
188
+ - !ruby/object:Gem::Version
189
+ version: 3.0.0
190
190
  - !ruby/object:Gem::Dependency
191
191
  name: webmock
192
192
  requirement: !ruby/object:Gem::Requirement
193
193
  requirements:
194
- - - ">="
195
- - !ruby/object:Gem::Version
196
- version: 1.18.0
197
194
  - - "~>"
198
195
  - !ruby/object:Gem::Version
199
196
  version: '1.18'
197
+ - - ">="
198
+ - !ruby/object:Gem::Version
199
+ version: 1.18.0
200
200
  type: :development
201
201
  prerelease: false
202
202
  version_requirements: !ruby/object:Gem::Requirement
203
203
  requirements:
204
- - - ">="
205
- - !ruby/object:Gem::Version
206
- version: 1.18.0
207
204
  - - "~>"
208
205
  - !ruby/object:Gem::Version
209
206
  version: '1.18'
207
+ - - ">="
208
+ - !ruby/object:Gem::Version
209
+ version: 1.18.0
210
210
  description: API for JIRA
211
211
  email:
212
212
  executables: []
@@ -385,7 +385,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
385
385
  - !ruby/object:Gem::Version
386
386
  version: '0'
387
387
  requirements: []
388
- rubygems_version: 3.0.3
388
+ rubygems_version: 3.1.2
389
389
  signing_key:
390
390
  specification_version: 4
391
391
  summary: Ruby Gem for use with the Atlassian JIRA REST API