lex-jira 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5b287a820a7a94ebac9ad56193274fab08a1f79c2c3ae85d5039b7d6be64ae04
4
+ data.tar.gz: cebe992c43c530f4b2669d8ece5c7f450cdaedf6e52c913e2bf2069d853ee3af
5
+ SHA512:
6
+ metadata.gz: 16bd7687483d53d8be6207a0bd9eaf12ed83305fcf8ad2774a97c6a738ef96b94b5e2e537649150d8ecd8c5c5cf376ed1d17fb61c44e01b956466bf9353e8c4e
7
+ data.tar.gz: fe5088a2f317a0250a35e81b84ee105e610d294d38265126ef1b64278a5a35b62c71e9b394884cad3c708324ec3999dda5120b1f6b75f3406f0349cf517684eb
@@ -0,0 +1,16 @@
1
+ name: CI
2
+ on:
3
+ push:
4
+ branches: [origin]
5
+ pull_request:
6
+
7
+ jobs:
8
+ ci:
9
+ uses: LegionIO/.github/.github/workflows/ci.yml@main
10
+
11
+ release:
12
+ needs: ci
13
+ if: github.event_name == 'push' && github.ref == 'refs/heads/origin'
14
+ uses: LegionIO/.github/.github/workflows/release.yml@main
15
+ secrets:
16
+ rubygems-api-key: ${{ secrets.RUBYGEMS_API_KEY }}
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ Gemfile.lock
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,53 @@
1
+ AllCops:
2
+ TargetRubyVersion: 3.4
3
+ NewCops: enable
4
+ SuggestExtensions: false
5
+
6
+ Layout/LineLength:
7
+ Max: 160
8
+
9
+ Layout/SpaceAroundEqualsInParameterDefault:
10
+ EnforcedStyle: space
11
+
12
+ Layout/HashAlignment:
13
+ EnforcedHashRocketStyle: table
14
+ EnforcedColonStyle: table
15
+
16
+ Metrics/MethodLength:
17
+ Max: 50
18
+
19
+ Metrics/ClassLength:
20
+ Max: 1500
21
+
22
+ Metrics/ModuleLength:
23
+ Max: 1500
24
+
25
+ Metrics/BlockLength:
26
+ Max: 40
27
+ Exclude:
28
+ - 'spec/**/*'
29
+
30
+ Metrics/ParameterLists:
31
+ Max: 10
32
+
33
+ Metrics/AbcSize:
34
+ Max: 60
35
+
36
+ Metrics/CyclomaticComplexity:
37
+ Max: 15
38
+
39
+ Metrics/PerceivedComplexity:
40
+ Max: 17
41
+
42
+ Style/Documentation:
43
+ Enabled: false
44
+
45
+ Style/SymbolArray:
46
+ Enabled: true
47
+
48
+ Style/FrozenStringLiteralComment:
49
+ Enabled: true
50
+ EnforcedStyle: always
51
+
52
+ Naming/FileName:
53
+ Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # Changelog
2
+
3
+ ## [0.1.0] - 2026-03-21
4
+
5
+ ### Added
6
+ - Initial release
7
+ - `Helpers::Client` — Faraday connection builder with Basic auth (email + API token)
8
+ - `Runners::Issues` — create_issue, get_issue, update_issue, search_issues, transition_issue, add_comment
9
+ - `Runners::Projects` — list_projects, get_project
10
+ - `Runners::Boards` — list_boards, get_board, get_sprints
11
+ - Standalone `Client` class for use outside the Legion framework
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
6
+
7
+ gem 'rake', '~> 12.0'
8
+ gem 'rspec', '~> 3.0'
9
+ gem 'rspec_junit_formatter'
10
+ gem 'rubocop'
11
+ gem 'rubocop-rspec'
data/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # lex-jira
2
+
3
+ LegionIO extension for Jira integration via the Jira REST API v3 and Agile API.
4
+
5
+ ## Installation
6
+
7
+ Add to your Gemfile:
8
+
9
+ ```ruby
10
+ gem 'lex-jira'
11
+ ```
12
+
13
+ ## Standalone Usage
14
+
15
+ ```ruby
16
+ require 'legion/extensions/jira'
17
+
18
+ client = Legion::Extensions::Jira::Client.new(
19
+ url: 'https://your-org.atlassian.net',
20
+ email: 'user@example.com',
21
+ api_token: 'your-api-token'
22
+ )
23
+
24
+ # Issues
25
+ client.create_issue(project_key: 'PROJ', summary: 'New bug', issue_type: 'Bug')
26
+ client.get_issue(issue_key: 'PROJ-1')
27
+ client.update_issue(issue_key: 'PROJ-1', summary: 'Updated summary')
28
+ client.search_issues(jql: 'project = PROJ AND status = Open')
29
+ client.transition_issue(issue_key: 'PROJ-1', transition_id: '31')
30
+ client.add_comment(issue_key: 'PROJ-1', body: 'Work in progress')
31
+
32
+ # Projects
33
+ client.list_projects
34
+ client.get_project(project_key: 'PROJ')
35
+
36
+ # Boards (Jira Software)
37
+ client.list_boards
38
+ client.get_board(board_id: 1)
39
+ client.get_sprints(board_id: 1)
40
+ ```
41
+
42
+ ## Authentication
43
+
44
+ Jira REST API uses HTTP Basic Auth with your email address and an API token.
45
+ Generate an API token at: https://id.atlassian.com/manage-profile/security/api-tokens
46
+
47
+ ## License
48
+
49
+ MIT
data/lex-jira.gemspec ADDED
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/legion/extensions/jira/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'lex-jira'
7
+ spec.version = Legion::Extensions::Jira::VERSION
8
+ spec.authors = ['Esity']
9
+ spec.email = ['matthewdiverson@gmail.com']
10
+
11
+ spec.summary = 'LEX::Jira'
12
+ spec.description = 'Used to connect Legion to Jira'
13
+ spec.homepage = 'https://github.com/LegionIO/lex-jira'
14
+ spec.license = 'MIT'
15
+ spec.required_ruby_version = '>= 3.4'
16
+
17
+ spec.metadata['homepage_uri'] = spec.homepage
18
+ spec.metadata['source_code_uri'] = 'https://github.com/LegionIO/lex-jira'
19
+ spec.metadata['changelog_uri'] = 'https://github.com/LegionIO/lex-jira/blob/main/CHANGELOG.md'
20
+ spec.metadata['rubygems_mfa_required'] = 'true'
21
+
22
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
23
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
+ end
25
+ spec.bindir = 'exe'
26
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ['lib']
28
+
29
+ spec.add_dependency 'faraday', '>= 2.0'
30
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'helpers/client'
4
+ require_relative 'runners/issues'
5
+ require_relative 'runners/projects'
6
+ require_relative 'runners/boards'
7
+
8
+ module Legion
9
+ module Extensions
10
+ module Jira
11
+ class Client
12
+ include Helpers::Client
13
+ include Runners::Issues
14
+ include Runners::Projects
15
+ include Runners::Boards
16
+
17
+ attr_reader :opts
18
+
19
+ def initialize(url:, email:, api_token:, **extra)
20
+ @opts = { url: url, email: email, api_token: api_token, **extra }
21
+ end
22
+
23
+ def settings
24
+ { options: @opts }
25
+ end
26
+
27
+ def connection(**override)
28
+ super(**@opts, **override)
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'faraday'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Jira
8
+ module Helpers
9
+ module Client
10
+ def connection(url: nil, email: nil, api_token: nil, **_opts)
11
+ base_url = url || 'https://your-org.atlassian.net'
12
+ Faraday.new(url: base_url) do |conn|
13
+ conn.request :json
14
+ conn.response :json, content_type: /\bjson$/
15
+ conn.request :authorization, :basic, email, api_token if email && api_token
16
+ conn.adapter Faraday.default_adapter
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Legion
4
+ module Extensions
5
+ module Jira
6
+ module Runners
7
+ module Boards
8
+ def list_boards(project_key: nil, board_type: nil, start_at: 0, max_results: 50, **)
9
+ params = { startAt: start_at, maxResults: max_results }
10
+ params[:projectKeyOrId] = project_key if project_key
11
+ params[:type] = board_type if board_type
12
+ resp = connection(**).get('/rest/agile/1.0/board', params)
13
+ { boards: resp.body }
14
+ end
15
+
16
+ def get_board(board_id:, **)
17
+ resp = connection(**).get("/rest/agile/1.0/board/#{board_id}")
18
+ { board: resp.body }
19
+ end
20
+
21
+ def get_sprints(board_id:, state: nil, start_at: 0, max_results: 50, **)
22
+ params = { startAt: start_at, maxResults: max_results }
23
+ params[:state] = state if state
24
+ resp = connection(**).get("/rest/agile/1.0/board/#{board_id}/sprint", params)
25
+ { sprints: resp.body }
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Legion
4
+ module Extensions
5
+ module Jira
6
+ module Runners
7
+ module Issues
8
+ def create_issue(project_key:, summary:, issue_type: 'Task', description: nil, assignee: nil, priority: nil, labels: nil, **)
9
+ body = {
10
+ fields: {
11
+ project: { key: project_key },
12
+ summary: summary,
13
+ issuetype: { name: issue_type }
14
+ }
15
+ }
16
+ body[:fields][:description] = description if description
17
+ body[:fields][:assignee] = { name: assignee } if assignee
18
+ body[:fields][:priority] = { name: priority } if priority
19
+ body[:fields][:labels] = labels if labels
20
+ resp = connection(**).post('/rest/api/3/issue', body)
21
+ { issue: resp.body }
22
+ end
23
+
24
+ def get_issue(issue_key:, **)
25
+ resp = connection(**).get("/rest/api/3/issue/#{issue_key}")
26
+ { issue: resp.body }
27
+ end
28
+
29
+ def update_issue(issue_key:, summary: nil, description: nil, assignee: nil, priority: nil, **)
30
+ fields = {}
31
+ fields[:summary] = summary if summary
32
+ fields[:description] = description if description
33
+ fields[:assignee] = { name: assignee } if assignee
34
+ fields[:priority] = { name: priority } if priority
35
+ resp = connection(**).put("/rest/api/3/issue/#{issue_key}", { fields: fields })
36
+ { updated: resp.status == 204, issue_key: issue_key }
37
+ end
38
+
39
+ def search_issues(jql:, max_results: 50, start_at: 0, **)
40
+ params = { jql: jql, maxResults: max_results, startAt: start_at }
41
+ resp = connection(**).get('/rest/api/3/search', params)
42
+ { issues: resp.body }
43
+ end
44
+
45
+ def transition_issue(issue_key:, transition_id:, **)
46
+ body = { transition: { id: transition_id.to_s } }
47
+ resp = connection(**).post("/rest/api/3/issue/#{issue_key}/transitions", body)
48
+ { transitioned: resp.status == 204, issue_key: issue_key }
49
+ end
50
+
51
+ def add_comment(issue_key:, body:, **)
52
+ payload = { body: body }
53
+ resp = connection(**).post("/rest/api/3/issue/#{issue_key}/comment", payload)
54
+ { comment: resp.body }
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Legion
4
+ module Extensions
5
+ module Jira
6
+ module Runners
7
+ module Projects
8
+ def list_projects(**)
9
+ resp = connection(**).get('/rest/api/3/project')
10
+ { projects: resp.body }
11
+ end
12
+
13
+ def get_project(project_key:, **)
14
+ resp = connection(**).get("/rest/api/3/project/#{project_key}")
15
+ { project: resp.body }
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Legion
4
+ module Extensions
5
+ module Jira
6
+ VERSION = '0.1.1'
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/jira/version'
4
+ require 'legion/extensions/jira/helpers/client'
5
+ require 'legion/extensions/jira/runners/issues'
6
+ require 'legion/extensions/jira/runners/projects'
7
+ require 'legion/extensions/jira/runners/boards'
8
+ require 'legion/extensions/jira/client'
9
+
10
+ module Legion
11
+ module Extensions
12
+ module Jira
13
+ extend Legion::Extensions::Core if Legion::Extensions.const_defined? :Core
14
+ end
15
+ end
16
+ end
metadata ADDED
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lex-jira
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Esity
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: faraday
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '2.0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '2.0'
26
+ description: Used to connect Legion to Jira
27
+ email:
28
+ - matthewdiverson@gmail.com
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - ".github/workflows/ci.yml"
34
+ - ".gitignore"
35
+ - ".rspec"
36
+ - ".rubocop.yml"
37
+ - CHANGELOG.md
38
+ - Gemfile
39
+ - README.md
40
+ - lex-jira.gemspec
41
+ - lib/legion/extensions/jira.rb
42
+ - lib/legion/extensions/jira/client.rb
43
+ - lib/legion/extensions/jira/helpers/client.rb
44
+ - lib/legion/extensions/jira/runners/boards.rb
45
+ - lib/legion/extensions/jira/runners/issues.rb
46
+ - lib/legion/extensions/jira/runners/projects.rb
47
+ - lib/legion/extensions/jira/version.rb
48
+ homepage: https://github.com/LegionIO/lex-jira
49
+ licenses:
50
+ - MIT
51
+ metadata:
52
+ homepage_uri: https://github.com/LegionIO/lex-jira
53
+ source_code_uri: https://github.com/LegionIO/lex-jira
54
+ changelog_uri: https://github.com/LegionIO/lex-jira/blob/main/CHANGELOG.md
55
+ rubygems_mfa_required: 'true'
56
+ rdoc_options: []
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '3.4'
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ requirements: []
70
+ rubygems_version: 3.6.9
71
+ specification_version: 4
72
+ summary: LEX::Jira
73
+ test_files: []