jira-ruby 1.7.1 → 1.8.0

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: 280f02562d113b77a58fa5716f9cf9fe39fe6641893d3aecdd250caf4acf7d33
4
- data.tar.gz: f29efc88140a3381b816bcbcec7a977120610470c72b4758bf359353f69eb316
3
+ metadata.gz: 960c900089bbe802d788f2c8daa7fcfa4b004a4674598693057117a1a1bca1c1
4
+ data.tar.gz: '086f550ca45271d9390498c7a55e8ba3ea281aa74641cae693c06d014ebd144c'
5
5
  SHA512:
6
- metadata.gz: '087796061f2ef0472f91c36f64de9550ecb3f7ba6028e8ba91de43b3868e898d7ec4e82733bf31cf336f4a4fd4db9f2f89db320b9ff1db0759c303b6fcbf33ca'
7
- data.tar.gz: b7fff299ec8eac30ff10f00bf36c6c659a6f29b2ab90a6b62e8ce810167ad9188d497a57f29dd389c536a393a2f8aa9897283c24f37b93ed554e8a21140b1e3e
6
+ metadata.gz: 5e8b4e34177a1a7f20b2376b949c5bc2f86ec6e14c64a1eb6ab1f332a243164a3fad933a54a079d930f732a8f986504f9c6e2386a7e6f1f87e3692d84cf5c6a9
7
+ data.tar.gz: e6c535fcec553bf6d74447c8e44fe5d38dcaf6248ccd76f5f554a3e52cdf4270a0fdb8d0e051a9af09fd15810cbd5759e33f6f616e1560e907135fa6b71f3b11
@@ -1,7 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.3
4
3
  - 2.4
4
+ - 2.5
5
+ - 2.6
5
6
  - ruby-head
6
7
  before_script:
7
8
  - rake jira:generate_public_cert
@@ -38,6 +38,7 @@ require 'jira/resource/createmeta'
38
38
  require 'jira/resource/webhook'
39
39
  require 'jira/resource/agile'
40
40
  require 'jira/resource/board'
41
+ require 'jira/resource/board_configuration'
41
42
 
42
43
  require 'jira/request_client'
43
44
  require 'jira/oauth_client'
@@ -19,12 +19,15 @@ module JIRA
19
19
  # :consumer_key => nil,
20
20
  # :consumer_secret => nil,
21
21
  # :ssl_verify_mode => OpenSSL::SSL::VERIFY_PEER,
22
+ # :ssl_version => nil,
22
23
  # :use_ssl => true,
23
24
  # :username => nil,
24
25
  # :password => nil,
25
26
  # :auth_type => :oauth,
26
27
  # :proxy_address => nil,
27
28
  # :proxy_port => nil,
29
+ # :proxy_username => nil,
30
+ # :proxy_password => nil,
28
31
  # :additional_cookies => nil,
29
32
  # :default_headers => {}
30
33
  #
@@ -159,6 +162,10 @@ module JIRA
159
162
  JIRA::Resource::BoardFactory.new(self)
160
163
  end
161
164
 
165
+ def BoardConfiguration
166
+ JIRA::Resource::BoardConfigurationFactory.new(self)
167
+ end
168
+
162
169
  def RapidView
163
170
  JIRA::Resource::RapidViewFactory.new(self)
164
171
  end
@@ -203,10 +210,6 @@ module JIRA
203
210
  JIRA::Resource::RemotelinkFactory.new(self)
204
211
  end
205
212
 
206
- def Sprint
207
- JIRA::Resource::SprintFactory.new(self)
208
- end
209
-
210
213
  def Agile
211
214
  JIRA::Resource::AgileFactory.new(self)
212
215
  end
@@ -6,8 +6,8 @@ require 'uri'
6
6
  module JIRA
7
7
  class HttpClient < RequestClient
8
8
  DEFAULT_OPTIONS = {
9
- username: '',
10
- password: ''
9
+ username: nil,
10
+ password: nil
11
11
  }.freeze
12
12
 
13
13
  attr_reader :options
@@ -18,7 +18,7 @@ module JIRA
18
18
  end
19
19
 
20
20
  def make_cookie_auth_request
21
- body = { username: @options[:username], password: @options[:password] }.to_json
21
+ body = { username: @options[:username].to_s, password: @options[:password].to_s }.to_json
22
22
  @options.delete(:username)
23
23
  @options.delete(:password)
24
24
  make_request(:post, @options[:context_path] + '/rest/auth/1/session', body, 'Content-Type' => 'application/json')
@@ -43,7 +43,7 @@ module JIRA
43
43
 
44
44
  def http_conn(uri)
45
45
  if @options[:proxy_address]
46
- http_class = Net::HTTP::Proxy(@options[:proxy_address], @options[:proxy_port] || 80)
46
+ http_class = Net::HTTP::Proxy(@options[:proxy_address], @options[:proxy_port] || 80, @options[:proxy_username], @options[:proxy_password])
47
47
  else
48
48
  http_class = Net::HTTP
49
49
  end
@@ -54,6 +54,7 @@ module JIRA
54
54
  http_conn.key = @options[:key]
55
55
  end
56
56
  http_conn.verify_mode = @options[:ssl_verify_mode]
57
+ http_conn.ssl_version = @options[:ssl_version] if @options[:ssl_version]
57
58
  http_conn.read_timeout = @options[:read_timeout]
58
59
  http_conn
59
60
  end
@@ -46,6 +46,13 @@ module JIRA
46
46
  results.map { |issue| client.Issue.build(issue) }
47
47
  end
48
48
 
49
+ def configuration(params = {})
50
+ path = path_base(client) + "/board/#{id}/configuration"
51
+ response = client.get(url_with_query_params(path, params))
52
+ json = self.class.parse_json(response.body)
53
+ client.BoardConfiguration.build(json)
54
+ end
55
+
49
56
  # options
50
57
  # - state ~ future, active, closed, you can define multiple states separated by commas, e.g. state=active,closed
51
58
  # - maxResults ~ default: 50 (JIRA API), 1000 (this library)
@@ -0,0 +1,9 @@
1
+ module JIRA
2
+ module Resource
3
+ class BoardConfigurationFactory < JIRA::BaseFactory # :nodoc:
4
+ end
5
+
6
+ class BoardConfiguration < JIRA::Base
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module JIRA
2
- VERSION = '1.7.1'.freeze
2
+ VERSION = '1.8.0'.freeze
3
3
  end
@@ -2,12 +2,22 @@ require 'spec_helper'
2
2
 
3
3
  describe JIRA::HttpClient do
4
4
  let(:basic_client) do
5
- options = JIRA::Client::DEFAULT_OPTIONS.merge(JIRA::HttpClient::DEFAULT_OPTIONS)
5
+ options = JIRA::Client::DEFAULT_OPTIONS
6
+ .merge(JIRA::HttpClient::DEFAULT_OPTIONS)
7
+ .merge(basic_auth_credentials)
6
8
  JIRA::HttpClient.new(options)
7
9
  end
8
10
 
9
11
  let(:basic_cookie_client) do
10
- options = JIRA::Client::DEFAULT_OPTIONS.merge(JIRA::HttpClient::DEFAULT_OPTIONS).merge(use_cookies: true)
12
+ options = JIRA::Client::DEFAULT_OPTIONS
13
+ .merge(JIRA::HttpClient::DEFAULT_OPTIONS)
14
+ .merge(use_cookies: true)
15
+ .merge(basic_auth_credentials)
16
+ JIRA::HttpClient.new(options)
17
+ end
18
+
19
+ let(:custom_ssl_version_client) do
20
+ options = JIRA::Client::DEFAULT_OPTIONS.merge(JIRA::HttpClient::DEFAULT_OPTIONS).merge(ssl_version: :TLSv1_2)
11
21
  JIRA::HttpClient.new(options)
12
22
  end
13
23
 
@@ -20,10 +30,13 @@ describe JIRA::HttpClient do
20
30
  end
21
31
 
22
32
  let(:basic_cookie_client_with_additional_cookies) do
23
- options = JIRA::Client::DEFAULT_OPTIONS.merge(JIRA::HttpClient::DEFAULT_OPTIONS).merge(
24
- use_cookies: true,
25
- additional_cookies: ['sessionToken=abc123', 'internal=true']
26
- )
33
+ options = JIRA::Client::DEFAULT_OPTIONS
34
+ .merge(JIRA::HttpClient::DEFAULT_OPTIONS)
35
+ .merge(
36
+ use_cookies: true,
37
+ additional_cookies: ['sessionToken=abc123', 'internal=true']
38
+ )
39
+ .merge(basic_auth_credentials)
27
40
  JIRA::HttpClient.new(options)
28
41
  end
29
42
 
@@ -36,6 +49,26 @@ describe JIRA::HttpClient do
36
49
  JIRA::HttpClient.new(options)
37
50
  end
38
51
 
52
+ let(:basic_client_with_no_auth_credentials) do
53
+ options = JIRA::Client::DEFAULT_OPTIONS
54
+ .merge(JIRA::HttpClient::DEFAULT_OPTIONS)
55
+ JIRA::HttpClient.new(options)
56
+ end
57
+
58
+ let(:basic_auth_credentials) do
59
+ { username: 'donaldduck', password: 'supersecret' }
60
+ end
61
+
62
+ let(:proxy_client) do
63
+ options = JIRA::Client::DEFAULT_OPTIONS.merge(JIRA::HttpClient::DEFAULT_OPTIONS).merge(
64
+ proxy_address: 'proxyAddress',
65
+ proxy_port: 42,
66
+ proxy_username: 'proxyUsername',
67
+ proxy_password: 'proxyPassword'
68
+ )
69
+ JIRA::HttpClient.new(options)
70
+ end
71
+
39
72
  let(:response) do
40
73
  response = double('response')
41
74
  allow(response).to receive(:kind_of?).with(Net::HTTPSuccess).and_return(true)
@@ -159,6 +192,19 @@ describe JIRA::HttpClient do
159
192
  basic_client.make_request(:get, 'http://mydomain.com/foo', body, headers)
160
193
  end
161
194
 
195
+ it 'does not try to use basic auth if the credentials are not set' do
196
+ body = nil
197
+ headers = double
198
+ basic_auth_http_conn = double
199
+ http_request = double
200
+ expect(Net::HTTP::Get).to receive(:new).with('/foo', headers).and_return(http_request)
201
+
202
+ expect(basic_auth_http_conn).to receive(:request).with(http_request).and_return(response)
203
+ expect(http_request).not_to receive(:basic_auth)
204
+ allow(basic_client_with_no_auth_credentials).to receive(:basic_auth_http_conn).and_return(basic_auth_http_conn)
205
+ basic_client_with_no_auth_credentials.make_request(:get, '/foo', body, headers)
206
+ end
207
+
162
208
  it 'returns a URI' do
163
209
  uri = URI.parse(basic_client.options[:site])
164
210
  expect(basic_client.uri).to eq(uri)
@@ -178,6 +224,51 @@ describe JIRA::HttpClient do
178
224
  expect(basic_client.http_conn(uri)).to eq(http_conn)
179
225
  end
180
226
 
227
+ it 'sets the SSL version when one is provided' do
228
+ http_conn = double
229
+ uri = double
230
+ host = double
231
+ port = double
232
+ expect(uri).to receive(:host).and_return(host)
233
+ expect(uri).to receive(:port).and_return(port)
234
+ expect(Net::HTTP).to receive(:new).with(host, port).and_return(http_conn)
235
+ expect(http_conn).to receive(:use_ssl=).with(basic_client.options[:use_ssl]).and_return(http_conn)
236
+ expect(http_conn).to receive(:verify_mode=).with(basic_client.options[:ssl_verify_mode]).and_return(http_conn)
237
+ expect(http_conn).to receive(:ssl_version=).with(custom_ssl_version_client.options[:ssl_version]).and_return(http_conn)
238
+ expect(http_conn).to receive(:read_timeout=).with(basic_client.options[:read_timeout]).and_return(http_conn)
239
+ expect(custom_ssl_version_client.http_conn(uri)).to eq(http_conn)
240
+ end
241
+
242
+ it 'sets up a non-proxied http connection by default' do
243
+ uri = double
244
+ host = double
245
+ port = double
246
+
247
+ expect(uri).to receive(:host).and_return(host)
248
+ expect(uri).to receive(:port).and_return(port)
249
+
250
+ proxy_configuration = basic_client.http_conn(uri).class
251
+ expect(proxy_configuration.proxy_address).to be_nil
252
+ expect(proxy_configuration.proxy_port).to be_nil
253
+ expect(proxy_configuration.proxy_user).to be_nil
254
+ expect(proxy_configuration.proxy_pass).to be_nil
255
+ end
256
+
257
+ it 'sets up a proxied http connection when using proxy options' do
258
+ uri = double
259
+ host = double
260
+ port = double
261
+
262
+ expect(uri).to receive(:host).and_return(host)
263
+ expect(uri).to receive(:port).and_return(port)
264
+
265
+ proxy_configuration = proxy_client.http_conn(uri).class
266
+ expect(proxy_configuration.proxy_address).to eq(proxy_client.options[:proxy_address])
267
+ expect(proxy_configuration.proxy_port).to eq(proxy_client.options[:proxy_port])
268
+ expect(proxy_configuration.proxy_user).to eq(proxy_client.options[:proxy_username])
269
+ expect(proxy_configuration.proxy_pass).to eq(proxy_client.options[:proxy_password])
270
+ end
271
+
181
272
  it 'can use client certificates' do
182
273
  http_conn = double
183
274
  uri = double
@@ -172,4 +172,53 @@ eos
172
172
  expect(client).to receive(:Sprint).twice.and_return(JIRA::Resource::SprintFactory.new(client))
173
173
  expect(board.sprints.size).to be(2)
174
174
  end
175
+
176
+ it 'should get board configuration for a board' do
177
+ response = double
178
+
179
+ api_json = <<-eos
180
+ {
181
+ "id":1,
182
+ "name":"My Board",
183
+ "type":"kanban",
184
+ "self":"https://mycompany.atlassian.net/rest/agile/1.0/board/1/configuration",
185
+ "location":{
186
+ "type":"project",
187
+ "key":"MYPROJ",
188
+ "id":"10000",
189
+ "self":"https://mycompany.atlassian.net/rest/api/2/project/10000",
190
+ "name":"My Project"
191
+ },
192
+ "filter":{
193
+ "id":"10000",
194
+ "self":"https://mycompany.atlassian.net/rest/api/2/filter/10000"
195
+ },
196
+ "subQuery":{
197
+ "query":"resolution = EMPTY OR resolution != EMPTY AND resolutiondate >= -5d"
198
+ },
199
+ "columnConfig":{
200
+ "columns":[
201
+ {
202
+ "name":"Backlog",
203
+ "statuses":[
204
+ {
205
+ "id":"10000",
206
+ "self":"https://mycompany.atlassian.net/rest/api/2/status/10000"
207
+ }
208
+ ]
209
+ }
210
+ ],
211
+ "constraintType":"issueCount"
212
+ },
213
+ "ranking":{
214
+ "rankCustomFieldId":10011
215
+ }
216
+ }
217
+ eos
218
+ allow(response).to receive(:body).and_return(api_json)
219
+ allow(board).to receive(:id).and_return(84)
220
+ expect(client).to receive(:get).with('/rest/agile/1.0/board/84/configuration').and_return(response)
221
+ expect(client).to receive(:BoardConfiguration).and_return(JIRA::Resource::BoardConfigurationFactory.new(client))
222
+ expect(board.configuration).not_to be(nil)
223
+ end
175
224
  end
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: 1.7.1
4
+ version: 1.8.0
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: 2019-08-19 00:00:00.000000000 Z
12
+ date: 2020-03-14 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'
63
60
  - - ">="
64
61
  - !ruby/object:Gem::Version
65
62
  version: 0.5.0
63
+ - - "~>"
64
+ - !ruby/object:Gem::Version
65
+ version: '0.5'
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'
73
70
  - - ">="
74
71
  - !ruby/object:Gem::Version
75
72
  version: 0.5.0
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.5'
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'
83
80
  - - ">="
84
81
  - !ruby/object:Gem::Version
85
82
  version: 2.13.0
83
+ - - "~>"
84
+ - !ruby/object:Gem::Version
85
+ version: '2.13'
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'
93
90
  - - ">="
94
91
  - !ruby/object:Gem::Version
95
92
  version: 2.13.0
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '2.13'
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'
177
174
  - - ">="
178
175
  - !ruby/object:Gem::Version
179
176
  version: 3.0.0
177
+ - - "~>"
178
+ - !ruby/object:Gem::Version
179
+ version: '3.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'
187
184
  - - ">="
188
185
  - !ruby/object:Gem::Version
189
186
  version: 3.0.0
187
+ - - "~>"
188
+ - !ruby/object:Gem::Version
189
+ version: '3.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'
197
194
  - - ">="
198
195
  - !ruby/object:Gem::Version
199
196
  version: 1.18.0
197
+ - - "~>"
198
+ - !ruby/object:Gem::Version
199
+ version: '1.18'
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'
207
204
  - - ">="
208
205
  - !ruby/object:Gem::Version
209
206
  version: 1.18.0
207
+ - - "~>"
208
+ - !ruby/object:Gem::Version
209
+ version: '1.18'
210
210
  description: API for JIRA
211
211
  email:
212
212
  executables: []
@@ -238,6 +238,7 @@ files:
238
238
  - lib/jira/resource/applinks.rb
239
239
  - lib/jira/resource/attachment.rb
240
240
  - lib/jira/resource/board.rb
241
+ - lib/jira/resource/board_configuration.rb
241
242
  - lib/jira/resource/comment.rb
242
243
  - lib/jira/resource/component.rb
243
244
  - lib/jira/resource/createmeta.rb
@@ -384,8 +385,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
384
385
  - !ruby/object:Gem::Version
385
386
  version: '0'
386
387
  requirements: []
387
- rubyforge_project:
388
- rubygems_version: 2.7.6
388
+ rubygems_version: 3.0.3
389
389
  signing_key:
390
390
  specification_version: 4
391
391
  summary: Ruby Gem for use with the Atlassian JIRA REST API