jira-ruby 2.1.5 → 2.2.0

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: 293138e5626828e965e7862b82752fdcdc28a7f063b5e335dbcc1017f0ff371e
4
- data.tar.gz: 8172bc08099f9a44bae653c69e347eab2356acbaa1df3aa001e5baa38b4e60fa
3
+ metadata.gz: 95a9c55b6f750bc29bdb34f6af24b252bbbf04317ca31ed9e76753a4c257f465
4
+ data.tar.gz: 56e109f946831308a8a7b30c699ebd5b6b5805c5724e3ec47ba3ac252d2df0f2
5
5
  SHA512:
6
- metadata.gz: 699f1f8410ab65069f4f0a569bf8c2d2f4ec5903f0487ee075014be3ba48dc940efa1b0ccace8523418b9199c18c0eb3cd4d9aa1dd3c3f5d6dcf14c460583211
7
- data.tar.gz: d0c35fcd9ccf3dfce329809588ae3d245447d942167097a3f5aafe28e5dc253c39eb468166bcbf53d4dca0dd2a22882b103e7114917fd80b3a5696532741a6a8
6
+ metadata.gz: ba00e2efe10f65d2804c2c556774abab8c94d1fa746ca6c681cc7a967809bbb6309000b183049cdb9f8117dc2c8f0f60e22cbd77e6973736c7ca621989977509
7
+ data.tar.gz: bcfad2a8bcc354211e860ef7912eaedd202f189ccbedb03679032468d85425cc134d9e69dc1f4f8f4b0b238fa761cddbe21683e256379aafe29a1ca4d9d8a743
data/example.rb CHANGED
@@ -166,6 +166,14 @@ client.Issue.jql(a_normal_jql_search, max_results: 500)
166
166
  # # --------------------------
167
167
  # issue.comments.first.save({"body" => "an updated comment frome example.rb"})
168
168
 
169
+
170
+ # # Add attachment to Issue
171
+ # # ------------------------
172
+ # issue = client.Issue.find('PROJ-1')
173
+ # attachment = issue.attachments.build
174
+ # attachment.save('file': '/path/to/file')
175
+ #
176
+
169
177
  # List all available link types
170
178
  # ------------------------------
171
179
  pp client.Issuelinktype.all
data/lib/jira/client.rb CHANGED
@@ -257,6 +257,10 @@ module JIRA
257
257
  JIRA::Resource::IssuelinktypeFactory.new(self)
258
258
  end
259
259
 
260
+ def IssuePickerSuggestions
261
+ JIRA::Resource::IssuePickerSuggestionsFactory.new(self)
262
+ end
263
+
260
264
  def Remotelink
261
265
  JIRA::Resource::RemotelinkFactory.new(self)
262
266
  end
@@ -0,0 +1,24 @@
1
+ module JIRA
2
+ module Resource
3
+ class IssuePickerSuggestionsFactory < JIRA::BaseFactory # :nodoc:
4
+ end
5
+
6
+ class IssuePickerSuggestions < JIRA::Base
7
+ has_many :sections, class: JIRA::Resource::IssuePickerSuggestionsIssue
8
+
9
+ def self.all(client, query = '', options = { current_jql: nil, current_issue_key: nil, current_project_id: nil, show_sub_tasks: nil, show_sub_tasks_parent: nil })
10
+ url = client.options[:rest_base_path] + "/issue/picker?query=#{CGI.escape(query)}"
11
+
12
+ url << "&currentJQL=#{CGI.escape(options[:current_jql])}" if options[:current_jql]
13
+ url << "&currentIssueKey=#{CGI.escape(options[:current_issue_key])}" if options[:current_issue_key]
14
+ url << "&currentProjectId=#{CGI.escape(options[:current_project_id])}" if options[:current_project_id]
15
+ url << "&showSubTasks=#{options[:show_sub_tasks]}" if options[:show_sub_tasks]
16
+ url << "&showSubTaskParent=#{options[:show_sub_task_parent]}" if options[:show_sub_task_parent]
17
+
18
+ response = client.get(url)
19
+ json = parse_json(response.body)
20
+ client.IssuePickerSuggestions.build(json)
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,10 @@
1
+ module JIRA
2
+ module Resource
3
+ class IssuePickerSuggestionsIssueFactory < JIRA::BaseFactory # :nodoc:
4
+ end
5
+
6
+ class IssuePickerSuggestionsIssue < JIRA::Base
7
+ has_many :issues, class: JIRA::Resource::SuggestedIssue
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ module JIRA
2
+ module Resource
3
+ class SuggestedIssueFactory < JIRA::BaseFactory # :nodoc:
4
+ end
5
+
6
+ class SuggestedIssue < JIRA::Base
7
+ end
8
+ end
9
+ end
data/lib/jira/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module JIRA
2
- VERSION = '2.1.5'.freeze
2
+ VERSION = '2.2.0'.freeze
3
3
  end
data/lib/jira-ruby.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  $LOAD_PATH << __dir__
2
2
 
3
+ require 'active_support'
3
4
  require 'active_support/inflector'
4
5
  ActiveSupport::Inflector.inflections do |inflector|
5
6
  inflector.singular /status$/, 'status'
@@ -25,6 +26,9 @@ require 'jira/resource/worklog'
25
26
  require 'jira/resource/applinks'
26
27
  require 'jira/resource/issuelinktype'
27
28
  require 'jira/resource/issuelink'
29
+ require 'jira/resource/suggested_issue'
30
+ require 'jira/resource/issue_picker_suggestions_issue'
31
+ require 'jira/resource/issue_picker_suggestions'
28
32
  require 'jira/resource/remotelink'
29
33
  require 'jira/resource/sprint'
30
34
  require 'jira/resource/sprint_report'
@@ -0,0 +1,79 @@
1
+ require 'spec_helper'
2
+
3
+ describe JIRA::Resource::IssuePickerSuggestions do
4
+ let(:client) do
5
+ double('client', options: {
6
+ rest_base_path: '/jira/rest/api/2'
7
+ })
8
+ end
9
+
10
+ describe 'relationships' do
11
+ subject do
12
+ JIRA::Resource::IssuePickerSuggestions.new(client, attrs: {
13
+ 'sections' => [{ 'id' => 'hs'}, { 'id' => 'cs' }]
14
+ })
15
+ end
16
+
17
+ it 'has the correct relationships' do
18
+ expect(subject).to have_many(:sections, JIRA::Resource::IssuePickerSuggestionsIssue)
19
+ expect(subject.sections.length).to eq(2)
20
+ end
21
+ end
22
+
23
+ describe '#all' do
24
+ let(:response) { double }
25
+ let(:issue_picker_suggestions) { double }
26
+
27
+ before do
28
+ allow(response).to receive(:body).and_return('{"sections":[{"id": "cs"}]}')
29
+ allow(client).to receive(:IssuePickerSuggestions).and_return(issue_picker_suggestions)
30
+ allow(issue_picker_suggestions).to receive(:build)
31
+ end
32
+
33
+ it 'should autocomplete issues' do
34
+ allow(response).to receive(:body).and_return('{"sections":[{"id": "cs"}]}')
35
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/picker?query=query')
36
+ .and_return(response)
37
+
38
+ expect(client).to receive(:IssuePickerSuggestions).and_return(issue_picker_suggestions)
39
+ expect(issue_picker_suggestions).to receive(:build).with('sections' => [{ 'id' => 'cs' }])
40
+
41
+ JIRA::Resource::IssuePickerSuggestions.all(client, 'query')
42
+ end
43
+
44
+ it 'should autocomplete issues with current jql' do
45
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/picker?query=query&currentJQL=project+%3D+PR')
46
+ .and_return(response)
47
+
48
+ JIRA::Resource::IssuePickerSuggestions.all(client, 'query', current_jql: 'project = PR')
49
+ end
50
+
51
+ it 'should autocomplete issues with current issue jey' do
52
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/picker?query=query&currentIssueKey=PR-42')
53
+ .and_return(response)
54
+
55
+ JIRA::Resource::IssuePickerSuggestions.all(client, 'query', current_issue_key: 'PR-42')
56
+ end
57
+
58
+ it 'should autocomplete issues with current project id' do
59
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/picker?query=query&currentProjectId=PR')
60
+ .and_return(response)
61
+
62
+ JIRA::Resource::IssuePickerSuggestions.all(client, 'query', current_project_id: 'PR')
63
+ end
64
+
65
+ it 'should autocomplete issues with show sub tasks' do
66
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/picker?query=query&showSubTasks=true')
67
+ .and_return(response)
68
+
69
+ JIRA::Resource::IssuePickerSuggestions.all(client, 'query', show_sub_tasks: true)
70
+ end
71
+
72
+ it 'should autocomplete issues with show sub tasks parent' do
73
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/picker?query=query&showSubTaskParent=true')
74
+ .and_return(response)
75
+
76
+ JIRA::Resource::IssuePickerSuggestions.all(client, 'query', show_sub_task_parent: true)
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe JIRA::Resource::IssuePickerSuggestionsIssue do
4
+ let(:client) { double('client') }
5
+
6
+ describe 'relationships' do
7
+ subject do
8
+ JIRA::Resource::IssuePickerSuggestionsIssue.new(client, attrs: {
9
+ 'issues' => [{ 'id' => '1'}, { 'id' => '2' }]
10
+ })
11
+ end
12
+
13
+ it 'has the correct relationships' do
14
+ expect(subject).to have_many(:issues, JIRA::Resource::SuggestedIssue)
15
+ expect(subject.issues.length).to eq(2)
16
+ end
17
+ end
18
+ end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jira-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.5
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SUMO Heavy Industries
8
8
  - test IO
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-01-23 00:00:00.000000000 Z
12
+ date: 2021-12-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -208,7 +208,7 @@ dependencies:
208
208
  - !ruby/object:Gem::Version
209
209
  version: 1.18.0
210
210
  description: API for JIRA
211
- email:
211
+ email:
212
212
  executables: []
213
213
  extensions: []
214
214
  extra_rdoc_files: []
@@ -245,6 +245,8 @@ files:
245
245
  - lib/jira/resource/field.rb
246
246
  - lib/jira/resource/filter.rb
247
247
  - lib/jira/resource/issue.rb
248
+ - lib/jira/resource/issue_picker_suggestions.rb
249
+ - lib/jira/resource/issue_picker_suggestions_issue.rb
248
250
  - lib/jira/resource/issuelink.rb
249
251
  - lib/jira/resource/issuelinktype.rb
250
252
  - lib/jira/resource/issuetype.rb
@@ -257,6 +259,7 @@ files:
257
259
  - lib/jira/resource/sprint.rb
258
260
  - lib/jira/resource/sprint_report.rb
259
261
  - lib/jira/resource/status.rb
262
+ - lib/jira/resource/suggested_issue.rb
260
263
  - lib/jira/resource/transition.rb
261
264
  - lib/jira/resource/user.rb
262
265
  - lib/jira/resource/version.rb
@@ -299,8 +302,10 @@ files:
299
302
  - spec/jira/resource/createmeta_spec.rb
300
303
  - spec/jira/resource/field_spec.rb
301
304
  - spec/jira/resource/filter_spec.rb
305
+ - spec/jira/resource/issue_picker_suggestions_spec.rb
302
306
  - spec/jira/resource/issue_spec.rb
303
307
  - spec/jira/resource/issuelink_spec.rb
308
+ - spec/jira/resource/jira_picker_suggestions_issue_spec.rb
304
309
  - spec/jira/resource/project_factory_spec.rb
305
310
  - spec/jira/resource/project_spec.rb
306
311
  - spec/jira/resource/sprint_spec.rb
@@ -370,7 +375,7 @@ licenses:
370
375
  - MIT
371
376
  metadata:
372
377
  source_code_uri: https://github.com/sumoheavy/jira-ruby
373
- post_install_message:
378
+ post_install_message:
374
379
  rdoc_options: []
375
380
  require_paths:
376
381
  - lib
@@ -385,8 +390,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
385
390
  - !ruby/object:Gem::Version
386
391
  version: '0'
387
392
  requirements: []
388
- rubygems_version: 3.1.2
389
- signing_key:
393
+ rubygems_version: 3.1.6
394
+ signing_key:
390
395
  specification_version: 4
391
396
  summary: Ruby Gem for use with the Atlassian JIRA REST API
392
397
  test_files:
@@ -423,8 +428,10 @@ test_files:
423
428
  - spec/jira/resource/createmeta_spec.rb
424
429
  - spec/jira/resource/field_spec.rb
425
430
  - spec/jira/resource/filter_spec.rb
431
+ - spec/jira/resource/issue_picker_suggestions_spec.rb
426
432
  - spec/jira/resource/issue_spec.rb
427
433
  - spec/jira/resource/issuelink_spec.rb
434
+ - spec/jira/resource/jira_picker_suggestions_issue_spec.rb
428
435
  - spec/jira/resource/project_factory_spec.rb
429
436
  - spec/jira/resource/project_spec.rb
430
437
  - spec/jira/resource/sprint_spec.rb