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.

1 Answer 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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.