rujira 0.3.4 → 0.4.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: 8b6d18c441bf30cd86f00a38ccb4a2be266fdbc3aa312f607292d6a7d25d0a26
4
- data.tar.gz: 326fb2ea52c1cb8f41f0c7ecfb9e511b325315c6f0bc89df5bc4a8ce4f13edb6
3
+ metadata.gz: d0134685b3295946f3e1ae11f3f8f60cb7ef438d67d6c6c93efdf48419f46799
4
+ data.tar.gz: 3d7503722d60837598dbf4cf938825cf44d8dea497cc5b40d87337887cf43536
5
5
  SHA512:
6
- metadata.gz: 4a3c6713caa660260b313a2cd6f3727ba831a7ace828a2fa1f55ae9e827b31a18854abd9f66c06014f07845dd12cbe439bd70d4c4d78ea5f40a847bd0fffe5cb
7
- data.tar.gz: '0498ad7989466f66ddb76bd02e793e5ac2905d843db1101f14a3502487bb2efd51effa7f9836c51cf51a8ae4bf5173557daa6ab07b893cd9ad78370bd4aa0c9d'
6
+ metadata.gz: 0cfb4598d5b97fbde72b2fef4bf3d2521b4a4009dc979242faa4db7da98673d13a0b8e65466cb815561e04cdce9cba6d1c353dae7403b6e4f26cca5ee924e0ed
7
+ data.tar.gz: 2668993188f71529679ffa8812216729932d161f2def80f4df0566dc31023aad2b293b2539783394bc67e39a6bfd2d81cdc4785a00e6d766772c8b541707e114
data/CHANGELOG.md CHANGED
@@ -1,8 +1,27 @@
1
- ## [0.3.4] - 2025-09-13
1
+ ## [0.4.0] - 2025-09-13
2
+
3
+ ### 🚀 Features
4
+
5
+ - Extend Issue #2
6
+ - Extend Issue
7
+ - Added Filter
8
+ - Extend Avatar, Configuration, CustomFields, Field
9
+ - Extend Attachments
10
+ - Added ApplicationRole
11
+ - Added ApplicationProperties
12
+ - Added permissions api
2
13
 
3
14
  ### 🐛 Bug Fixes
4
15
 
5
16
  - Fix for tasks
17
+
18
+ ### 🚜 Refactor
19
+
20
+ - Dont raising for faraday
21
+ - Cleanup attachments
22
+ - Split issue #3
23
+ - Split issue #2
24
+ - Split issue
6
25
  ## [0.3.3] - 2025-09-13
7
26
 
8
27
  ### 📚 Documentation
@@ -59,30 +78,8 @@
59
78
  - Update README
60
79
  ## [0.1.15] - 2025-09-11
61
80
 
62
- ### 🚀 Features
63
-
64
- - Added dotenv
65
- - Update a gems
66
- - Example of generation url
67
-
68
- ### 🐛 Bug Fixes
69
-
70
- - No test in CI
71
-
72
81
  ### 🚜 Refactor
73
82
 
74
83
  - Docs
75
84
  - BUILDER
76
85
  - RAKE TASKS
77
-
78
- ### 📚 Documentation
79
-
80
- - Fix a readme
81
-
82
- ### Hotfix
83
-
84
- - Remove debug line
85
-
86
- ### Reafactor
87
-
88
- - Full
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rujira
4
+ module Api
5
+ # Provides access to Jira application properties via the REST API.
6
+ # Allows listing, retrieving, updating, and accessing advanced settings.
7
+ #
8
+ # API reference:
9
+ # https://docs.atlassian.com/software/jira/docs/api/REST/9.17.0/#api/2/application-properties
10
+ #
11
+ class ApplicationProperties < Common
12
+ # Retrieves all application properties.
13
+ #
14
+ # @yield [builder] Optional block to configure the request.
15
+ # @return [Object] The API response containing all properties.
16
+ #
17
+ # @example List all application properties
18
+ # client.application_properties.list
19
+ #
20
+ def list
21
+ builder do
22
+ path 'application-properties'
23
+ end
24
+ run
25
+ end
26
+
27
+ alias get list
28
+
29
+ # Updates a specific application property.
30
+ #
31
+ # @param [String] id The property ID to update.
32
+ # @yield [builder] Block to configure the payload.
33
+ # @return [Object] The API response after updating the property.
34
+ #
35
+ # @example Update an application property
36
+ # client.application_properties.set("jira.option.someFeature") do
37
+ # payload value: true
38
+ # end
39
+ #
40
+ def set(id, &block)
41
+ builder do
42
+ method :put
43
+ path "application-properties/#{id}"
44
+ instance_eval(&block) if block_given?
45
+ end
46
+ run
47
+ end
48
+
49
+ # Retrieves advanced application settings.
50
+ #
51
+ # @yield [builder] Optional block to configure the request.
52
+ # @return [Object] The API response containing advanced settings.
53
+ #
54
+ # @example Get advanced settings
55
+ # client.application_properties.advanced_settings
56
+ #
57
+ def advanced_settings
58
+ builder do
59
+ path 'application-properties/advanced-settings'
60
+ end
61
+ run
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,85 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rujira
4
+ module Api
5
+ # Provides access to Jira application roles via the REST API.
6
+ # Allows listing, retrieving, and updating application roles.
7
+ #
8
+ # API reference:
9
+ # https://docs.atlassian.com/software/jira/docs/api/REST/9.17.0/#api/2/applicationrole
10
+ #
11
+ class ApplicationRole < Common
12
+ # Updates multiple application roles in bulk.
13
+ #
14
+ # @yield [builder] Block to configure the payload for bulk update.
15
+ # @return [Object] The API response after updating roles.
16
+ #
17
+ # @example Bulk update roles
18
+ # client.Application_role.put_bulk do
19
+ # payload [
20
+ # { key: "jira-software-users", groups: ["jira-users"] },
21
+ # { key: "jira-administrators", groups: ["admins"] }
22
+ # ]
23
+ # end
24
+ #
25
+ def put_bulk(&block)
26
+ builder do
27
+ method :put
28
+ path 'applicationrole'
29
+ instance_eval(&block) if block_given?
30
+ end
31
+ run
32
+ end
33
+
34
+ # Lists all application roles.
35
+ #
36
+ # @yield [builder] Optional block to configure the request.
37
+ # @return [Object] The API response containing all application roles.
38
+ #
39
+ # @example List all application roles
40
+ # client.Application_role.list
41
+ #
42
+ def list
43
+ builder do
44
+ path 'applicationrole'
45
+ end
46
+ run
47
+ end
48
+
49
+ # Retrieves a specific application role by key.
50
+ #
51
+ # @param [String] key The key of the application role.
52
+ # @return [Object] The API response containing role details.
53
+ #
54
+ # @example Get a role
55
+ # client.Application_role.get("jira-software-users")
56
+ #
57
+ def get(key)
58
+ builder do
59
+ path "applicationrole/#{key}"
60
+ end
61
+ run
62
+ end
63
+
64
+ # Updates a specific application role by key.
65
+ #
66
+ # @param [String] key The key of the application role to update.
67
+ # @yield [builder] Block to configure the payload for update.
68
+ # @return [Object] The API response after updating the role.
69
+ #
70
+ # @example Update a role
71
+ # client.Application_role.put("jira-software-users") do
72
+ # payload groups: ["jira-users", "new-group"]
73
+ # end
74
+ #
75
+ def put(key, &block)
76
+ builder do
77
+ method :put
78
+ path "applicationrole/#{key}"
79
+ instance_eval(&block) if block_given?
80
+ end
81
+ run
82
+ end
83
+ end
84
+ end
85
+ end
@@ -7,22 +7,50 @@ module Rujira
7
7
  # Example: Attach a file to an issue by calling `create("ISSUE-123", "/path/to/file")`.
8
8
  # https://docs.atlassian.com/software/jira/docs/api/REST/9.17.0/#api/2/issue/%7BissueIdOrKey%7D/attachments
9
9
  class Attachments < Common
10
- # Uploads a file as an attachment to the specified Jira issue.
10
+ # Retrieves a specific attachment by ID.
11
11
  #
12
- # @param [String] id_or_key The issue ID or key to which the file will be attached.
13
- # @param [String] path The local file path of the attachment to upload.
14
- # @yield [builder] Optional block to customize the request builder.
15
- # @return [Object] The API response after executing the request.
12
+ # @param [String] id The attachment ID.
13
+ # @return [Object] The API response containing attachment details.
16
14
  #
17
- def create(id_or_key, path, &block)
18
- abort 'Issue ID or KEY is required' if id_or_key.to_s.strip.empty?
19
- client = @client
15
+ # @example Get an attachment
16
+ # client.attachments.get("10001")
17
+ #
18
+ def get(id)
19
+ abort 'Attachment ID is required' if id.to_s.strip.empty?
20
+ builder do
21
+ path "attachment/#{id}"
22
+ end
23
+ run
24
+ end
25
+
26
+ # Deletes a specific attachment by ID.
27
+ #
28
+ # @param [String] id The attachment ID.
29
+ # @return [Object] The API response after deletion.
30
+ #
31
+ # @example Delete an attachment
32
+ # client.attachments.delete("10001")
33
+ #
34
+ def delete(id)
35
+ abort 'Attachment ID is required' if id.to_s.strip.empty?
36
+ builder do
37
+ method :delete
38
+ path "attachment/#{id}"
39
+ end
40
+ run
41
+ end
42
+
43
+ # Retrieves metadata for attachments.
44
+ #
45
+ # @yield [builder] Optional block to configure the request.
46
+ # @return [Object] The API response containing attachment metadata.
47
+ #
48
+ # @example Get attachment metadata
49
+ # client.attachments.meta
50
+ #
51
+ def meta
20
52
  builder do
21
- path "issue/#{id_or_key}/attachments"
22
- method :post
23
- headers 'X-Atlassian-Token': 'no-check'
24
- payload file: client.file(path)
25
- instance_eval(&block) if block_given?
53
+ path 'attachment/meta'
26
54
  end
27
55
  run
28
56
  end
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rujira
4
+ module Api
5
+ # Provides access to Jira avatars via the REST API.
6
+ # Allows retrieving system avatars, uploading temporary avatars, and cropping them.
7
+ #
8
+ # API reference:
9
+ # https://docs.atlassian.com/software/jira/docs/api/REST/9.17.0/#api/2/avatar
10
+ #
11
+ class Avatar < Common
12
+ # Retrieves all system avatars of a given type.
13
+ #
14
+ # @param [String] type The type of avatar (e.g., "project", "user").
15
+ # @return [Object] The API response containing system avatars.
16
+ #
17
+ # @example Get system avatars for projects
18
+ # client.Avatar.get("project")
19
+ #
20
+ def get(type)
21
+ builder do
22
+ path "avatar/#{type}/system"
23
+ end
24
+ run
25
+ end
26
+
27
+ # Uploads a temporary avatar for a given type.
28
+ #
29
+ # @param [String] type The type of avatar (e.g., "project", "user").
30
+ # @yield [builder] Block to configure the payload, usually including the file.
31
+ # @return [Object] The API response after uploading the temporary avatar.
32
+ #
33
+ # @example Upload a temporary avatar
34
+ # client.Avatar.store("project") do
35
+ # payload file: client.file("/path/to/avatar.png")
36
+ # end
37
+ #
38
+ def store(type, &block)
39
+ builder do
40
+ method :post
41
+ path "avatar/#{type}/temporary"
42
+ instance_eval(&block) if block_given?
43
+ end
44
+ run
45
+ end
46
+
47
+ # Crops a previously uploaded temporary avatar.
48
+ #
49
+ # @param [String] type The type of avatar (e.g., "project", "user").
50
+ # @yield [builder] Block to configure crop parameters.
51
+ # @return [Object] The API response after cropping the avatar.
52
+ #
53
+ # @example Crop a temporary avatar
54
+ # client.Avatar.crop("project") do
55
+ # payload { x: 0, y: 0, width: 48, height: 48 }
56
+ # end
57
+ #
58
+ def crop(type, &block)
59
+ builder do
60
+ method :post
61
+ path "avatar/#{type}/temporaryCrop"
62
+ instance_eval(&block) if block_given?
63
+ end
64
+ run
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rujira
4
+ module Api
5
+ # Provides access to Jira configuration settings via the REST API.
6
+ #
7
+ # API reference:
8
+ # https://docs.atlassian.com/software/jira/docs/api/REST/9.17.0/#api/2/configuration
9
+ #
10
+ class Configuration < Common
11
+ # Retrieves the current Jira configuration.
12
+ #
13
+ # @yield [builder] Optional block to configure the request.
14
+ # @return [Object] The API response containing configuration details.
15
+ #
16
+ # @example Get Jira configuration
17
+ # client.Configuration.get
18
+ #
19
+ def get
20
+ builder do
21
+ path 'configuration'
22
+ end
23
+ run
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rujira
4
+ module Api
5
+ # Provides access to Jira custom fields via the REST API.
6
+ # Allows retrieving and deleting custom fields.
7
+ #
8
+ # API reference:
9
+ # https://docs.atlassian.com/software/jira/docs/api/REST/9.17.0/#api/2/customFields
10
+ #
11
+ class CustomFields < Common
12
+ # Retrieves all custom fields.
13
+ #
14
+ # @yield [builder] Optional block to configure the request.
15
+ # @return [Object] The API response containing all custom fields.
16
+ #
17
+ # @example Get all custom fields
18
+ # client.CustomFields.get
19
+ #
20
+ def get
21
+ builder do
22
+ path 'customFields'
23
+ end
24
+ run
25
+ end
26
+
27
+ # Deletes custom fields based on provided parameters.
28
+ #
29
+ # @yield [builder] Block to configure the deletion payload or parameters.
30
+ # @return [Object] The API response after deletion.
31
+ #
32
+ # @example Delete custom fields
33
+ # client.CustomFields.delete do
34
+ # payload fieldIds: ["customfield_10001", "customfield_10002"]
35
+ # end
36
+ #
37
+ def delete(&block)
38
+ builder do
39
+ method :delete
40
+ path 'customFields'
41
+ instance_eval(&block) if block_given?
42
+ end
43
+ run
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rujira
4
+ module Api
5
+ # Provides access to Jira fields via the REST API.
6
+ # Allows listing all fields and creating new fields.
7
+ #
8
+ # API reference:
9
+ # https://docs.atlassian.com/software/jira/docs/api/REST/9.17.0/#api/2/field
10
+ #
11
+ class Field < Common
12
+ # Retrieves all fields.
13
+ #
14
+ # @yield [builder] Optional block to configure the request.
15
+ # @return [Object] The API response containing all fields.
16
+ #
17
+ # @example List all fields
18
+ # client.Field.get
19
+ # client.Field.list
20
+ #
21
+ def list
22
+ builder do
23
+ path 'field'
24
+ end
25
+ run
26
+ end
27
+ alias get list
28
+
29
+ # Creates a new field.
30
+ #
31
+ # @yield [builder] Block to configure the payload for the new field.
32
+ # @return [Object] The API response after creating the field.
33
+ #
34
+ # @example Create a custom field
35
+ # client.Field.create do
36
+ # payload name: "My Field", type: "com.atlassian.jira.plugin.system.customfieldtypes:textfield"
37
+ # end
38
+ #
39
+ def create(&block)
40
+ builder do
41
+ method :post
42
+ path 'field'
43
+ instance_eval(&block) if block_given?
44
+ end
45
+ run
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,223 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rujira
4
+ module Api
5
+ # Provides access to Jira filters via the REST API.
6
+ # Allows creating, editing, deleting, retrieving filters,
7
+ # managing filter columns, permissions, and favorite/default settings.
8
+ #
9
+ # API reference:
10
+ # https://docs.atlassian.com/software/jira/docs/api/REST/9.17.0/#api/2/filter
11
+ #
12
+ class Filter < Common
13
+ # Creates a new filter.
14
+ #
15
+ # @yield [builder] Block to configure the payload for the new filter.
16
+ # @return [Object] The API response after creating the filter.
17
+ #
18
+ # @example Create a filter
19
+ # client.Filter.create do
20
+ # payload name: "My Filter", jql: "project = TEST", favourite: true
21
+ # end
22
+ #
23
+ def create(&block)
24
+ builder do
25
+ method :post
26
+ path 'filter'
27
+ instance_eval(&block) if block_given?
28
+ end
29
+ run
30
+ end
31
+
32
+ # Updates an existing filter by ID.
33
+ #
34
+ # @param [String] id The filter ID.
35
+ # @yield [builder] Block to configure the payload for update.
36
+ # @return [Object] The API response after editing the filter.
37
+ #
38
+ # @example Edit a filter
39
+ # client.Filter.edit("10001") do
40
+ # payload name: "Updated Filter Name"
41
+ # end
42
+ #
43
+ def edit(id, &block)
44
+ builder do
45
+ method :put
46
+ path "filter/#{id}"
47
+ instance_eval(&block) if block_given?
48
+ end
49
+ run
50
+ end
51
+
52
+ # Deletes a filter by ID.
53
+ #
54
+ # @param [String] id The filter ID.
55
+ # @return [Object] The API response after deletion.
56
+ #
57
+ def delete(id)
58
+ builder do
59
+ method :delete
60
+ path "filter/#{id}"
61
+ end
62
+ run
63
+ end
64
+
65
+ # Retrieves a filter by ID.
66
+ #
67
+ # @param [String] id The filter ID.
68
+ # @return [Object] The API response containing filter details.
69
+ #
70
+ def get(id)
71
+ builder do
72
+ path "filter/#{id}"
73
+ end
74
+ run
75
+ end
76
+
77
+ # Retrieves columns configuration of a filter.
78
+ #
79
+ # @param [String] id The filter ID.
80
+ # @return [Object] The API response with columns configuration.
81
+ #
82
+ def columns(id)
83
+ builder do
84
+ path "filter/#{id}/columns"
85
+ end
86
+ run
87
+ end
88
+
89
+ # Updates columns configuration of a filter.
90
+ #
91
+ # @param [String] id The filter ID.
92
+ # @yield [builder] Block to configure the payload for columns.
93
+ # @return [Object] The API response after updating columns.
94
+ #
95
+ # @example Set columns for a filter
96
+ # client.Filter.set_columns("10001") do
97
+ # payload ["summary", "assignee", "status"]
98
+ # end
99
+ #
100
+ def set_columns(id, &block)
101
+ builder do
102
+ method :put
103
+ path "filter/#{id}/columns"
104
+ instance_eval(&block) if block_given?
105
+ end
106
+ run
107
+ end
108
+
109
+ # Resets columns of a filter to default.
110
+ #
111
+ # @param [String] id The filter ID.
112
+ # @return [Object] The API response after resetting columns.
113
+ #
114
+ def reset_columns(id)
115
+ builder do
116
+ method :delete
117
+ path "filter/#{id}/columns"
118
+ end
119
+ run
120
+ end
121
+
122
+ # Lists permissions of a filter.
123
+ #
124
+ # @param [String] id The filter ID.
125
+ # @return [Object] The API response containing permissions.
126
+ #
127
+ def list_permission(id)
128
+ builder do
129
+ path "filter/#{id}/permission"
130
+ end
131
+ run
132
+ end
133
+
134
+ # Adds a permission to a filter.
135
+ #
136
+ # @param [String] id The filter ID.
137
+ # @yield [builder] Block to configure the permission payload.
138
+ # @return [Object] The API response after adding permission.
139
+ #
140
+ # @example Add permission to a filter
141
+ # client.Filter.add_permission("10001") do
142
+ # payload type: "group", groupname: "jira-users"
143
+ # end
144
+ #
145
+ def add_permission(id, &block)
146
+ builder do
147
+ method :post
148
+ path "filter/#{id}/permission"
149
+ instance_eval(&block) if block_given?
150
+ end
151
+ run
152
+ end
153
+
154
+ # Retrieves a specific permission of a filter.
155
+ #
156
+ # @param [String] id The filter ID.
157
+ # @param [String] permission_id The permission ID.
158
+ # @return [Object] The API response containing the permission details.
159
+ #
160
+ def permission(id, permission_id)
161
+ builder do
162
+ path "filter/#{id}/permission/#{permission_id}"
163
+ end
164
+ run
165
+ end
166
+
167
+ # Deletes a specific permission of a filter.
168
+ #
169
+ # @param [String] id The filter ID.
170
+ # @param [String] permission_id The permission ID.
171
+ # @return [Object] The API response after deletion.
172
+ #
173
+ def delete_permission(id, permission_id)
174
+ builder do
175
+ method :delete
176
+ path "filter/#{id}/permission/#{permission_id}"
177
+ end
178
+ run
179
+ end
180
+
181
+ # Retrieves the default share scope of filters.
182
+ #
183
+ # @return [Object] The API response with default share scope.
184
+ #
185
+ def default_share_scope
186
+ builder do
187
+ path 'filter/defaultShareScope'
188
+ end
189
+ run
190
+ end
191
+
192
+ # Updates the default share scope of filters.
193
+ #
194
+ # @yield [builder] Block to configure the payload.
195
+ # @return [Object] The API response after updating default share scope.
196
+ #
197
+ # @example Set default share scope
198
+ # client.Filter.set_default_share_scope do
199
+ # payload type: "PROJECT", projectId: "10000"
200
+ # end
201
+ #
202
+ def set_default_share_scope(&block)
203
+ builder do
204
+ method :put
205
+ path 'filter/defaultShareScope'
206
+ instance_eval(&block) if block_given?
207
+ end
208
+ run
209
+ end
210
+
211
+ # Retrieves favorite filters.
212
+ #
213
+ # @return [Object] The API response containing favorite filters.
214
+ #
215
+ def favourite
216
+ builder do
217
+ path 'filter/favourite'
218
+ end
219
+ run
220
+ end
221
+ end
222
+ end
223
+ end