activeresource
activeresource copied to clipboard
self.site and self.prefix behaviour seems to be broken
class Base < ActiveResource::Base
self.site = "https://xxx.atlassian.net/rest/servicedeskapi/"
end
class Comment < Base
self.prefix = "/request/:request_id/"
end
Next getting comments by Comment.find(:all, params: { request_id: "XX-9"})
produces invalid URL:
E, [2022-06-13T20:22:21.229979 #49506] ERROR -- : GET https://xxx.atlassian.net:443/request/XX-9/comment.json
while the correct URL must include the /rest/servicedeskapi
part, as in site: https://xxx.atlassian.net:443/rest/servicedeskapi/request/xx-9/comment.json
I just checked the unit test code
what you can do for now is add self.site
setting in Comment class
class Base < ActiveResource::Base
self.site = "https://xxx.atlassian.net/rest/servicedeskapi/request/:request_id/"
end
using non-root site wouldn't work because your prefix has "/" in the first character
I have checked this in connection.rb file
def get(path, headers = {})
with_auth { request(:get, path, build_request_headers(headers, :get, self.site.merge(path))) }
end
site.merge("/request/:request_id")
will produce host/request/:request_id
maybe you can try with self.prefix = "request/:request_id", it might produce
"https://xxx.atlassian.net/rest/servicedeskapi/request/xx"` instead
This issue has been automatically marked as stale because it has not been commented on for at least three months. The resources of the Rails team are limited, and so we are asking for your help.
If it is an issue and you can still reproduce this error on the main
branch,
please reply with all of the information you have about it in order to keep the issue open.
If it is a pull request and you are still interested on having it merged please make sure it can be merged clearly.
Thank you for all your contributions.