sumoheavy / jira-ruby

A Ruby gem for the JIRA REST API
MIT License
654 stars 410 forks source link

SOLVED: save!() and save() have different standard-values for path, also issue.fetch() responds with HttpError #351

Closed AEckner closed 4 years ago

AEckner commented 4 years ago

If I want to Update an already fetched issue, and try

issue.save( { "fields" => { "summary" => "new value" } })

it doesn't work.

If I try EXACTLY the same, but with save!() (so with the exclamation mark) it works.

issue.save!( { "fields" => { "summary" => "new value" } })

This comes to be, because both methods have different standard values for the path- parameter, which seems pretty counter-intuitive. In one method nil is left as nil, in the other it's changed to issue["url"]. It looks like this has something to do with the "patched_url", but I'm not entirely sure.

AEckner commented 4 years ago

SOLVED: The problem was that I my "site"-parameter, that I used to generate the client object, ended on a "/" Many things worked without a problem, yet save() and especially fetch() (-> NEVER worked) didn't, without any obvious reason.

PLEASE, for the love of god, mention this somewhere in your setup-example.

JIRA::Client.new( { .... site => "http://mydomain.com/" .... } ) will cause unexpected behaviour and is a nightmare to debug. The correct way is: JIRA::Client.new( { .... site => "http://mydomain.com" .... } )

SimonMiaou commented 4 years ago

Hi @AEckner

Sorry we could not help you earlier. I'm glad you solve it tough.

PLEASE, for the love of god, mention this somewhere in your setup-example.

Please create a PR and we'll be happy to review and merge it :)