rujira 0.4.0 → 0.5.1

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: d0134685b3295946f3e1ae11f3f8f60cb7ef438d67d6c6c93efdf48419f46799
4
- data.tar.gz: 3d7503722d60837598dbf4cf938825cf44d8dea497cc5b40d87337887cf43536
3
+ metadata.gz: ab245fcbc9d445b1ffa59c05d66e2b330375f9883d7e8949a4205af02f495824
4
+ data.tar.gz: 3f7d40b25d30fe5b6f966de78d283604f1d66c23cd9d34c3f433c5f722a7c103
5
5
  SHA512:
6
- metadata.gz: 0cfb4598d5b97fbde72b2fef4bf3d2521b4a4009dc979242faa4db7da98673d13a0b8e65466cb815561e04cdce9cba6d1c353dae7403b6e4f26cca5ee924e0ed
7
- data.tar.gz: 2668993188f71529679ffa8812216729932d161f2def80f4df0566dc31023aad2b293b2539783394bc67e39a6bfd2d81cdc4785a00e6d766772c8b541707e114
6
+ metadata.gz: c90e9d4ac246ec1c39a42dc618450bd6d8a3bda5e8095edb229919b2a5fc89d001c72a986d4c1465d9155ff64785f0439591e37fce9f79041611f231719e6a8f
7
+ data.tar.gz: ec925b95ca7d73c228cde2b543ef77eee66b049614d3665f66cdc4f7af6913b1ac041581266094daaa645c03df86c4e188a5cd3b58818b01055b4abba9ac5238
data/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ ## [0.5.1] - 2025-09-15
2
+
3
+ ### 🚜 Refactor
4
+
5
+ - Added logger
6
+ - Cleanup
7
+
8
+ ### 📚 Documentation
9
+
10
+ - Updated a doc
11
+ ## [0.5.0] - 2025-09-15
12
+
13
+ ### 🚀 Features
14
+
15
+ - Dispatchable for client
1
16
  ## [0.4.0] - 2025-09-13
2
17
 
3
18
  ### 🚀 Features
@@ -67,19 +82,3 @@
67
82
  ### Reafactor
68
83
 
69
84
  - How to search sprints
70
- ## [0.2.0] - 2025-09-11
71
-
72
- ### 🚀 Features
73
-
74
- - Added new method for API
75
-
76
- ### 📚 Documentation
77
-
78
- - Update README
79
- ## [0.1.15] - 2025-09-11
80
-
81
- ### 🚜 Refactor
82
-
83
- - Docs
84
- - BUILDER
85
- - RAKE TASKS
data/README.md CHANGED
@@ -94,14 +94,8 @@ end
94
94
  update = client.Sprint.update sprint['id'] do
95
95
  payload name: "Bot Sprint #{project}"
96
96
  end
97
-
98
- assert_equal 'Bot Sprint', sprint['name']
99
- assert_equal "Bot Sprint #{project}", update['name']
100
-
101
97
  issues = client.Sprint.get_issue sprint['id']
102
98
 
103
- assert_not_empty issues['issues']
104
-
105
99
  client.Issue.get "#{project}-1"
106
100
 
107
101
  client.Issue.watchers "#{project}-1", name
data/compose.yaml CHANGED
@@ -2,7 +2,7 @@
2
2
  services:
3
3
  jira:
4
4
  restart: always
5
- # mem_limit: 1g
5
+ mem_limit: 2g
6
6
  image: atlassian/jira-software
7
7
  environment: {}
8
8
  # JVM_SUPPORT_RECOMMENDED_ARGS: "-Datlassian.recovery.password=<PASSWORD>"
@@ -5,9 +5,11 @@ require_relative '../lib/rujira'
5
5
 
6
6
  Dotenv.load
7
7
 
8
- client = Rujira::Client.new('http://localhost:8080')
8
+ client = Rujira::Client.new('http://localhost:8080', dispatchable: true)
9
9
 
10
10
  project_name = 'EXAMPLE2'
11
+ myself = client.Myself.get
12
+
11
13
  name = client.Myself.get['name']
12
14
 
13
15
  begin
@@ -3,25 +3,41 @@
3
3
  module Rujira
4
4
  module Api
5
5
  # Provides access to Jira application properties via the REST API.
6
- # Allows listing, retrieving, updating, and accessing advanced settings.
6
+ # You can list all properties, filter them with query parameters,
7
+ # update specific properties, and access advanced settings.
7
8
  #
8
9
  # API reference:
9
10
  # https://docs.atlassian.com/software/jira/docs/api/REST/9.17.0/#api/2/application-properties
10
11
  #
11
12
  class ApplicationProperties < Common
12
- # Retrieves all application properties.
13
+ # Retrieves application properties.
13
14
  #
15
+ # @param [Hash] params Optional query parameters:
16
+ # - :key [String] Return property with a specific key.
17
+ # - :permissionLevel [String] Restrict results by permission level (SYSADMIN, ADMIN, USER).
18
+ # - :keyFilter [String] Return properties matching a wildcard filter (e.g. "jira.option*").
14
19
  # @yield [builder] Optional block to configure the request.
15
- # @return [Object] The API response containing all properties.
20
+ # @return [Object] The API response containing properties.
16
21
  #
17
22
  # @example List all application properties
18
- # client.application_properties.list
23
+ # client.ApplicationProperties.list
19
24
  #
20
- def list
25
+ # @example Filter by key
26
+ # client.ApplicationProperties.list do
27
+ # params key: "jira.lf.date.format"
28
+ # end
29
+ #
30
+ # @example Filter by permission level
31
+ # client.ApplicationProperties.list do
32
+ # params permissionLevel: "SYSADMIN"
33
+ # end
34
+ #
35
+ def list(&block)
21
36
  builder do
22
37
  path 'application-properties'
38
+ instance_eval(&block) if block_given?
23
39
  end
24
- run
40
+ call
25
41
  end
26
42
 
27
43
  alias get list
@@ -33,7 +49,7 @@ module Rujira
33
49
  # @return [Object] The API response after updating the property.
34
50
  #
35
51
  # @example Update an application property
36
- # client.application_properties.set("jira.option.someFeature") do
52
+ # client.ApplicationProperties.set("jira.option.allowattachments") do
37
53
  # payload value: true
38
54
  # end
39
55
  #
@@ -43,7 +59,7 @@ module Rujira
43
59
  path "application-properties/#{id}"
44
60
  instance_eval(&block) if block_given?
45
61
  end
46
- run
62
+ call
47
63
  end
48
64
 
49
65
  # Retrieves advanced application settings.
@@ -52,13 +68,14 @@ module Rujira
52
68
  # @return [Object] The API response containing advanced settings.
53
69
  #
54
70
  # @example Get advanced settings
55
- # client.application_properties.advanced_settings
71
+ # client.ApplicationProperties.advanced_settings
56
72
  #
57
- def advanced_settings
73
+ def advanced_settings(&block)
58
74
  builder do
59
75
  path 'application-properties/advanced-settings'
76
+ instance_eval(&block) if block_given?
60
77
  end
61
- run
78
+ call
62
79
  end
63
80
  end
64
81
  end
@@ -15,7 +15,7 @@ module Rujira
15
15
  # @return [Object] The API response after updating roles.
16
16
  #
17
17
  # @example Bulk update roles
18
- # client.Application_role.put_bulk do
18
+ # client.ApplicationRole.put_bulk do
19
19
  # payload [
20
20
  # { key: "jira-software-users", groups: ["jira-users"] },
21
21
  # { key: "jira-administrators", groups: ["admins"] }
@@ -28,7 +28,7 @@ module Rujira
28
28
  path 'applicationrole'
29
29
  instance_eval(&block) if block_given?
30
30
  end
31
- run
31
+ call
32
32
  end
33
33
 
34
34
  # Lists all application roles.
@@ -37,13 +37,14 @@ module Rujira
37
37
  # @return [Object] The API response containing all application roles.
38
38
  #
39
39
  # @example List all application roles
40
- # client.Application_role.list
40
+ # client.ApplicationRole.list
41
41
  #
42
- def list
42
+ def list(&block)
43
43
  builder do
44
44
  path 'applicationrole'
45
+ instance_eval(&block) if block_given?
45
46
  end
46
- run
47
+ call
47
48
  end
48
49
 
49
50
  # Retrieves a specific application role by key.
@@ -52,13 +53,14 @@ module Rujira
52
53
  # @return [Object] The API response containing role details.
53
54
  #
54
55
  # @example Get a role
55
- # client.Application_role.get("jira-software-users")
56
+ # client.ApplicationRole.get("jira-software-users")
56
57
  #
57
- def get(key)
58
+ def get(key, &block)
58
59
  builder do
59
60
  path "applicationrole/#{key}"
61
+ instance_eval(&block) if block_given?
60
62
  end
61
- run
63
+ call
62
64
  end
63
65
 
64
66
  # Updates a specific application role by key.
@@ -68,7 +70,7 @@ module Rujira
68
70
  # @return [Object] The API response after updating the role.
69
71
  #
70
72
  # @example Update a role
71
- # client.Application_role.put("jira-software-users") do
73
+ # client.ApplicationRole.put("jira-software-users") do
72
74
  # payload groups: ["jira-users", "new-group"]
73
75
  # end
74
76
  #
@@ -78,7 +80,7 @@ module Rujira
78
80
  path "applicationrole/#{key}"
79
81
  instance_eval(&block) if block_given?
80
82
  end
81
- run
83
+ call
82
84
  end
83
85
  end
84
86
  end
@@ -2,42 +2,48 @@
2
2
 
3
3
  module Rujira
4
4
  module Api
5
- # This class provides methods to manage Jira issue attachments via the REST API.
6
- # Currently, it supports creating (uploading) attachments for a given issue ID or key.
7
- # Example: Attach a file to an issue by calling `create("ISSUE-123", "/path/to/file")`.
8
- # https://docs.atlassian.com/software/jira/docs/api/REST/9.17.0/#api/2/issue/%7BissueIdOrKey%7D/attachments
5
+ # Provides methods to manage Jira issue attachments via the REST API.
6
+ # Supports retrieving, deleting, and accessing metadata of attachments.
7
+ #
8
+ # API reference:
9
+ # https://docs.atlassian.com/software/jira/docs/api/REST/9.17.0/#api/2/attachment
10
+ #
9
11
  class Attachments < Common
10
12
  # Retrieves a specific attachment by ID.
11
13
  #
12
14
  # @param [String] id The attachment ID.
15
+ # @yield [builder] Optional block to configure the request.
13
16
  # @return [Object] The API response containing attachment details.
14
17
  #
15
18
  # @example Get an attachment
16
- # client.attachments.get("10001")
19
+ # client.Attachments.get("10001")
17
20
  #
18
- def get(id)
21
+ def get(id, &block)
19
22
  abort 'Attachment ID is required' if id.to_s.strip.empty?
20
23
  builder do
21
24
  path "attachment/#{id}"
25
+ instance_eval(&block) if block_given?
22
26
  end
23
- run
27
+ call
24
28
  end
25
29
 
26
30
  # Deletes a specific attachment by ID.
27
31
  #
28
32
  # @param [String] id The attachment ID.
33
+ # @yield [builder] Optional block to configure the request.
29
34
  # @return [Object] The API response after deletion.
30
35
  #
31
36
  # @example Delete an attachment
32
- # client.attachments.delete("10001")
37
+ # client.Attachments.delete("10001")
33
38
  #
34
- def delete(id)
39
+ def delete(id, &block)
35
40
  abort 'Attachment ID is required' if id.to_s.strip.empty?
36
41
  builder do
37
42
  method :delete
38
43
  path "attachment/#{id}"
44
+ instance_eval(&block) if block_given?
39
45
  end
40
- run
46
+ call
41
47
  end
42
48
 
43
49
  # Retrieves metadata for attachments.
@@ -46,13 +52,14 @@ module Rujira
46
52
  # @return [Object] The API response containing attachment metadata.
47
53
  #
48
54
  # @example Get attachment metadata
49
- # client.attachments.meta
55
+ # client.Attachments.meta
50
56
  #
51
- def meta
57
+ def meta(&block)
52
58
  builder do
53
59
  path 'attachment/meta'
60
+ instance_eval(&block) if block_given?
54
61
  end
55
- run
62
+ call
56
63
  end
57
64
  end
58
65
  end
@@ -12,16 +12,18 @@ module Rujira
12
12
  # Retrieves all system avatars of a given type.
13
13
  #
14
14
  # @param [String] type The type of avatar (e.g., "project", "user").
15
+ # @yield [builder] Optional block to configure the request.
15
16
  # @return [Object] The API response containing system avatars.
16
17
  #
17
18
  # @example Get system avatars for projects
18
19
  # client.Avatar.get("project")
19
20
  #
20
- def get(type)
21
+ def get(type, &block)
21
22
  builder do
22
23
  path "avatar/#{type}/system"
24
+ instance_eval(&block) if block_given?
23
25
  end
24
- run
26
+ call
25
27
  end
26
28
 
27
29
  # Uploads a temporary avatar for a given type.
@@ -41,7 +43,7 @@ module Rujira
41
43
  path "avatar/#{type}/temporary"
42
44
  instance_eval(&block) if block_given?
43
45
  end
44
- run
46
+ call
45
47
  end
46
48
 
47
49
  # Crops a previously uploaded temporary avatar.
@@ -52,7 +54,7 @@ module Rujira
52
54
  #
53
55
  # @example Crop a temporary avatar
54
56
  # client.Avatar.crop("project") do
55
- # payload { x: 0, y: 0, width: 48, height: 48 }
57
+ # payload x: 0, y: 0, width: 48, height: 48
56
58
  # end
57
59
  #
58
60
  def crop(type, &block)
@@ -61,7 +63,7 @@ module Rujira
61
63
  path "avatar/#{type}/temporaryCrop"
62
64
  instance_eval(&block) if block_given?
63
65
  end
64
- run
66
+ call
65
67
  end
66
68
  end
67
69
  end
@@ -3,7 +3,10 @@
3
3
  module Rujira
4
4
  module Api
5
5
  # Provides access to Jira Agile board resources via the REST API.
6
- # API reference: https://docs.atlassian.com/jira-software/REST/9.17.0/#agile/1.0/board
6
+ # Allows retrieving boards, board details, and sprints.
7
+ #
8
+ # API reference:
9
+ # https://docs.atlassian.com/jira-software/REST/9.17.0/#agile/1.0/board
7
10
  #
8
11
  class Board < Common
9
12
  # Initializes a new Board API client.
@@ -20,38 +23,69 @@ module Rujira
20
23
  # Retrieves details for a specific board by its ID.
21
24
  #
22
25
  # @param [Integer, String] id The board ID.
26
+ # @yield [builder] Optional block to configure the request.
23
27
  # @return [Object] The API response containing board details.
24
28
  #
25
- def get(id)
29
+ # @example Get board details
30
+ # client.Board.get(123)
31
+ #
32
+ def get(id, &block)
26
33
  abort 'Board ID is required' if id.to_s.strip.empty?
27
34
  builder do
28
35
  path "board/#{id}"
36
+ instance_eval(&block) if block_given?
29
37
  end
30
- run
38
+ call
31
39
  end
32
40
 
33
41
  # Lists all boards visible to the current user.
34
42
  #
43
+ # Available query parameters:
44
+ # - `startAt` [Integer]: The index of the first item to return (pagination).
45
+ # - `maxResults` [Integer]: The maximum number of items to return.
46
+ # - `type` [String]: Filters boards by type ("scrum" or "kanban").
47
+ # - `name` [String]: Filters boards by name.
48
+ # - `projectKeyOrId` [String]: Filters boards by associated project.
49
+ #
50
+ # @yield [builder] Optional block to configure query parameters.
35
51
  # @return [Object] The API response containing a list of boards.
36
52
  #
37
- def list
53
+ # @example List boards with pagination
54
+ # client.Board.list do
55
+ # params startAt: 0, maxResults: 50
56
+ # end
57
+ #
58
+ def list(&block)
38
59
  builder do
39
60
  path 'board'
61
+ instance_eval(&block) if block_given?
40
62
  end
41
- run
63
+ call
42
64
  end
43
65
 
44
66
  # Retrieves all sprints for a specific board.
45
67
  #
68
+ # Available query parameters:
69
+ # - `state` [String]: Filters sprints by state ("future", "active", "closed").
70
+ # - `startAt` [Integer]: The index of the first item to return (pagination).
71
+ # - `maxResults` [Integer]: The maximum number of items to return.
72
+ #
46
73
  # @param [Integer, String] id The board ID.
74
+ # @yield [builder] Optional block to configure query parameters.
47
75
  # @return [Object] The API response containing sprints.
48
76
  #
49
- def sprint(id)
77
+ # @example Get active sprints for a board
78
+ # client.Board.sprint(123) do
79
+ # params state: "active"
80
+ # end
81
+ #
82
+ def sprint(id, &block)
50
83
  abort 'Board ID is required' if id.to_s.strip.empty?
51
84
  builder do
52
85
  path "board/#{id}/sprint"
86
+ instance_eval(&block) if block_given?
53
87
  end
54
- run
88
+ call
55
89
  end
56
90
  end
57
91
  end
@@ -25,7 +25,7 @@ module Rujira
25
25
  method :post
26
26
  instance_eval(&block) if block_given?
27
27
  end
28
- run
28
+ call
29
29
  end
30
30
  end
31
31
  end
@@ -13,9 +13,7 @@ module Rujira
13
13
  def initialize(client)
14
14
  # Store the passed client object in an instance variable for later use
15
15
  @client = client
16
-
17
- # Configure requests using the client's builder DSL
18
- @client.request.builder do
16
+ @request = Request.new.builder do
19
17
  # Set the Bearer token for authorization
20
18
  bearer @token
21
19
 
@@ -34,12 +32,21 @@ module Rujira
34
32
  #
35
33
  # @yield [builder] Optional block to configure the request builder.
36
34
  # @return [Object] The configured request builder stored in @request.
37
- def builder(&block) = @client.request.builder(&block)
35
+ def builder(&block) = @request.builder(&block)
38
36
 
39
37
  # Executes the configured request.
40
38
  #
41
39
  # @return [Object] The API response after dispatching the request.
42
- def run = @client.dispatch
40
+ def call
41
+ @client.logger.debug "Call the method: #{caller_locations(1, 1)[0].label}"
42
+ return @client.dispatch(@request) if @client.dispatchable
43
+
44
+ self
45
+ end
46
+
47
+ def commit
48
+ @client.dispatch(@request)
49
+ end
43
50
  end
44
51
  end
45
52
  end
@@ -3,6 +3,8 @@
3
3
  module Rujira
4
4
  module Api
5
5
  # Provides access to Jira configuration settings via the REST API.
6
+ # The configuration resource contains system-wide settings such as
7
+ # the base URL, time tracking configuration, attachment settings, etc.
6
8
  #
7
9
  # API reference:
8
10
  # https://docs.atlassian.com/software/jira/docs/api/REST/9.17.0/#api/2/configuration
@@ -10,17 +12,28 @@ module Rujira
10
12
  class Configuration < Common
11
13
  # Retrieves the current Jira configuration.
12
14
  #
15
+ # The response typically includes:
16
+ # - `timeTrackingConfiguration` (time tracking settings)
17
+ # - `attachmentsEnabled` (whether attachments are enabled)
18
+ # - `baseUrl` (the base URL of Jira)
19
+ #
13
20
  # @yield [builder] Optional block to configure the request.
14
21
  # @return [Object] The API response containing configuration details.
15
22
  #
16
23
  # @example Get Jira configuration
17
24
  # client.Configuration.get
18
25
  #
19
- def get
26
+ # @example With a block (adding custom headers)
27
+ # client.Configuration.get do
28
+ # headers "X-Experimental-API" => "true"
29
+ # end
30
+ #
31
+ def get(&block)
20
32
  builder do
21
33
  path 'configuration'
34
+ instance_eval(&block) if block_given?
22
35
  end
23
- run
36
+ call
24
37
  end
25
38
  end
26
39
  end
@@ -9,22 +9,35 @@ module Rujira
9
9
  # https://docs.atlassian.com/software/jira/docs/api/REST/9.17.0/#api/2/customFields
10
10
  #
11
11
  class CustomFields < Common
12
- # Retrieves all custom fields.
12
+ # Retrieves all custom fields in Jira.
13
13
  #
14
- # @yield [builder] Optional block to configure the request.
15
- # @return [Object] The API response containing all custom fields.
14
+ # The response typically contains:
15
+ # - `id` (e.g., "customfield_10001")
16
+ # - `name` (field display name)
17
+ # - `schema` (field type and configuration)
18
+ #
19
+ # @yield [builder] Optional block to configure the request (e.g., add query parameters).
20
+ # @return [Object] The API response containing an array of custom fields.
16
21
  #
17
22
  # @example Get all custom fields
18
23
  # client.CustomFields.get
19
24
  #
20
- def get
25
+ # @example With query parameters
26
+ # client.CustomFields.get do
27
+ # params maxResults: 50, startAt: 0
28
+ # end
29
+ #
30
+ def get(&block)
21
31
  builder do
22
32
  path 'customFields'
33
+ instance_eval(&block) if block_given?
23
34
  end
24
- run
35
+ call
25
36
  end
26
37
 
27
- # Deletes custom fields based on provided parameters.
38
+ # Deletes one or more custom fields by their IDs.
39
+ #
40
+ # The request must include `fieldIds` in the payload.
28
41
  #
29
42
  # @yield [builder] Block to configure the deletion payload or parameters.
30
43
  # @return [Object] The API response after deletion.
@@ -40,7 +53,7 @@ module Rujira
40
53
  path 'customFields'
41
54
  instance_eval(&block) if block_given?
42
55
  end
43
- run
56
+ call
44
57
  end
45
58
  end
46
59
  end
@@ -3,8 +3,9 @@
3
3
  module Rujira
4
4
  module Api
5
5
  # Provides access to Jira dashboards via the REST API.
6
+ #
6
7
  # API reference:
7
- # https://docs.atlassian.com/software/jira/docs/api/REST/9.17.0/#api/2/myself
8
+ # https://docs.atlassian.com/software/jira/docs/api/REST/9.17.0/#api/2/dashboard
8
9
  #
9
10
  class Dashboard < Common
10
11
  # Retrieves a specific dashboard by its ID.
@@ -15,26 +16,39 @@ module Rujira
15
16
  # @example Get a dashboard by ID
16
17
  # client.Dashboard.get(10001)
17
18
  #
18
- def get(id)
19
+ def get(id, &block)
19
20
  abort 'Dashboard ID is required' if id.to_s.strip.empty?
20
21
  builder do
21
22
  path "dashboard/#{id}"
23
+ instance_eval(&block) if block_given?
22
24
  end
23
- run
25
+ call
24
26
  end
25
27
 
26
28
  # Lists all dashboards visible to the current user.
27
29
  #
30
+ # Optional query parameters:
31
+ # - `startAt` [Integer] The index of the first dashboard to return (default: 0).
32
+ # - `maxResults` [Integer] The maximum number of dashboards to return (default: 20, max: 1000).
33
+ # - `filter` [String] A string to filter dashboards by name.
34
+ #
35
+ # @yield [builder] Optional block to configure query parameters.
28
36
  # @return [Object] The API response containing a list of dashboards.
29
37
  #
30
38
  # @example List dashboards
31
39
  # client.Dashboard.list
32
40
  #
33
- def list
41
+ # @example List dashboards with pagination
42
+ # client.Dashboard.list do
43
+ # params startAt: 20, maxResults: 50
44
+ # end
45
+ #
46
+ def list(&block)
34
47
  builder do
35
48
  path 'dashboard'
49
+ instance_eval(&block) if block_given?
36
50
  end
37
- run
51
+ call
38
52
  end
39
53
  end
40
54
  end