1

I am missing something that should be very easy!

I am using oauth-plugin gem to access jira. I could easily build the consumer part, but now I don't know how to make a rest request.

It says in documentation:

enter image description here

The gem's author assumes that it is self-explanatory how to make a get/post-request. But I cannot figure it out.

I've tried to use Net::HTTP as follows:

uri = URI.parse('/oauth_consumers/jira/client/rest/api/2/project')
request = Net::HTTP.get(uri,{}) 

And I am getting Connection refused - connect(2) error.

I thought it could work, if I use current_user and his token (jira in my case):

current_user.jira.get('/oauth_consumers/jira/client/rest/api/2/project')

And RoR says that jira doesn't have such a method.

I've tried to search online, but there are very few projects that use oauth-plugin gem.

Thank you in advance.

4

1 回答 1

2

You are almost right with current_user.jira.get.
Just add client after jira and change path a little bit:

current_user.jira.client.get('/rest/api/2/project')

JiraToken doesn't have get method, while AccessToken (client) does.

于 2013-03-18T22:16:12.383 回答