Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Fetch all epics using ruby-jira gem

Chinmaya Patanaik May 24, 2018

I've been playing with Jira API via the `ruby-jira` gem. I have a task where I would like to list all the epics that belong to a user's account. My current solution is to get all the issues and return items with `issuetype` name set to `Epic`.

def list_epics

  epics = []

  begin
    all_issues = @Integration Team_client.Issue.all
    all_issues.each do |issue|
      epics << issue if issue.fields.issuetype.name == 'Epic
    end
  rescue JIRA::HTTPError
    puts "Jira API error"
  end
  epics
end

`@jira_client` represents an authenticated user account.

I couldn't find much information from the documentation page of `jira-ruby` project. So any help is appreciated.

1 answer

0 votes
Tarun Sapra
Community Champion
May 24, 2018

Hello @Chinmaya Patanaik

Since your requirement is " I have a task where I would like to list all the epics that belong to a user's account."

Thus, in the ruby gem you can check if there is support for doing a JQL query (there must be)

The you can fire a JQL query like "type = epic and assignee = <user-account>" and thus the results from the call based on the above JQL should get you the results you want.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events