{"id":16696427,"url":"https://github.com/gbevan/jira-ruby-glb","last_synced_at":"2025-09-01T17:47:06.239Z","repository":{"id":21754275,"uuid":"25076249","full_name":"gbevan/jira-ruby-glb","owner":"gbevan","description":"API for JIRA","archived":false,"fork":false,"pushed_at":"2014-10-11T16:42:06.000Z","size":192,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-14T02:29:19.391Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"osl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gbevan.png","metadata":{"files":{"readme":"README.rdoc","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-11T11:52:54.000Z","updated_at":"2014-10-11T11:53:14.000Z","dependencies_parsed_at":"2022-08-17T19:50:10.532Z","dependency_job_id":null,"html_url":"https://github.com/gbevan/jira-ruby-glb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gbevan/jira-ruby-glb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gbevan%2Fjira-ruby-glb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gbevan%2Fjira-ruby-glb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gbevan%2Fjira-ruby-glb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gbevan%2Fjira-ruby-glb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gbevan","download_url":"https://codeload.github.com/gbevan/jira-ruby-glb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gbevan%2Fjira-ruby-glb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273166862,"owners_count":25057178,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T17:28:30.680Z","updated_at":"2025-09-01T17:47:06.185Z","avatar_url":"https://github.com/gbevan.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"= JIRA API Gem\n{\u003cimg src=\"https://codeclimate.com/github/sumoheavy/jira-ruby.png\" /\u003e}[https://codeclimate.com/github/sumoheavy/jira-ruby]\n{\u003cimg src=\"https://travis-ci.org/sumoheavy/jira-ruby.png?branch=master\"}[https://travis-ci.org/sumoheavy/jira-ruby]\n\nThis gem provides access to the Atlassian JIRA REST API.\n\n== Example usage\n\n  client = JIRA::Client.new({:consumer_key =\u003e CONSUMER_KEY, :consumer_secret =\u003e CONSUMER_SECRET})\n\n  project = client.Project.find('SAMPLEPROJECT')\n\n  project.issues.each do |issue|\n    puts \"#{issue.id} - #{issue.summary}\"\n  end\n\n  issue.comments.each {|comment| ... }\n\n  comment = issue.comments.build\n  comment.save({'body':'My new comment'})\n  comment.delete\n\n== Links to JIRA REST API documentation\n\n* {Overview}[https://developer.atlassian.com/display/JIRADEV/JIRA+REST+APIs]\n* {Reference}[http://docs.atlassian.com/jira/REST/latest/]\n\n\n== Setting up the JIRA SDK\n\nOn Mac OS,\n\n* Follow the instructions under \"Mac OSX Installer\" here: https://developer.atlassian.com/display/DOCS/Install+the+Atlassian+SDK+on+a+Linux+or+Mac+System\n* From within the archive directory, run:\n\n    ./bin/atlas-run-standalone --product jira\n\nOnce this is running, you should be able to connect to\nhttp://localhost:2990/ and login to the JIRA admin system using `admin:admin`\n\nYou'll need to create a dummy project and probably some issues to test using\nthis library.\n\n== Configuring JIRA to use OAuth\n\nFrom the JIRA API tutorial\n\n  The first step is to register a new consumer in JIRA. This is done through\n  the Application Links administration screens in JIRA. Create a new\n  Application Link.\n  {Administration/Plugins/Application Links}[http://localhost:2990/jira/plugins/servlet/applinks/listApplicationLinks]\n\n  When creating the Application Link use a placeholder URL or the correct URL\n  to your client (e.g. `http://localhost:3000`), if your client can be reached\n  via HTTP and choose the Generic Application type. After this Application Link\n  has been created, edit the configuration and go to the incoming\n  authentication configuration screen and select OAuth. Enter in this the\n  public key and the consumer key which your client will use when making\n  requests to JIRA.\n\nThis public key and consumer key will need to be generated by the Gem user, using OpenSSL\nor similar to generate the public key and the provided rake task to generate the consumer\nkey.\n\n  After you have entered all the information click OK and ensure OAuth authentication is\n  enabled.\n\n== Configuring JIRA to use HTTP Basic Auth\n\nFollow the same steps described above to set up a new Application Link in JIRA,\nhowever there is no need to set up any \"incoming authentication\" as this\ndefaults to HTTP Basic Auth.\n\n== Using the API Gem in a command line application\n\nUsing HTTP Basic Authentication, configure and connect a client to your instance\nof JIRA.\n\n  require 'rubygems'\n  require 'pp'\n  require 'jira'\n\n  # Consider the use of :use_ssl and :ssl_verify_mode options if running locally \n  # for tests.\n\n  username = \"myremoteuser\"\n  password = \"myuserspassword\"\n\n  options = {\n              :username =\u003e username,\n              :password =\u003e password,\n              :site     =\u003e 'http://localhost:8080/',\n              :context_path =\u003e '/myjira',\n              :auth_type =\u003e :basic\n            }\n\n  client = JIRA::Client.new(options)\n\n  # Show all projects\n  projects = client.Project.all\n  \n  projects.each do |project|\n    puts \"Project -\u003e key: #{project.key}, name: #{project.name}\"\n  end\n\n== Using the API Gem in your Rails application\n\nUsing oauth, the gem requires the consumer key and public certificate file (which\nare generated in their respective rake tasks) to initialize an access token for\nusing the JIRA API.\n\nNote that currently the rake task which generates the public certificate\nrequires OpenSSL to be installed on the machine.\n\nBelow is an example for setting up a rails application for OAuth authorization.\n\nEnsure the JIRA gem is loaded correctly\n\n  # Gemfile\n  ...\n  gem 'jira-ruby', :require =\u003e 'jira'\n  ...\n\nAdd common methods to your application controller and ensure access token\nerrors are handled gracefully\n\n  # app/controllers/application_controller.rb\n  class ApplicationController \u003c ActionController::Base\n    protect_from_forgery\n\n    rescue_from JIRA::OauthClient::UninitializedAccessTokenError do\n      redirect_to new_jira_session_url\n    end\n\n    private\n\n    def get_jira_client\n      \n      # add any extra configuration options for your instance of JIRA,\n      # e.g. :use_ssl, :ssl_verify_mode, :context_path, :site\n      options = {\n        :private_key_file =\u003e \"rsakey.pem\",\n        :consumer_key =\u003e 'test'\n      }\n\n      @jira_client = JIRA::Client.new(options)\n\n      # Add AccessToken if authorised previously.\n      if session[:jira_auth]\n        @jira_client.set_access_token(\n          session[:jira_auth][:access_token],\n          session[:jira_auth][:access_key]\n        )\n      end\n    end\n  end\n\nCreate a controller for handling the OAuth conversation.\n\n  # app/controllers/jira_sessions_controller.rb\n  class JiraSessionsController \u003c ApplicationController\n\n    before_filter :get_jira_client\n\n    def new\n      request_token = @jira_client.request_token\n      session[:request_token] = request_token.token\n      session[:request_secret] = request_token.secret\n\n      redirect_to request_token.authorize_url\n    end\n\n    def authorize\n      request_token = @jira_client.set_request_token(\n        session[:request_token], session[:request_secret]\n      )\n      access_token = @jira_client.init_access_token(\n        :oauth_verifier =\u003e params[:oauth_verifier]\n      )\n\n      session[:jira_auth] = {\n        :access_token =\u003e access_token.token,\n        :access_key =\u003e access_token.secret\n      }\n\n      session.delete(:request_token)\n      session.delete(:request_secret)\n\n      redirect_to projects_path\n    end\n\n    def destroy\n      session.data.delete(:jira_auth)\n    end\n  end\n\nCreate your own controllers for the JIRA resources you wish to access.\n\n  # app/controllers/issues_controller.rb\n  class IssuesController \u003c ApplicationController\n    before_filter :get_jira_client\n    def index\n      @issues = @jira_client.Issue.all\n    end\n\n    def show\n      @issue = @jira_client.Issue.find(params[:id])\n    end\n  end\n\n== Using the API Gem in your Sinatra application\n\nHere's the same example as a Sinatra application:\n\n  require 'jira'\n  class App \u003c Sinatra::Base\n    enable :sessions\n\n    # This section gets called before every request. Here, we set up the\n    # OAuth consumer details including the consumer key, private key,\n    # site uri, and the request token, access token, and authorize paths\n    before do\n      options = {\n        :site               =\u003e 'http://localhost:2990',\n        :context_path       =\u003e '/jira',\n        :signature_method   =\u003e 'RSA-SHA1',\n        :request_token_path =\u003e \"/plugins/servlet/oauth/request-token\",\n        :authorize_path     =\u003e \"/plugins/servlet/oauth/authorize\",\n        :access_token_path  =\u003e \"/plugins/servlet/oauth/access-token\",\n        :private_key_file   =\u003e \"rsakey.pem\",\n        :rest_base_path     =\u003e \"/rest/api/2\",\n        :consumer_key       =\u003e \"jira-ruby-example\"\n      }\n\n      @jira_client = JIRA::Client.new(options)\n      @jira_client.consumer.http.set_debug_output($stderr)\n\n      # Add AccessToken if authorised previously.\n      if session[:jira_auth]\n        @jira_client.set_access_token(\n          session[:jira_auth][:access_token],\n          session[:jira_auth][:access_key]\n        )\n      end\n    end\n\n\n    # Starting point: http://\u003cyourserver\u003e/\n    # This will serve up a login link if you're not logged in. If you are, it'll show some user info and a\n    # signout link\n    get '/' do\n      if !session[:jira_auth]\n        # not logged in\n        \u003c\u003c-eos\n          \u003ch1\u003ejira-ruby (JIRA 5 Ruby Gem) demo \u003c/h1\u003eYou're not signed in. Why don't you \n          \u003ca href=/signin\u003esign in\u003c/a\u003e first.\n        eos\n      else\n        #logged in\n        @issues = @jira_client.Issue.all\n\n        # HTTP response inlined with bind data below...\n        \u003c\u003c-eos\n          You're now signed in. There #{@issues.count == 1 ? \"is\" : \"are\"} #{@issues.count} \n          issue#{@issues.count == 1 ? \"\" : \"s\"} in this JIRA instance. \u003ca href='/signout'\u003eSignout\u003c/a\u003e\n        eos\n      end\n    end\n\n    # http://\u003cyourserver\u003e/signin\n    # Initiates the OAuth dance by first requesting a token then redirecting to \n    # http://\u003cyourserver\u003e/auth to get the @access_token\n    get '/signin' do\n      request_token = @jira_client.request_token\n      session[:request_token] = request_token.token\n      session[:request_secret] = request_token.secret\n\n      redirect request_token.authorize_url    \n    end\n\n    # http://\u003cyourserver\u003e/callback\n    # Retrieves the @access_token then stores it inside a session cookie. In a real app, \n    # you'll want to persist the token in a datastore associated with the user.\n    get \"/callback/\" do\n      request_token = @jira_client.set_request_token(\n        session[:request_token], session[:request_secret]\n      )\n      access_token = @jira_client.init_access_token(\n        :oauth_verifier =\u003e params[:oauth_verifier]\n      )\n\n      session[:jira_auth] = {\n        :access_token =\u003e access_token.token,\n        :access_key =\u003e access_token.secret\n      }\n\n      session.delete(:request_token)\n      session.delete(:request_secret)\n\n      redirect \"/\"\n    end\n\n    # http://\u003cyourserver\u003e/signout\n    # Expires the session\n    get \"/signout\" do\n      session.delete(:jira_auth)\n      redirect \"/\"\n    end\n  end","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgbevan%2Fjira-ruby-glb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgbevan%2Fjira-ruby-glb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgbevan%2Fjira-ruby-glb/lists"}