sumoheavy / jira-ruby

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

Supporting proxy option pass to oauth gem #362

Closed dgonzalezmbc closed 4 years ago

dgonzalezmbc commented 4 years ago

Fix For following scenario:

When trying to authenticate using a local instance of Jira through Oauth gem, the proxy option is needed in the Consumer.rb, but currently the option is rejected on the Client.rb class or jira-ruby.

This pr will create the proxy option when detecting the existence of proxy_address supporting both gems at the same time.

Oauth gem > Consumer.rb

Screen Shot 2020-07-09 at 11 55 14 AM Screen Shot 2020-07-09 at 11 54 51 AM

SimonMiaou commented 4 years ago

Hi @dgonzalezmbc Thank you for the PR but I'm not sure what is happening here, could you clarify a bit?

dgonzalezmbc commented 4 years ago

Hi @dgonzalezmbc Thank you for the PR but I'm not sure what is happening here, could you clarify a bit?

Sure @SimonMiaou, the gem currently has the standard of using proxy_address to store the url, but when going through oauth_client.rb and calling the request_token method, the dependency class Consumer.rb line 324 evaluates the proxyoption for this url, the thing is that name is not supported on the default_options constant so having the same value in proxy and proxy_address will fix this.

SimonMiaou commented 4 years ago

I think I understand, then wouldn't it be better to add the code inside init_oauth_consumer? https://github.com/sumoheavy/jira-ruby/blob/master/lib/jira/oauth_client.rb#L37

dgonzalezmbc commented 4 years ago

I think I understand, then wouldn't it be better to add the code inside init_oauth_consumer? https://github.com/sumoheavy/jira-ruby/blob/master/lib/jira/oauth_client.rb#L37

Just did :)

dgonzalezmbc commented 4 years ago

@SimonMiaou Are we good on merging this?

SimonMiaou commented 4 years ago

Thanks for the reminder 👍