rujira 0.1.1 → 0.1.3
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/myself.rb +20 -0
- data/lib/rujira/api/project.rb +1 -1
- data/lib/rujira/api/search.rb +1 -1
- data/lib/rujira/connection.rb +0 -4
- data/lib/rujira/entity.rb +12 -1
- data/lib/rujira/version.rb +1 -1
- data/lib/rujira.rb +2 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78fd0c99caf8fadbef2ae988ae8eabb606be5231e7346742efebbd72f7a0835c
|
4
|
+
data.tar.gz: 04a6184b419f51c87c3afe9d34c38161934775cb41d1d78ab5d075ab61474a2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6be3f1dcc91ab2fecd80fab1f9def511680eee6422a4170e992ec49dabeaba9146b22273a5487e3113576192ca6aad29501b1d38f6675df6f941251e56e97387
|
7
|
+
data.tar.gz: 9d534cb8e088303e3c5904fa8df26e0388f0253be179671ce6f8e207a8160472add3df8d475e58a6a914f75026dee36c7c0b8c2d925e0ee40e5f5c13d4c720d4
|
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
|
@@ -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
data/lib/rujira/connection.rb
CHANGED
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
|
data/lib/rujira/version.rb
CHANGED
data/lib/rujira.rb
CHANGED
@@ -10,6 +10,8 @@ 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'
|
13
15
|
|
14
16
|
module Rujira
|
15
17
|
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.3
|
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,8 +25,10 @@ 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
|
32
34
|
- lib/rujira/configuration.rb
|