sumoheavy / jira-ruby

A Ruby gem for the JIRA REST API
MIT License
656 stars 411 forks source link

Fix transition issue #358

Open trapeze-bell-peter opened 4 years ago

trapeze-bell-peter commented 4 years ago

I found two issues when trying to use jira-ruby to transition an issue:

1) The example provided in the example.rb file does not work. What one needs is a list of available transitions given the current state of the JIRA. issue.transitions.all does this. It provides an array that one can then look through to find the appropriate Id of the transition one wants to make.

2) Transition was using the default Base#save. However this does not generate the correct URL. It generates a URL in the form PUT https://jira-hostt/rest/api/2/issue/13322/transitions/34 with a JSON payload. What JIRA requires is a URL of the form: POST https://jira-hostt/rest/api/2/issue/13322/transitions with the correct JSON payload. This commit fixes this issue.

SimonMiaou commented 4 years ago

Hi @trapeze-bell-peter , Thank you for the PR!

Unfortunately I am not familiar with this part of the JIRA API and would love to have some external reviews and/or people testing it.

Could you also look into having tests for this change?

trapeze-bell-peter commented 4 years ago

Will add some tests and would welcome review.

trapeze-bell-peter commented 4 years ago

Just wanted to say sorry for not yet sorting out the tests. Been very busy. Hope to get to it this weekend.