From 7d91995d5e88ec4dec5d9db4c19df108f11eab9d Mon Sep 17 00:00:00 2001 From: Kali Hernandez Date: Wed, 20 Jun 2018 02:08:41 +0200 Subject: [PATCH] Fix API path definitions Fixes https://github.com/sumoheavy/jira-ruby/issues/291 Declares `path` for API GET calls using not `issue.self` (which produces full URIs) but `client.options[:rest_base_path]` Resulting API calls will not have repeated URIs which are raising `request_client.rb:16:in `request': JIRA::HTTPError` Works For Me (TM) --- lib/jira/resource/remotelink.rb | 2 +- lib/jira/resource/transition.rb | 2 +- lib/jira/resource/watcher.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/jira/resource/remotelink.rb b/lib/jira/resource/remotelink.rb index 42ec601e..c49f1490 100644 --- a/lib/jira/resource/remotelink.rb +++ b/lib/jira/resource/remotelink.rb @@ -17,7 +17,7 @@ def self.all(client, options = {}) raise ArgumentError.new("parent issue is required") end - path = "#{issue.self}/#{endpoint_name}" + path = client.options[:rest_base_path] + "/issue/#{issue.key}/#{endpoint_name}" response = client.get(path) json = parse_json(response.body) json.map do |link| diff --git a/lib/jira/resource/transition.rb b/lib/jira/resource/transition.rb index e8ff1cff..3b60eb02 100644 --- a/lib/jira/resource/transition.rb +++ b/lib/jira/resource/transition.rb @@ -20,7 +20,7 @@ def self.all(client, options = {}) raise ArgumentError.new("parent issue is required") end - path = "#{issue.self}/#{endpoint_name}?expand=transitions.fields" + path = client.options[:rest_base_path] + "/issue/#{issue.key}/#{endpoint_name}?expand=transitions.fields" response = client.get(path) json = parse_json(response.body) json['transitions'].map do |transition| diff --git a/lib/jira/resource/watcher.rb b/lib/jira/resource/watcher.rb index 31b77292..587ebe95 100644 --- a/lib/jira/resource/watcher.rb +++ b/lib/jira/resource/watcher.rb @@ -19,7 +19,7 @@ def self.all(client, options = {}) raise ArgumentError.new("parent issue is required") end - path = "#{issue.self}/#{endpoint_name}" + path = client.options[:rest_base_path] + "/issue/#{issue.id}/#{endpoint_name}" response = client.get(path) json = parse_json(response.body) json['watchers'].map do |watcher|