Git Product home page Git Product logo

jira-ruby's People

Contributors

adambedford avatar akolomiychuk avatar arincon9 avatar bobbrodie avatar cbelsole avatar dafalcon-aka avatar derrudi77 avatar garciaf avatar glsignal avatar grundic avatar halyph avatar jcouball avatar kalinon avatar kevinbutterfield avatar legkvla avatar ljharb avatar marlinpierce avatar orangewolf avatar peterbell215 avatar rmanalan avatar samanthakem avatar sandychapman avatar shirish-pampoorickal avatar siarheifedartsou avatar sikora avatar simonmiaou avatar smcfarlane avatar thebluber avatar wireframe avatar yrb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jira-ruby's Issues

Issue All error

I'm getting an error when running 'client.Issue.all' when running code in the console. Any help is greatly appreciative.

JRuby 1.7.10
Mac

Trace:

jruby-1.7.10 :029 > client.Issue.all
NoMethodError: undefined method split' for :expand:Symbol from /Users/bxiong/.rvm/rubies/jruby-1.7.10/lib/ruby/1.9/net/http.rb:1598:incapitalize'
from /Users/bxiong/.rvm/rubies/jruby-1.7.10/lib/ruby/1.9/net/http.rb:1591:in each_capitalized' from org/jruby/RubyHash.java:1338:ineach'
from /Users/bxiong/.rvm/rubies/jruby-1.7.10/lib/ruby/1.9/net/http.rb:1590:in each_capitalized' from /Users/bxiong/.rvm/rubies/jruby-1.7.10/lib/ruby/1.9/net/http.rb:2081:inwrite_header'
from /Users/bxiong/.rvm/rubies/jruby-1.7.10/lib/ruby/1.9/net/http.rb:1933:in exec' from /Users/bxiong/.rvm/rubies/jruby-1.7.10/lib/ruby/1.9/net/http.rb:1325:intransport_request'
from org/jruby/RubyKernel.java:1282:in catch' from /Users/bxiong/.rvm/rubies/jruby-1.7.10/lib/ruby/1.9/net/http.rb:1324:intransport_request'
from /Users/bxiong/.rvm/rubies/jruby-1.7.10/lib/ruby/1.9/net/http.rb:1301:in request' from /Users/bxiong/.rvm/gems/jruby-1.7.10@test/gems/rest-client-1.6.7/lib/restclient/net_http_ext.rb:51:inrequest'
from /Users/bxiong/.rvm/rubies/jruby-1.7.10/lib/ruby/1.9/net/http.rb:1294:in request' from /Users/bxiong/.rvm/rubies/jruby-1.7.10/lib/ruby/1.9/net/http.rb:745:instart'
from /Users/bxiong/.rvm/rubies/jruby-1.7.10/lib/ruby/1.9/net/http.rb:1292:in request' from /Users/bxiong/.rvm/gems/jruby-1.7.10@test/gems/rest-client-1.6.7/lib/restclient/net_http_ext.rb:51:inrequest'
from /Users/bxiong/.rvm/gems/jruby-1.7.10@test/gems/jira-ruby-0.1.8/lib/jira/http_client.rb:22:in make_request' from /Users/bxiong/.rvm/gems/jruby-1.7.10@test/gems/jira-ruby-0.1.8/lib/jira/request_client.rb:13:inrequest'
from /Users/bxiong/.rvm/gems/jruby-1.7.10@test/gems/jira-ruby-0.1.8/lib/jira/client.rb:151:in request' from /Users/bxiong/.rvm/gems/jruby-1.7.10@test/gems/jira-ruby-0.1.8/lib/jira/client.rb:130:inget'
from /Users/bxiong/.rvm/gems/jruby-1.7.10@test/gems/jira-ruby-0.1.8/lib/jira/resource/issue.rb:37:in all' from /Users/bxiong/.rvm/gems/jruby-1.7.10@test/gems/jira-ruby-0.1.8/lib/jira/base_factory.rb:33:inall'
from (irb):29:in evaluate' from org/jruby/RubyKernel.java:1119:ineval'
from org/jruby/RubyKernel.java:1519:in loop' from org/jruby/RubyKernel.java:1282:incatch'
from org/jruby/RubyKernel.java:1282:in catch' from /Users/bxiong/.rvm/gems/jruby-1.7.10@test/gems/railties-3.2.17/lib/rails/commands/console.rb:47:instart'
from /Users/bxiong/.rvm/gems/jruby-1.7.10@test/gems/railties-3.2.17/lib/rails/commands/console.rb:8:in start' from /Users/bxiong/.rvm/gems/jruby-1.7.10@test/gems/railties-3.2.17/lib/rails/commands.rb:41:in(root)'
from org/jruby/RubyKernel.java:1083:in require' from script/rails:6:in(root)'jruby-1.7.10 :030 >

Adding jql to QUERY_PARAMS_FOR_SEARCH

I tried in many ways to make project.issues and Issue.jql give me all the issues that are Stories but failed to do so.

project.issues({ :jql => "project="#{current_product.jira_id}" and issuetype="Story"", :startAt => 0, :maxResults => -1 }) just gives me all the issues because the :jql paramater is removed due to query_params_for_search removing it ... and a solution would be adding the :jql parameter to QUERY_PARAMS_FOR_SEARCH in base.rb (i forked the project and tested this locally and it works)

JIRA::Resource::Issue.jql(client, "project="#{current_product.jira_id}" and issuetype="Story"") gives me just 50 user stories ... I couldn't specify the startAt and maxResults parameters, trying to add them to the jql string doesn't work because of the CGI.escape

The advantage in adding the :jql parameter is that you can make custom queries using project.issues and still have the maxResults and startAt options ... I'm pretty new to this so I may have missed something obvious (sorry in advance :p).
Any help would greatly be appreciated.

debug_output option

Could you please add debug_output option like the following:

Usage:

options = {
...
:debug_output => false # $stderr
}

Change

jira/http_client.rb

def http_conn(uri)
  http_conn = Net::HTTP.new(uri.host, uri.port)
  ...
  if @options[:debug_output]
    http_conn.set_debug_output @options[:debug_output]
  end
 ...

And similar for oauth_client probably, I guess this code in readme is not valid:

@jira_client.consumer.http.set_debug_output($stderr)

Thank you!

P.S. thank you for the great gem! I'm trying it for creating worklogs, and it works, e.g.:

issue = client.Issue.find('TEST-3')
worklog = issue.worklogs.build
worklog.save!(:started => "2012-09-29T09:00:00.000+0000", :timeSpentSeconds => 3600, :comment => "test")

Add support for 'resolution' field

Hey chaps,

I'm using this gem for a nice little script to create a html report of project work from JIRA. It's lovely so first of all thanks for all the good work.

Secondly, I'm doing a nasty hack[1] to get access to the resolution field but it strikes me that it would be better if I or another would add support for this in the same way that, say, status is supported[2].

I've done a little research and it looks to me that the json that is returned as the resolution field is not dis-similar in structure from that which is returned from status field [3]. So is adding support for resolution as simple as adding the below change to issue.rb?

has_one :resolution,    :nested_under => 'fields'

Kind regards,
Adam.

[1]

resolution = JSON.parse(issue.to_json)["fields"]["resolution"]["name"]

[2]

status = issue.status.name

[3]

DEBUG: JSON.parse(issue.status.to_json)
{"self"=>"https://steelzebra.atlassian.net/rest/api/2/status/6",
 "description"=>
  "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.",
 "iconUrl"=>
  "https://steelzebra.atlassian.net/images/icons/statuses/closed.png",
 "name"=>"Closed",
 "id"=>"6",
 "statusCategory"=>
  {"self"=>"https://steelzebra.atlassian.net/rest/api/2/statuscategory/3",
   "id"=>3,
   "key"=>"done",
   "colorName"=>"green",
   "name"=>"Complete"}}
--------
DEBUG: JSON.parse(issue.to_json)["fields"]["resolution"]
{"self"=>"https://steelzebra.atlassian.net/rest/api/2/resolution/1",
 "id"=>"1",
 "description"=>"A fix for this issue is checked into the tree and tested.",
 "name"=>"Fixed"}
--------

Validation errors not passed through to client

Hi,

Say I have a Required custom field, and attempt to create a JIRA issue without specifying it:

issue = client.Issue.build
issue.save({"fields"=>{"summary"=>"blarg from in example.rb","project"=>{"id"=>"12300"},"issuetype"=>{"id"=>"20"}}})

The error is highly cryptic: "Method Not Allowed":

/usr/local/lib/ruby/gems/2.1.0/gems/jira-ruby-0.1.13/lib/jira/request_client.rb:14:in `request': Method Not Allowed (JIRA::HTTPError)
    from /usr/local/lib/ruby/gems/2.1.0/gems/jira-ruby-0.1.13/lib/jira/client.rb:159:in `request'
    from /usr/local/lib/ruby/gems/2.1.0/gems/jira-ruby-0.1.13/lib/jira/client.rb:138:in `get'
    from /usr/local/lib/ruby/gems/2.1.0/gems/jira-ruby-0.1.13/lib/jira/base.rb:339:in `fetch'
    from ./createtestpos.rb:13:in `<main>'

The real error message ("$field is required.") should be parsed out of the 400 response and returned.

Compatibility with Rails 4.2

Bundler could not find compatible versions for gem "activesupport":
  In Gemfile:
    jira-ruby (>= 0) ruby depends on
      activesupport (~> 4.1.4) ruby

Running a rake, fails and asks for a delegation target

I am trying to use the gem with ruby 1.8.7 and rails 3.0.7.
However it gives me a error when trying to generate a consumer key or when i try to run a rake task.

Delegation needs a target. Supply an options hash with a :to key as the last argument (e.g. delegate :hello, :to => :greeter).
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.7/lib/active_support/core_ext/module/delegation.rb:109:in delegate' /usr/lib/ruby/gems/1.8/gems/jira-ruby-0.0.3/lib/jira/http_error.rb:7 /usr/lib/ruby/gems/1.8/gems/jira-ruby-0.0.3/lib/jira.rb:11:inrequire'
/usr/lib/ruby/gems/1.8/gems/jira-ruby-0.0.3/lib/jira.rb:11
/usr/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/runtime.rb:68:in require' /usr/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/runtime.rb:68:inrequire'
/usr/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/runtime.rb:66:in each' /usr/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/runtime.rb:66:inrequire'
/usr/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/runtime.rb:55:in each' /usr/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/runtime.rb:55:inrequire'
/usr/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler.rb:120:in `require'

Errno::EINVAL: Invalid argument - C:/Ruby193/lib/ruby/gems/1.9.1/gems/jira-ruby-0.0.3/spec/mock_responses/user?username=

I am having an issue installing this gem with and without Bundler. I am using Windows 7. Searches for this error come up with zero hits...

The full error is:

Installing jira-ruby (0.0.3)
Errno::EINVAL: Invalid argument - C:/Ruby193/lib/ruby/gems/1.9.1/gems/jira-ruby-0.0.3/spec/mock_responses/user?username=
admin.json
An error occured while installing jira-ruby (0.0.3), and Bundler cannot continue.
Make sure that gem install jira-ruby -v '0.0.3' succeeds before bundling.

Please let me know if this means anything to anyone. Thanks.

Init client via Basic Auth

Hello ,
I need help for the simplest thing!
I am trying to init the client via basic Auth locally.

  • I set up the Jira sdk
  • I configured Jira Application Links with http://localhost:3000
  • I added the gem to my gemfile

Then, when I try to run this simple script in my rails console

username = "admin"
password = "admin"
options = {
        :username => username,
        :password => password,
        :ssl_verify_mode    =>OpenSSL::SSL::VERIFY_NONE ,
        :auth_type          => :basic
}
client = JIRA::Client.new(options)
projects = client.Project.all

I got the error

OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol

What did I do wrong ?

EDIT: Found my mistake I did not need ssl in this case
Thanks

more information

Can you provide more information in the readme for "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." What is the provided rake task for generating the consumer key? For example the command needed to execute the rake task to generate the consumer key.

Gem is not 1.8 compatible, requires 1.9

Just filing this as an FYI for people, not sure if the docs already mention this or if it should even be fixed, it just confused me a bit.

(15:05:07):cmyers@cmyers-ubuntu:3 master] rvm use ruby-1.8.7-p352
Using /home/cmyers/.rvm/gems/ruby-1.8.7-p352
(15:06:17):cmyers@cmyers-ubuntu:3 master] ruby -c ./lib/jira/oauth_client.rb
./lib/jira/oauth_client.rb:74: syntax error, unexpected ')', expecting '='
./lib/jira/oauth_client.rb:84: syntax error, unexpected kEND, expecting $end
(15:06:20):cmyers@cmyers-ubuntu:3 master] rvm use ruby-1.9.2-p180
Using /home/cmyers/.rvm/gems/ruby-1.9.2-p180
(15:06:26):cmyers@cmyers-ubuntu:3 master] ruby -c ./lib/jira/oauth_client.rb
Syntax OK

Upload attachment

Hello guys, is there a way to upload an attachment using your gem?
Thanks for your time

Too many dependencies

Hello everyone,

I am currently using this gem for a commandline utility that fetches information from JIRA.

I only use the Basic Authentication (username and password).

But this whole project has a huge dependecy tree as rack/activesupport/activemodel etc... are required.

I'm pretty sure that most of the gems are not required if you are not using OAuth.

So is there a way to reduce the dependencies if you only use a subset of the functionality (e.g. split this project in smaller projects)

CLI OAuth verifier

I am trying to Oauth verifier using CLI. Can I use Oauth verifier for CLI? If yes than give me some idea how can I work with that. Last couple of week I am trying that but I cant get success.

Thanks.
Divyang

Not possible to update an existing issue?

I've spent about the last six hours trying to figure out how to use the JIRA API from Ruby, using this gem, to create, update, and comment on an issue in JIRA. Simple, right? NO. This gem is so poorly documented that it took hours just to log into our JIRA account with it because the secret of using :context => '' is not mentioned anywhere and I had to figure it out myself. Then I had to figure out how to find the IDs for projects and issue types by inspecting the HTML from atlassian.net and I was finally able to post an issue.

Updating an existing issue, however, is a complete mystery. I'm guessing that it will be like the other issues: that it will work if I can find some sample code somewhere. The sample code in the documentation for updating records absolutely does not work. Now I'm just throwing things against the wall to see if anything sticks. I seriously think that I would have been better off pulling out Capybara and writing a web bot to do this instead of trying to use this terrible API gem.

Here are a few examples of failed attempts to post an update to an existing issue. I get a 400 response and no error messages in the issue's data structure.

client = JIRA::Client.new(options)
issue = client.Issue.find('ENG-23')
begin
  issue.save!(
      {
        'fields' =>
          {
            'description' => 'This story was posted by a bot.'
          }      
      }
    )
rescue JIRA::HTTPError => e
  puts e.response.code
  puts e.response.message
  puts e.response.body  
end 

Result:

$ bundle exec ruby jira.rb 
400
Bad Request
<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx</center>
</body>
</html>

That mirrors the structure used to create that same issue, with the fields nested under 'fields'. But obviously it doesn't work. And it provides absolutely no hint about why it didn't work.

Another attempt:

client = JIRA::Client.new(options)
issue = client.Issue.find('ENG-23')
begin
  issue.save!(
      {
        'description' => 'This story was posted by a bot.'
      }
    )
rescue JIRA::HTTPError => e
  puts e.response.code
  puts e.response.message
  puts e.response.body  
end 

Result:

$ bundle exec ruby jira.rb 
400
Bad Request
<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx</center>
</body>
</html>

Another attempt:

client = JIRA::Client.new(options)
issue = client.Issue.find('ENG-23')
issue.set_attrs(
    {
      'fields'=>
        {
          'summary' => 'Hello, World!',
          'description' => 'This story was posted by a bot.',
          'project' => {'id' => 10207}, # ENG -- Engineering,
          'issuetype' => {'id' => 10206} # Story
        }
    }
  )
begin
  issue.save!({})
rescue JIRA::HTTPError => e
  puts e.response.code
  puts e.response.message
  puts e.response.body  
end 

Result:

$ bundle exec ruby jira.rb 
400
Bad Request
<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx</center>
</body>
</html>

Another attempt:

client = JIRA::Client.new(options)
issue = client.Issue.find('ENG-23')
begin
  issue.save!(
      {
        'fields'=>
          {
            'summary' => 'Hello, World!',
            'description' => 'This story was posted by a bot.',
            'project' => {'id' => 10207}, # ENG -- Engineering,
            'issuetype' => {'id' => 10206} # Story
          }
      }
    )
rescue JIRA::HTTPError => e
  puts e.response.code
  puts e.response.message
  puts e.response.body  
end 

Same result.

The real issue here is that I'm an idiot for wasting so much of my time on trying to make this work when it's obviously never going to work. Is that correct? Or can this gem actually update issues in JIRA?

If this gem can't update issues in JIRA then why is it wasting space on GitHub?

Fetching an Issue over SSL fails without specifying :443

I'm using 0.1.9, connecting to a local jira instance over ssl.

When doing a standard issue creation per the example, I get a bad response code when I do an issue.fetch:

/usr/lib/ruby/1.9.1/net/http.rb:2565:in `read_status_line': wrong status line: "<html>" (Net::HTTPBadResponse)

I'm doing:

issue.save(issue_json)  #works
issue.fetch # HTTPBadResponse
pp issue

This works, however, if I set my :site to have :443 in the url.

With wireshark I can confirm that there isn't any traffic going over http (80), so issue.fetch is going over 443, even if I don't explicitly say to.

To reiterate: this issue.fetch works with:

:site => 'https://jira.mycompany.com:443/',

HTTPBadResponse with

:site => 'https://jira.mycompany.com/',

I don't really know how to help more besides making the issue. If you can hint at where I should be looking to debug this, please let me know and I can investigate more.

I can manually have :443 in my :stite as a workaround for now.

Error in lib/jira/cli.rb:24

Requiring 'jira' fails for me in 1.9.3p194 due to a rogue colon at the end of line 24 in cli.rb

Removing it fixes the problem.

JIRA 6.5: Saving Fields consistently throws a 400: Bad Request

I have debugged this and found that the base.rb - url method (when hitting the if @attrs['self'] case) was not utilizing the prefix and creating urls that did not start with a slash (/) prefix. I'm going to issue a pull request to address this.

I have tested it and found it to work for Jira 6.5. I would assume this will be a universal fix, though.

Delete does not work on resources

Hi,
I want to delete a resource which doesn't seem to work for me:

new_issue = client.Issue.build()
new_issue.save({"fields"=>{"summary"=>"test 123","project"=>{"key"=>"JIRA"}, :issuetype => {:name => 'Bug'}}})
new_issue.delete

or

issue = client.Issue.find('JIRA-123')
issue.comments.last.delete

or others (e.g. version)
will always result in:

/lib/ruby/gems/1.9.1/gems/jira-ruby-0.1.10/lib/jira/request_client.rb:14:in `request': Bad Request (JIRA::HTTPError)
    from /lib/ruby/gems/1.9.1/gems/jira-ruby-0.1.10/lib/jira/client.rb:155:in `request'
    from /lib/ruby/gems/1.9.1/gems/jira-ruby-0.1.10/lib/jira/client.rb:130:in `delete'
    from /lib/ruby/gems/1.9.1/gems/jira-ruby-0.1.10/lib/jira/base.rb:405:in `delete'
...

I'm running jira-ruby against a Jira version 6.1.5 and the same user can do deletes via http REST calls.

Thanks in advance.

JQL with expanded changelog

You can use the issue finder to get the changelog but not sql. This can cause an excess of queries. Is there a way around this? I can't seem to find a way to pass in expand=changelog into the jql function just: jql, fields, startAt, and maxResults. Source

client.Issue.jql('project = VIT AND sprint in openSprints()').each do |issue|
  issue = client.Issue.find(issue.key, {expand: 'changelog'})
end

Incompatible with latest Sinatra

I dont know if this will ever get picked up but this gem is now incompatible with Sinatra as they depend on conflicting versions of rack:

Bundler could not find compatible versions for gem "rack":
  In Gemfile:
    jira-ruby (>= 0) ruby depends on
      rack (~> 1.2.1) ruby

    sinatra (>= 0) ruby depends on
      rack (1.5.2)

Please provide a jira-ruby example that runs on the command-line

First off, thank you very much for the gem. It certainly looks promising. No doubt, as soon as I figure out to harness the power of this gem is will help us a great deal. I have tried to take the examples you provide and turn them into a command-line jira capable app, but alas to no avail.

when I tried my own adaptation I see this

/usr/local/lib/ruby/gems/1.9.1/gems/jira-ruby-0.0.3/lib/jira/client.rb:132:in access_token': init_access_token must be called before using the client (JIRA::Client::UninitializedAccessTokenError) from /usr/local/lib/ruby/gems/1.9.1/gems/jira-ruby-0.0.3/lib/jira/client.rb:164:inrequest'
from /usr/local/lib/ruby/gems/1.9.1/gems/jira-ruby-0.0.3/lib/jira/client.rb:141:in get' from /usr/local/lib/ruby/gems/1.9.1/gems/jira-ruby-0.0.3/lib/jira/base.rb:333:infetch'
from /usr/local/lib/ruby/gems/1.9.1/gems/jira-ruby-0.0.3/lib/jira/base.rb:108:in find' from /usr/local/lib/ruby/gems/1.9.1/gems/jira-ruby-0.0.3/lib/jira/base_factory.rb:33:inblock (2 levels) in delegate_to_target_class'

--code snippet --

  options   = Hash.new()
  home   = "/home/noel/work/dataPuller"
  options = {
    :site               => 'http://localhost:2990',
    :signature_method   => 'RSA-SHA1',
    :request_token_path => "#{home}/oauth/request-token",
    :authorize_path     => "#{home}/oauth/authorize",
    :access_token_path  => "#{home}/jira/plugins/servlet/oauth/access-token",
    :private_key_file   => "#{home}/sslKeys/rsakey.pem",
    :rest_base_path     => "/jira/rest/api/2"
  }


  @jira_client = JIRA::Client.new('jira-ruby-example', '', options)
  @jira_client.consumer.http.set_debug_output($stderr)

  project = @jira_client.Project.find('test issue1 for Jira REST API')
  project.issues.each do |issue|
    puts "#{issue.id} - #{issue.summary}"
  end

-- end code snippet --

when I tried firing up the sinatra example I see this

[2012-06-07 15:43:47] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
localhost - - [07/Jun/2012:15:43:47 PDT] "GET /sinatra/404.png HTTP/1.1" 304 0
http://localhost:4567/?Response -> /sinatra/404.png
localhost - - [07/Jun/2012:15:43:47 PDT] "GET /favicon.ico HTTP/1.1" 404 447

  • -> /favicon.ico
    localhost - - [07/Jun/2012:15:43:56 PDT] "GET /&Response HTTP/1.1" 404 445
  • -> /&Response
    localhost - - [07/Jun/2012:15:43:56 PDT] "GET /favicon.ico HTTP/1.1" 404 447
  • -> /favicon.ico

any help is greatly appreciated.
note * do have the prep in place for OAuth, that appears to be okay.

How to get all issues assigned to the current user?

Sorry, I didn't see a mailing list for posting this question...I'm getting started using this gem and would like to know how I can get the issues assigned to the current user (ideally the issues assigned to that user for the current sprint). I can't seem to find an example of how to do this. Any tips would be a big help. Thanks!

Syntax error from jira/cli

/Users/kevzettler/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/jira-0.1.0/lib/jira/cli.rb:28: warning: else without rescue is useless
/Users/kevzettler/.rbenv/versions/1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:45:in `require': /Users/kevzettler/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/jira-0.1.0/lib/jira/cli.rb:24: syntax error, unexpected ':', expecting keyword_then or ',' or ';' or '\n' (SyntaxError)
/Users/kevzettler/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/jira-0.1.0/lib/jira/cli.rb:65: syntax error, unexpected keyword_end, expecting $end
    from /Users/kevzettler/.rbenv/versions/1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:45:in `require'
    from /Users/kevzettler/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/jira-0.1.0/lib/jira.rb:5:in `<top (required)>'
    from /Users/kevzettler/.rbenv/versions/1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:110:in `require'
    from /Users/kevzettler/.rbenv/versions/1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:110:in `rescue in require'
    from /Users/kevzettler/.rbenv/versions/1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:35:in `require'
    from jira_api.rb:3:in `<main>'

errant ':'

Just pulled this from github and got:
gems/jira-0.1.0/lib/jira/cli.rb:24: syntax error, unexpected ':'

case action
when 'list': <<<<<<

undefined method `downcase' for nil:NilClass

undefined method `downcase' for nil:NilClass
Extracted source (around line #5):
4. def new
5. request_token = @jira_client.request_token
6. session[:request_token] = request_token.token
7. session[:request_secret] = request_token.secret

app/controllers/jira_sessions_controller.rb:5:in `new'

Plans for allowing Basic Auth in addition to OAuth?

Great work so far on the gem!

I wanted to ask whether you plan to support basic auth in addition to OAuth with this gem. I'm working on a command line utility that I'd love to use this gem for, but OAuth is a non-starter since the people using the gem might not have administrative rights to the JIRA instance they want to work with (and additionally, supplying a user name and password isn't as big a deal if it's staying on their local machine)

I'd love to help out and implement this - looking at the code, it seems like it wouldn't be too difficult to have two client subclasses - one for OAuth and one for basic auth (they probably wouldn't have too much unique functionality outside of request and some oauth specific things), but obviously that would involve a breaking change for how you initialize the client.

I'm happy to go ahead with this if you're interested and are willing to accept a breaking change.

Support for OnDemand

Hi - ran into you at Summit2012 and was visiting this code for use in our OnDemand instance.

It appears that OnDemand doesn't offer the option to register these OAuth links. Maybe I'm missing something here...
If that is the case - do you know what options are available for connecting to Jira OnDemand?
If that is not the case - can you provide me with a hint on where to find this in the admin? I've been searching for Application Links and am coming up empty.

Add support for expanded responses

From https://docs.atlassian.com/jira/REST/5.2.11/:

In order to minimise network traffic and server CPU usage, the JIRA REST API sometimes uses a technique called expansion. When a REST resource uses expansion then parts of that resource will not be included in the JSON response unless explicitly requested. The way to request those fragments to be included is by using the expand query parameter.

You can use the expand query parameter to specify a comma-separated list of entities that you want expanded, identifying each of them by name. For example, appending ?expand=names,renderedFields to an issue's URI requests the inclusion of the translated field names and the HTML-rendered field values in the response. Continuing with our example above, we would use the following URL to get that information for JRA-9:

https://jira.atlassian.com/rest/api/latest/issue/JRA-9?expand=names,renderedFields

Irregular Inflector rule for 'status' breakes my routes

Hey guys,

You've added irregular Inflector rule for word 'status':

require 'active_support/inflector'
ActiveSupport::Inflector.inflections do |inflector|
  inflector.singular 'status', 'status'
end

But it breakes my application routes.

Without jira-ruby gem:

$ rake routes | grep work_order_statuses
                                   work_order_statuses GET    /work_order/statuses(.:format)                                                                                                                            work_order/statuses#index

With jira-ruby gem:

$ rake routes | grep work_order_statuses
                             work_order_statuses_index GET    /work_order/statuses(.:format)                                                                                                                            work_order/statuses#index

Why do you think singular form of 'statuses' should be 'statuses'?

Saving/deleting a comment doesn't work with Jira 6

I can confirm saving/deleting a comment doesn't work in 0.1.11

The reason is, during a request, url path has the first character "/" being removed.

See working "GET issues" vs not working "PUT comment".
I traced it by putting custom logs inside lib/jira/http_client.rb#make_request

get
/rest/api/2/issue/MWS-303
{"Accept"=>"application/json"}

vs not working, and resulting in:
lib/jira/request_client.rb:14:in `request': Bad Request (JIRA::HTTPError)

:put
"rest/api/2/issue/30259/comment/41171"
{"Content-Type"=>"application/json"}
"{\"body\":\"cccc\"}"

Saving customfields

I'm running into a Bad Format response when I attempt to set the value of a CustomField that was previously nil.
If it already exists, on the simple case it's a String, then the same works fine by setting the payload to:
issue.save(:fields=>{:customfield_11433 => "New Value"})

But if issue.fields[:customfield_1433] is nil then this will not work correctly and returns BadRequest.
Ironically, the Atlassian documentation is a little thin on how to do this.

Create Project example

Hi,
I was trying the gem and works very well for me. I could Find Project, create Issues, etc.

The question is about create a new Project using the gem. It's supported by the gem?

There is a working example for try for create Projects?
I was trying with different attributes, but I'm getting false in the save.
May be could be nice to show the error message in case some issue in save in case the api return that information.
thanks!

Linking issues

Hello

Is there a way to create link relationships between issues? I need to do it both within the same JIRA instance and across multiple instances.

Thanks!

getting error

I have setup a new rails 3.2 to test out this gem, and copied the code in the readme. When I try to access the controller I'm getting the following error.

uninitialized constant JIRA::Client

Started GET "/index/index" for 127.0.0.1 at 2012-02-15 10:29:21 -0600

ActionController::RoutingError (uninitialized constant JIRA::Client):
app/controllers/application_controller.rb:3:in <class:ApplicationController>' app/controllers/application_controller.rb:1:in<top (required)>'
app/controllers/index_controller.rb:1:in `<top (required)>'

the top required part is the "jira" I'm not sure if that is even correct since it can't find the file.

This is what I have on my gem file gem 'jira-ruby', :git => 'git://github.com/trineo/jira-ruby.git'

exception when attempting to update description of an issue

When running the code in gist below, I get the following exception:

/Users/shoop/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http/response.rb:41:in `read_status_line': wrong status line: "" (Net::HTTPBadResponse)

https://gist.github.com/ShoopIndy/5607733

This happens with both 1.9.3 and 2.0.

I can post a new comment just fine, but I can't seem to put to an existing issue.

Am I doing something wrong (PEBKAC), or is the JIRA API not providing a valid response?

all Method does not return all

By default is seems that Jira will only return the top 50 results from a search. What this means if you you really want to iterate all results with this gem, you cannot. Imagine that you had 100 Issues and you called

client.Issue.all.each do |issue|
  puts "#{issue.id} - #{issue.fields['summary']}"
end

Only 50 Issues would be returned.

Lock down dependency versions

It seems the build is failing because:

 1) JIRA::Resource::Attachment it should behave like a resource gracefully handles non-json responses

Failure/Error: subject.save('foo' => 'bar').should be_false

expected false to respond to `false?`

Shared Example Group: "a resource" called from ./spec/integration/attachment_spec.rb:19

# ./spec/support/shared_examples/integration.rb:62:in `block (2 levels) in <top (required)>'

This is because the truthiness methods were changed in Rspec 3.0. I suggest fixing the tests and locking down the dependencies to stop this from happening again.

Transitions

is there anything that does transitions or is there an example?

require 'jira' / API Gem in a command line application broken

I cannot require the 'jira' gem in ruby 1.9.3-p484. In either a OSX or Win7 environment, both with same version of ruby. Please fix! Would really like to use this gem.

Here is the error.

irb(main):001:0> require 'pp'
=> true
irb(main):002:0> require 'jira'
/Users/daviss/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/jira-0.1.0/lib/jira/cli.rb:28: warning: else without rescue is useless
SyntaxError: /Users/daviss/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/jira-0.1.0/lib/jira/cli.rb:24: syntax error, unexpected ':', expecting keyword_then or ',' or ';' or '\n'
/Users/daviss/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/jira-0.1.0/lib/jira/cli.rb:65: syntax error, unexpected keyword_end, expecting $end
from /Users/daviss/.rbenv/versions/1.9.3-p484/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require' from /Users/daviss/.rbenv/versions/1.9.3-p484/lib/ruby/1.9.1/rubygems/custom_require.rb:36:inrequire'
from /Users/daviss/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/jira-0.1.0/lib/jira.rb:5:in <top (required)>' from /Users/daviss/.rbenv/versions/1.9.3-p484/lib/ruby/1.9.1/rubygems/custom_require.rb:60:inrequire'
from /Users/daviss/.rbenv/versions/1.9.3-p484/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in rescue in require' from /Users/daviss/.rbenv/versions/1.9.3-p484/lib/ruby/1.9.1/rubygems/custom_require.rb:35:inrequire'
from (irb):2
from /Users/daviss/.rbenv/versions/1.9.3-p484/bin/irb:12:in `

'
irb(main):003:0> require 'rubygems'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.