A summary of data about the Ruby ecosystem.

https://github.com/sumoheavy/jira-ruby

A Ruby gem for the JIRA REST API
https://github.com/sumoheavy/jira-ruby

Keywords from Contributors

activerecord activejob mvc crash-reporting rubygems deployment code-formatter rubocop static-code-analysis error-handler

Last synced: about 1 hour ago
JSON representation

Repository metadata

A Ruby gem for the JIRA REST API

README.md

JIRA API Gem

Build Status

This gem provides access to the Atlassian JIRA REST API.

Example usage

Jira Ruby API - Sample Usage

This sample usage demonstrates how you can interact with JIRA's API using the jira-ruby gem.

Dependencies

Before running, install the jira-ruby gem:

gem install jira-ruby

Sample Usage

Connect to JIRA
Firstly, establish a connection with your JIRA instance by providing a few configuration parameters:
There are other ways to connect to JIRA listed below | Personal Access Token

  • private_key_file: The path to your RSA private key file.
  • consumer_key: Your consumer key.
  • site: The URL of your JIRA instance.
options = {
  :private_key_file => "rsakey.pem",
  :context_path     => '',
  :consumer_key     => 'your_consumer_key',
  :site             => 'your_jira_instance_url'
}

client = JIRA::Client.new(options)

Retrieve and Display Projects

After establishing the connection, you can fetch all projects and display their key and name:

projects = client.Project.all

projects.each do |project|
  puts "Project -> key: #{project.key}, name: #{project.name}"
end

Handling Fields by Name

The jira-ruby gem allows you to refer to fields by their custom names rather than identifiers. Make sure to map fields before using them:

client.Field.map_fields

old_way = issue.customfield_12345

# Note: The methods mapped here adopt a unique style combining PascalCase and snake_case conventions.
new_way = issue.Special_Field

JQL Queries

To find issues based on specific criteria, you can use JIRA Query Language (JQL):

client.Issue.jql(a_normal_jql_search, fields:[:description, :summary, :Special_field, :created])

Several actions can be performed on the Issue object such as create, update, transition, delete, etc:

Creating an Issue

issue = client.Issue.build
labels = ['label1', 'label2']
issue.save({
  "fields" => {
    "summary" => "blarg from in example.rb",
    "project" => {"key" => "SAMPLEPROJECT"},
    "issuetype" => {"id" => "3"},
    "labels" => labels,
    "priority" => {"id" => "1"}
  }
})

Updating/Transitioning an Issue

issue = client.Issue.find("10002")
issue.save({"fields"=>{"summary"=>"EVEN MOOOOOOARRR NINJAAAA!"}})

issue_transition = issue.transitions.build
issue_transition.save!('transition' => {'id' => transition_id})

Deleting an Issue

issue = client.Issue.find('SAMPLEPROJECT-2')
issue.delete

Other Capabilities

Apart from the operations listed above, this API wrapper supports several other capabilities like:
• Searching for a user
• Retrieving an issue's watchers
• Changing the assignee of an issue
• Adding attachments and comments to issues
• Managing issue links and much more.

Not all examples are shown in this README; refer to the complete script example for a full overview of the capabilities supported by this API wrapper.

Links to JIRA REST API documentation

Running tests

Before running tests, you will need a public certificate generated.

rake jira:generate_public_cert

Setting up the JIRA SDK

On Mac OS,

./bin/atlas-run-standalone --product jira

Once this is running, you should be able to connect to
http://localhost:2990/ and login to the JIRA admin system using admin:admin

You'll need to create a dummy project and probably some issues to test using
this library.

Configuring JIRA to use OAuth

From the JIRA API tutorial

The first step is to register a new consumer in JIRA. This is done through
the Application Links administration screens in JIRA. Create a new
Application Link.
Administration/Plugins/Application Links

When creating the Application Link use a placeholder URL or the correct URL
to your client (e.g. http://localhost:3000), if your client can be reached
via HTTP and choose the Generic Application type. After this Application Link
has been created, edit the configuration and go to the incoming
authentication configuration screen and select OAuth. Enter in this the
public key and the consumer key which your client will use when making
requests to JIRA.

This public key and consumer key will need to be generated by the Gem user, using OpenSSL
or similar to generate the public key and the provided rake task to generate the consumer
key.

After you have entered all the information click OK and ensure OAuth authentication is
enabled.

For two legged oauth in server mode only, not in cloud based JIRA, make sure to Allow 2-Legged OAuth

Configuring JIRA to use HTTP Basic Auth

Follow the same steps described above to set up a new Application Link in JIRA,
however there is no need to set up any "incoming authentication" as this
defaults to HTTP Basic Auth.

Configuring JIRA to use Cookie-Based Auth

Jira supports cookie based authentication whereby user credentials are passed
to JIRA via a JIRA REST API call. This call returns a session cookie which must
then be sent to all following JIRA REST API calls.

To enable cookie based authentication, set :auth_type to :cookie,
set :use_cookies to true and set :username and :password accordingly.

require 'jira-ruby'

options = {
  :username           => 'username',
  :password           => 'pass1234',
  :site               => 'http://mydomain.atlassian.net:443/',
  :context_path       => '',
  :auth_type          => :cookie,  # Set cookie based authentication
  :use_cookies        => true,     # Send cookies with each request
  :additional_cookies => ['AUTH=vV7uzixt0SScJKg7'] # Optional cookies to send
                                                   # with each request
}

client = JIRA::Client.new(options)

project = client.Project.find('SAMPLEPROJECT')

project.issues.each do |issue|
  puts "#{issue.id} - #{issue.summary}"
end

Some authentication schemes might require additional cookies to be sent with
each request. Cookies added to the :additional_cookies option will be added
to each request. This option should be an array of strings representing each
cookie to add to the request.

Some authentication schemes that require additional cookies ignore the username
and password sent in the JIRA REST API call. For those use cases, :username
and :password may be omitted from options.

Configuring JIRA to use Personal Access Tokens Auth

If your JIRA system is configured to support Personal Access Token authorization, minor modifications are needed in how credentials are communicated to the server. Specifically, the paremeters :username and :password are not needed. Also, the parameter :default_headers is needed to contain the api_token, which can be obtained following the official documentation from Atlassian. Please note that the Personal Access Token can only be used as it is. If it is encoded (with base64 or any other encoding method) then the token will not work correctly and authentication will fail.

require 'jira-ruby'

# NOTE: the token should not be encoded
api_token = API_TOKEN_OBTAINED_FROM_JIRA_UI

options = {
  :site               => 'http://mydomain.atlassian.net:443/',
  :context_path       => '',
  :default_headers    => { 'Authorization' => "Bearer #{api_token}" },
  :auth_type          => :basic
}

client = JIRA::Client.new(options)

project = client.Project.find('SAMPLEPROJECT')

project.issues.each do |issue|
  puts "#{issue.id} - #{issue.summary}"
end

Using the API Gem in a command line application

Using HTTP Basic Authentication, configure and connect a client to your instance
of JIRA.

Note: If your Jira install is hosted on atlassian.net, it will have no context
path by default. If you're having issues connecting, try setting context_path
to an empty string in the options hash.

require 'rubygems'
require 'pp'
require 'jira-ruby'

# Consider the use of :use_ssl and :ssl_verify_mode options if running locally
# for tests.

# NOTE basic auth no longer works with Jira, you must generate an API token, to do so you must have jira instance access rights. You can generate a token here: https://id.atlassian.com/manage/api-tokens

# You will see JIRA::HTTPError (JIRA::HTTPError) if you attempt to use basic auth with your user's password

username = "myremoteuser"
api_token = "myApiToken"

options = {
            :username => username,
            :password => api_token,
            :site     => 'http://localhost:8080/', # or 'https://<your_subdomain>.atlassian.net/'
            :context_path => '/myjira', # often blank
            :auth_type => :basic,
            :read_timeout => 120
          }

client = JIRA::Client.new(options)

# Show all projects
projects = client.Project.all

projects.each do |project|
  puts "Project -> key: #{project.key}, name: #{project.name}"
end

Using the API Gem in your Rails application

Using oauth, the gem requires the consumer key and public certificate file (which
are generated in their respective rake tasks) to initialize an access token for
using the JIRA API.

Note that currently the rake task which generates the public certificate
requires OpenSSL to be installed on the machine.

Below is an example for setting up a rails application for OAuth authorization.

Ensure the JIRA gem is loaded correctly

# Gemfile
...
gem 'jira-ruby', :require => 'jira-ruby'
...

Add common methods to your application controller and ensure access token
errors are handled gracefully

# app/controllers/application_controller.rb
class ApplicationController < ActionController::Base
  protect_from_forgery

  rescue_from JIRA::OauthClient::UninitializedAccessTokenError do
    redirect_to new_jira_session_url
  end

  private

  def get_jira_client

    # add any extra configuration options for your instance of JIRA,
    # e.g. :use_ssl, :ssl_verify_mode, :context_path, :site
    options = {
      :private_key_file => "rsakey.pem",
      :consumer_key => 'test'
    }

    @jira_client = JIRA::Client.new(options)

    # Add AccessToken if authorised previously.
    if session[:jira_auth]
      @jira_client.set_access_token(
        session[:jira_auth]['access_token'],
        session[:jira_auth]['access_key']
      )
    end
  end
end

Create a controller for handling the OAuth conversation.

# app/controllers/jira_sessions_controller.rb
class JiraSessionsController < ApplicationController

  before_filter :get_jira_client

  def new
    callback_url = 'http://callback'
    request_token = @jira_client.request_token(oauth_callback: callback_url)
    session[:request_token] = request_token.token
    session[:request_secret] = request_token.secret

    redirect_to request_token.authorize_url
  end

  def authorize
    request_token = @jira_client.set_request_token(
      session[:request_token], session[:request_secret]
    )
    access_token = @jira_client.init_access_token(
      :oauth_verifier => params[:oauth_verifier]
    )

    session[:jira_auth] = {
      :access_token => access_token.token,
      :access_key => access_token.secret
    }

    session.delete(:request_token)
    session.delete(:request_secret)

    redirect_to projects_path
  end

  def destroy
    session.data.delete(:jira_auth)
  end
end

Create your own controllers for the JIRA resources you wish to access.

# app/controllers/issues_controller.rb
class IssuesController < ApplicationController
  before_filter :get_jira_client
  def index
    @issues = @jira_client.Issue.all
  end

  def show
    @issue = @jira_client.Issue.find(params[:id])
  end
end

Using the API Gem in your Sinatra application

Here's the same example as a Sinatra application:

require 'jira-ruby'
class App < Sinatra::Base
  enable :sessions

  # This section gets called before every request. Here, we set up the
  # OAuth consumer details including the consumer key, private key,
  # site uri, and the request token, access token, and authorize paths
  before do
    options = {
      :site               => 'http://localhost:2990/',
      :context_path       => '/jira',
      :signature_method   => 'RSA-SHA1',
      :request_token_path => "/plugins/servlet/oauth/request-token",
      :authorize_path     => "/plugins/servlet/oauth/authorize",
      :access_token_path  => "/plugins/servlet/oauth/access-token",
      :private_key_file   => "rsakey.pem",
      :rest_base_path     => "/rest/api/2",
      :consumer_key       => "jira-ruby-example"
    }

    @jira_client = JIRA::Client.new(options)
    @jira_client.consumer.http.set_debug_output($stderr)

    # Add AccessToken if authorised previously.
    if session[:jira_auth]
      @jira_client.set_access_token(
        session[:jira_auth][:access_token],
        session[:jira_auth][:access_key]
      )
    end
  end


  # Starting point: http://<yourserver>/
  # This will serve up a login link if you're not logged in. If you are, it'll show some user info and a
  # signout link
  get '/' do
    if !session[:jira_auth]
      # not logged in
      <<-eos
        <h1>jira-ruby (JIRA 5 Ruby Gem) demo </h1>You're not signed in. Why don't you
        <a href=/signin>sign in</a> first.
      eos
    else
      #logged in
      @issues = @jira_client.Issue.all

      # HTTP response inlined with bind data below...
      <<-eos
        You're now signed in. There #{@issues.count == 1 ? "is" : "are"} #{@issues.count}
        issue#{@issues.count == 1 ? "" : "s"} in this JIRA instance. <a href='/signout'>Signout</a>
      eos
    end
  end

  # http://<yourserver>/signin
  # Initiates the OAuth dance by first requesting a token then redirecting to
  # http://<yourserver>/auth to get the @access_token
  get '/signin' do
    callback_url = "#{request.base_url}/callback"
    request_token = @jira_client.request_token(oauth_callback: callback_url)
    session[:request_token] = request_token.token
    session[:request_secret] = request_token.secret

    redirect request_token.authorize_url
  end

  # http://<yourserver>/callback
  # Retrieves the @access_token then stores it inside a session cookie. In a real app,
  # you'll want to persist the token in a datastore associated with the user.
  get "/callback" do
    request_token = @jira_client.set_request_token(
      session[:request_token], session[:request_secret]
    )
    access_token = @jira_client.init_access_token(
      :oauth_verifier => params[:oauth_verifier]
    )

    session[:jira_auth] = {
      :access_token => access_token.token,
      :access_key => access_token.secret
    }

    session.delete(:request_token)
    session.delete(:request_secret)

    redirect "/"
  end

  # http://<yourserver>/signout
  # Expires the session
  get "/signout" do
    session.delete(:jira_auth)
    redirect "/"
  end
end

Using the API Gem in a 2 legged context

Here's an example on how to use 2 legged OAuth:

require 'rubygems'
require 'pp'
require 'jira-ruby'

options = {
            :site               => 'http://localhost:2990/',
            :context_path       => '/jira',
            :signature_method   => 'RSA-SHA1',
            :private_key_file   => "rsakey.pem",
            :rest_base_path     => "/rest/api/2",
            :auth_type => :oauth_2legged,
            :consumer_key       => "jira-ruby-example"
          }

client = JIRA::Client.new(options)

client.set_access_token("","")

# Show all projects
projects = client.Project.all

projects.each do |project|
  puts "Project -> key: #{project.key}, name: #{project.name}"
end

Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 2 days ago

Total Commits: 712
Total Committers: 127
Avg Commits per committer: 5.606
Development Distribution Score (DDS): 0.834

Commits in past year: 24
Committers in past year: 4
Avg Commits per committer in past year: 6.0
Development Distribution Score (DDS) in past year: 0.5

Name Email Commits
Greg Signal g****l@t****z 118
Robert Brodie r****5@g****m 112
Robert Brodie r****t@s****m 57
Marlin Pierce m****r@c****m 36
Simon Lacroix s****n@m****e 30
Malcolm Locke m****c@w****z 23
David Hansen d****d@h****t 22
Adam Bedford a****d@m****m 21
Vladimir Legkunets v****s@g****m 17
wasabhi a****i@t****z 13
Kat Crichton-Seager k****t@c****m 12
peter.bell215 p****5@g****m 10
Shirish Pampoorickal s****h@m****m 8
stevenmcfarlane s****2@g****m 8
Paul Casto p****o@i****m 7
Jordan Harband l****b@g****m 7
Chris Belsole c****e@c****m 6
Dickson d****z@i****t 5
Simon Guerrier s****r@c****m 5
Bry Ashman b****n@g****m 5
Rutger Gelling r****r@h****m 5
Samantha Monteiro s****m@g****m 5
arincon9 a****n@m****m 5
Greg Signal g****g@a****z 4
James Couball j****l@y****m 4
Jiayi Zheng j****g@t****o 4
Orest Ivasiv h****h@g****m 4
Rodolfo Sikora s****a@g****m 4
Chris Belsole c****e@g****m 4
Eric Internicola e****a@s****m 4
and 97 more...

Committer domains:


Issue and Pull Request metadata

Last synced: 20 days ago

Total issues: 79
Total pull requests: 135
Average time to close issues: over 1 year
Average time to close pull requests: 6 months
Total issue authors: 70
Total pull request authors: 61
Average comments per issue: 2.72
Average comments per pull request: 1.51
Merged pull request: 101
Bot issues: 0
Bot pull requests: 0

Past year issues: 7
Past year pull requests: 8
Past year average time to close issues: 7 months
Past year average time to close pull requests: 3 months
Past year issue authors: 6
Past year pull request authors: 5
Past year average comments per issue: 0.43
Past year average comments per pull request: 4.13
Past year merged pull request: 5
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/sumoheavy/jira-ruby

Top Issue Authors

  • bobbrodie (7)
  • marlinpierce (2)
  • Sachin796 (2)
  • fawaf (2)
  • arcadia-okta (1)
  • herrphon (1)
  • Nicolasvb23 (1)
  • jhaagmans (1)
  • AEckner (1)
  • nattfodd (1)
  • zeeshangulzar (1)
  • zeroepoch (1)
  • bumble-bee-chuna (1)
  • ankurjoshi54 (1)
  • AbhishekSharma20 (1)

Top Pull Request Authors

  • bobbrodie (25)
  • marlinpierce (17)
  • jcouball (8)
  • dgonzalezmbc (4)
  • SimonMiaou (3)
  • fuzzkat (3)
  • boimw (2)
  • igooor-bb (2)
  • ljharb (2)
  • trapeze-bell-peter (2)
  • davidalpert (2)
  • Nicolasvb23 (2)
  • gat-developer (2)
  • rjrobinson (2)
  • eugeneius (2)

Top Issue Labels

  • Enhancement (6)
  • Feature (5)
  • Bug (5)
  • Maintenance (4)
  • Documentation (2)
  • Duplicate (1)

Top Pull Request Labels

  • Enhancement (13)
  • Maintenance (9)
  • Bug (4)
  • Documentation (3)
  • Feature (1)

Package metadata

gem.coop: jira-ruby

API for JIRA

  • Homepage: http://www.sumoheavy.com
  • Documentation: http://www.rubydoc.info/gems/jira-ruby/
  • Licenses: MIT
  • Latest release: 3.1.0 (published 2 months ago)
  • Last Synced: 2026-04-29T03:30:45.894Z (1 day ago)
  • Versions: 49
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 62,572,198 Total
  • Docker Downloads: 434,398,400
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 0.187%
    • Docker downloads count: 0.303%
    • Downloads: 0.447%
  • Maintainers (1)
rubygems.org: jira-ruby

API for JIRA

  • Homepage: http://www.sumoheavy.com
  • Documentation: http://www.rubydoc.info/gems/jira-ruby/
  • Licenses: MIT
  • Latest release: 3.1.0 (published 2 months ago)
  • Last Synced: 2026-04-27T11:29:07.818Z (3 days ago)
  • Versions: 49
  • Dependent Packages: 63
  • Dependent Repositories: 1,168
  • Downloads: 62,543,347 Total
  • Docker Downloads: 434,398,400
  • Rankings:
    • Docker downloads count: 0.351%
    • Dependent packages count: 0.44%
    • Downloads: 0.479%
    • Dependent repos count: 0.947%
    • Average: 0.966%
    • Forks count: 1.306%
    • Stargazers count: 2.275%
  • Maintainers (1)
proxy.golang.org: github.com/sumoheavy/jira-ruby

  • Homepage:
  • Documentation: https://pkg.go.dev/github.com/sumoheavy/jira-ruby#section-documentation
  • Licenses: mit
  • Latest release: v3.1.0+incompatible (published 2 months ago)
  • Last Synced: 2026-04-27T18:00:52.718Z (3 days ago)
  • Versions: 49
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent packages count: 5.442%
    • Average: 5.624%
    • Dependent repos count: 5.807%
ubuntu-23.10: ruby-jira

  • Homepage: https://github.com/sumoheavy/jira-ruby
  • Licenses:
  • Latest release: 2.1.5-4 (published 3 months ago)
  • Last Synced: 2026-03-14T03:14:48.593Z (about 2 months ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
debian-12: ruby-jira

  • Homepage: https://github.com/sumoheavy/jira-ruby
  • Documentation: https://packages.debian.org/bookworm/ruby-jira
  • Licenses:
  • Latest release: 2.1.5-4 (published 3 months ago)
  • Last Synced: 2026-03-13T03:29:20.246Z (about 2 months ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
ubuntu-24.10: ruby-jira

  • Homepage: https://github.com/sumoheavy/jira-ruby
  • Licenses:
  • Latest release: 2.3.0-1 (published 3 months ago)
  • Last Synced: 2026-03-09T17:06:59.954Z (about 2 months ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
ubuntu-23.04: ruby-jira

  • Homepage: https://github.com/sumoheavy/jira-ruby
  • Licenses:
  • Latest release: 2.1.5-4 (published 3 months ago)
  • Last Synced: 2026-03-12T07:03:31.135Z (about 2 months ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
ubuntu-24.04: ruby-jira

  • Homepage: https://github.com/sumoheavy/jira-ruby
  • Licenses:
  • Latest release: 2.1.5-4 (published 3 months ago)
  • Last Synced: 2026-03-06T16:49:01.155Z (about 2 months ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%

Dependencies

Gemfile rubygems
  • guard >= 0 development
  • guard-rspec >= 0 development
  • pry >= 0 development
jira-ruby.gemspec rubygems
  • guard ~> 2.13, >= 2.13.0 development
  • guard-rspec ~> 4.6, >= 4.6.5 development
  • pry ~> 0.10, >= 0.10.3 development
  • railties >= 0 development
  • rake ~> 10.3, >= 10.3.2 development
  • rspec ~> 3.0, >= 3.0.0 development
  • webmock ~> 1.18, >= 1.18.0 development
  • activesupport >= 0
  • atlassian-jwt >= 0
  • multipart-post >= 0
  • oauth ~> 0.5, >= 0.5.0

Score: 32.19203164041713