rujira 0.1.2 → 0.1.4
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/README.md +13 -4
- data/lib/rujira/api/comment.rb +9 -0
- data/lib/rujira/api/issue.rb +30 -3
- data/lib/rujira/api/item.rb +1 -1
- data/lib/rujira/api/myself.rb +20 -0
- data/lib/rujira/api/project.rb +1 -1
- data/lib/rujira/api/search.rb +1 -1
- data/lib/rujira/api/server_info.rb +16 -0
- data/lib/rujira/entity.rb +12 -1
- data/lib/rujira/tasks/jira.rb +60 -0
- data/lib/rujira/version.rb +1 -1
- data/lib/rujira.rb +3 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da8ad0745459d377638ecda7132f7b24cebe44f73802cc5ac58e089ed8d93fda
|
4
|
+
data.tar.gz: 0e1d0d3ce944fc903b275981abf8238868579f52f5675648fb0bcff55d87ca03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15262ee9a7f5a69116a033f3fbb6e72889db11694ca5c15f5dde5e734455afac197679eeab8a3ae3ecfc4aa3da97d230dea4507d337b5c577f2160d207e13c6a
|
7
|
+
data.tar.gz: 57bf1f91fdc28d4d77f237a0a8c2efa4ac085ca2e6493bf7a354abbc952106019119487a389d1b0b33ee4923b26e0858464f88631176095db627785b2ed5d19a
|
data/README.md
CHANGED
@@ -6,20 +6,29 @@
|
|
6
6
|
|
7
7
|
## Usage in the code
|
8
8
|
|
9
|
+
name = Rujira::Api::Myself.get.name
|
9
10
|
Rujira::Api::Project.get 'ITMG'
|
10
11
|
Rujira::Api::Issue.create fields: {
|
11
12
|
project: { key: 'ITMG' },
|
12
|
-
assignee: { name: 'wilful' },
|
13
13
|
summary: 'BOT: added a new feature.',
|
14
14
|
description: 'This task was generated by the bot when creating changes in the repository.',
|
15
15
|
issuetype: { name: 'Task' },
|
16
16
|
labels: ['bot']
|
17
17
|
}
|
18
|
+
Rujira::Api::Issue.watchers 'ITMG-1', 'wilful'
|
18
19
|
Rujira::Api::Issue.get 'ITMG-1'
|
19
20
|
Rujira::Api::Search.get jql: 'project = ITMG and status IN ("To Do", "In Progress") ORDER BY issuekey',
|
20
|
-
|
21
|
-
|
22
|
-
|
21
|
+
maxResults: 10,
|
22
|
+
startAt: 0,
|
23
|
+
fields: ['id', 'key']
|
24
|
+
Rujira::Api::Issue.comment 'ITMG-1', body: 'Adding a new comment'
|
25
|
+
Rujira::Api::Issue.edit 'ITMG-1', update: {
|
26
|
+
labels:[{add: 'rujira'},{remove: 'bot'}],
|
27
|
+
},
|
28
|
+
fields: {
|
29
|
+
assignee: { name: name },
|
30
|
+
summary: 'This is a shorthand for a set operation on the summary field'
|
31
|
+
}
|
23
32
|
Rujira::Api::Issue.del 'ITMG-1'
|
24
33
|
|
25
34
|
## Testing
|
data/lib/rujira/api/issue.rb
CHANGED
@@ -7,14 +7,14 @@ module Rujira
|
|
7
7
|
class Issue < Item
|
8
8
|
def self.get(id_or_key)
|
9
9
|
entity = Entity.build do
|
10
|
-
path "
|
10
|
+
path "issue/#{id_or_key}"
|
11
11
|
end
|
12
12
|
new(entity.commit)
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.del(id_or_key)
|
16
16
|
entity = Entity.build do
|
17
|
-
path "
|
17
|
+
path "issue/#{id_or_key}"
|
18
18
|
method :DELETE
|
19
19
|
end
|
20
20
|
entity.commit
|
@@ -22,12 +22,39 @@ module Rujira
|
|
22
22
|
|
23
23
|
def self.create(**data)
|
24
24
|
entity = Entity.build do
|
25
|
-
path '
|
25
|
+
path 'issue'
|
26
26
|
method :POST
|
27
27
|
data data if data
|
28
28
|
end
|
29
29
|
new(entity.commit)
|
30
30
|
end
|
31
|
+
|
32
|
+
def self.edit(id_or_key, **data)
|
33
|
+
entity = Entity.build do
|
34
|
+
path "issue/#{id_or_key}"
|
35
|
+
method :PUT
|
36
|
+
data data
|
37
|
+
end
|
38
|
+
new(entity.commit)
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.comment(id_or_key, **data)
|
42
|
+
entity = Entity.build do
|
43
|
+
path "issue/#{id_or_key}/comment"
|
44
|
+
method :POST
|
45
|
+
data data if data
|
46
|
+
end
|
47
|
+
Comment.new(entity.commit)
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.watchers(id_or_key, data)
|
51
|
+
entity = Entity.build do
|
52
|
+
path "issue/#{id_or_key}/watchers"
|
53
|
+
method :POST
|
54
|
+
data data
|
55
|
+
end
|
56
|
+
new(entity.commit)
|
57
|
+
end
|
31
58
|
end
|
32
59
|
end
|
33
60
|
end
|
data/lib/rujira/api/item.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Rujira
|
4
|
+
module Api
|
5
|
+
# TODO
|
6
|
+
# https://docs.atlassian.com/software/jira/docs/api/REST/8.17.1/#api/2/myself
|
7
|
+
class Myself < Item
|
8
|
+
def self.get
|
9
|
+
entity = Entity.build do
|
10
|
+
path 'myself'
|
11
|
+
end
|
12
|
+
new(entity.commit)
|
13
|
+
end
|
14
|
+
|
15
|
+
def name
|
16
|
+
@data['name']
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/rujira/api/project.rb
CHANGED
data/lib/rujira/api/search.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Rujira
|
4
|
+
module Api
|
5
|
+
# TODO
|
6
|
+
# https://docs.atlassian.com/software/jira/docs/api/REST/8.17.1/#api/2/myself
|
7
|
+
class ServerInfo < Item
|
8
|
+
def self.get
|
9
|
+
entity = Entity.build do
|
10
|
+
path 'serverInfo'
|
11
|
+
end
|
12
|
+
new(entity.commit)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/rujira/entity.rb
CHANGED
@@ -5,6 +5,7 @@ module Rujira
|
|
5
5
|
class Entity
|
6
6
|
def initialize
|
7
7
|
@method = :GET
|
8
|
+
@rest_api = 'rest/api/2'
|
8
9
|
end
|
9
10
|
|
10
11
|
def self.build(&block)
|
@@ -21,7 +22,7 @@ module Rujira
|
|
21
22
|
end
|
22
23
|
|
23
24
|
def path(path = nil)
|
24
|
-
@path ||= path
|
25
|
+
@path ||= "#{@rest_api}/#{path}"
|
25
26
|
|
26
27
|
return @path if @path
|
27
28
|
|
@@ -40,6 +41,8 @@ module Rujira
|
|
40
41
|
case @method
|
41
42
|
when :GET
|
42
43
|
get.body
|
44
|
+
when :PUT
|
45
|
+
put.body
|
43
46
|
when :POST
|
44
47
|
post.body
|
45
48
|
when :DELETE
|
@@ -75,6 +78,14 @@ module Rujira
|
|
75
78
|
end
|
76
79
|
end
|
77
80
|
|
81
|
+
def put
|
82
|
+
request do
|
83
|
+
client.put path do |req|
|
84
|
+
req.body = data.to_json
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
78
89
|
def client
|
79
90
|
conn = Rujira::Connection.new
|
80
91
|
conn.run
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rake'
|
4
|
+
require 'rake/tasklib'
|
5
|
+
require 'json'
|
6
|
+
|
7
|
+
module Rujira
|
8
|
+
module Tasks
|
9
|
+
# TODO
|
10
|
+
class Jira
|
11
|
+
include ::Rake::DSL if defined?(::Rake::DSL)
|
12
|
+
|
13
|
+
def initialize
|
14
|
+
define
|
15
|
+
end
|
16
|
+
|
17
|
+
def define
|
18
|
+
whoami
|
19
|
+
url
|
20
|
+
server_info
|
21
|
+
end
|
22
|
+
|
23
|
+
def whoami
|
24
|
+
name = __method__
|
25
|
+
desc 'Request my real name in Jira'
|
26
|
+
|
27
|
+
Rake::Task[name].clear if Rake::Task.task_defined?(name)
|
28
|
+
namespace :jira do
|
29
|
+
task name do
|
30
|
+
puts Rujira::Api::Myself.get.name
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def url
|
36
|
+
name = __method__
|
37
|
+
desc 'Request server url from Jira'
|
38
|
+
|
39
|
+
Rake::Task[name].clear if Rake::Task.task_defined?(name)
|
40
|
+
namespace :jira do
|
41
|
+
task name do
|
42
|
+
puts Rujira::Configuration.url
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def server_info
|
48
|
+
name = __method__
|
49
|
+
desc 'Request server information from Jira'
|
50
|
+
|
51
|
+
Rake::Task[name].clear if Rake::Task.task_defined?(name)
|
52
|
+
namespace :jira do
|
53
|
+
task name do
|
54
|
+
puts Rujira::Api::ServerInfo.get.data.to_json
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
data/lib/rujira/version.rb
CHANGED
data/lib/rujira.rb
CHANGED
@@ -10,6 +10,9 @@ require_relative 'rujira/api/item'
|
|
10
10
|
require_relative 'rujira/api/search'
|
11
11
|
require_relative 'rujira/api/issue'
|
12
12
|
require_relative 'rujira/api/project'
|
13
|
+
require_relative 'rujira/api/comment'
|
14
|
+
require_relative 'rujira/api/myself'
|
15
|
+
require_relative 'rujira/api/server_info'
|
13
16
|
|
14
17
|
module Rujira
|
15
18
|
class Error < StandardError; end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rujira
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Semenov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-04-
|
11
|
+
date: 2024-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: The library is developed for the purposes of the organization, new features
|
14
14
|
can be added as MR. Welcome!
|
@@ -25,13 +25,17 @@ files:
|
|
25
25
|
- Rakefile
|
26
26
|
- compose.yaml
|
27
27
|
- lib/rujira.rb
|
28
|
+
- lib/rujira/api/comment.rb
|
28
29
|
- lib/rujira/api/issue.rb
|
29
30
|
- lib/rujira/api/item.rb
|
31
|
+
- lib/rujira/api/myself.rb
|
30
32
|
- lib/rujira/api/project.rb
|
31
33
|
- lib/rujira/api/search.rb
|
34
|
+
- lib/rujira/api/server_info.rb
|
32
35
|
- lib/rujira/configuration.rb
|
33
36
|
- lib/rujira/connection.rb
|
34
37
|
- lib/rujira/entity.rb
|
38
|
+
- lib/rujira/tasks/jira.rb
|
35
39
|
- lib/rujira/version.rb
|
36
40
|
- sig/rujira.rbs
|
37
41
|
homepage: https://github.com/itmagelabs/rujira
|