jira-ruby gem limits the number of questions returned?

I am trying to extract issuses from JIRA using a gem called jira-ruby . The problem is that the result contains 70 problems, but I see only the first 50. When using the JIRA REST API directly, I can set the maxResults parameter (outside JQL) to a larger number. But I cannot find this opportunity in a ruby ​​pearl.

Is it possible to set the maxResults flag directly using this ruby ​​stone or any other equally simple solution?

The code is as follows:

require 'jira' class PagesController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception def home options = { :username => 'xxx', :password => 'xxx', :site => "https://xxx.atlassian.net", :context_path => '', :auth_type => :basic } client = JIRA::Client.new(options) @issues = 0 client.Issue.jql("project = AA AND fixVersion = it11").each do |issue| @issues += 1 # "#{@issues} <br> #{issue.id} - #{issue}" end end end 
+7
source share
1 answer

Well, finally found where the problem is. I used the 0.1.10 version of gem (the one that was downloaded by default with the gem install command) and this version (possibly) had this problem - at least it did not support the maxResults parameter in the jql method for problems. The solution was to load the gem from git by adding the following line to the Gemfile:

gem 'jira-ruby', :git => 'git://github.com/sumoheavy/jira-ruby.git'

Then I found in the code that the jql method accepts a hash where this parameter can be specified, so now the code is the following and it works:

 require 'jira' class PagesController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception def home p "processing..." options = { :username => 'xxx', :password => 'xxx', :site => "https://xxx.atlassian.net", :context_path => '', :auth_type => :basic } client = JIRA::Client.new(options) query_options = { :fields => [], :start_at => 0, :max_results => 100000 } @issues = '' client.Issue.jql('project = AA AND fixVersion = it11', query_options).each do |issue| @issues = "#{@issues} <br> #{issue}" #@issues.push(issue.id) end #@issues = @issues.length end end 

And I also had to upgrade the rail rail to version 4.1.4.

+8
source

Source: https://habr.com/ru/post/973359/


All Articles