getoutreach / bullhorn-rest

Ruby wrapper for the Bullhorn REST API
MIT License
11 stars 22 forks source link

make the url of the Bullhorn::Rest::Authentication login method configurable #7

Open fmquaglia opened 9 years ago

fmquaglia commented 9 years ago

Recently while trying to auth at https://auth.bullhornstaffing.com/oauth/authorize?action=Login&client_id=XXX&response_type=code&username=XXX (replacing XXX with my own values) I got the following server error:

error=server_error
error_description=java.net.UnknownHostException: sl19redis.vip.bos.bullhorn.com

At Bullhorn's forums I found this solution.

So it seems that might be necessary to make the url variable of the Bullhorn::Rest::Authentication login method configurable (via constructor's attribute maybe?).

Otherwise hitting the one that is hardcoded throws an error (if the user must use an alternative instance instead of the default one -- e.g. auth9...... --):

ArgumentError: bad argument (expected URI object or URI string)
    from .../.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/uri/common.rb:715:in `URI'
    from .../.rvm/gems/ruby-2.2.0@bullhorn_sinatra/bundler/gems/bullhorn-rest-6ae47f94e1e4/lib/bullhorn/rest/authentication.rb:93:in `rest_url='
    from .../.rvm/gems/ruby-2.2.0@bullhorn_sinatra/bundler/gems/bullhorn-rest-6ae47f94e1e4/lib/bullhorn/rest/authentication.rb:71:in `login'
        # .....
    from -e:1:in `load'
    from -e:1:in `<main>'

Does that seem feasible?

ghempton commented 9 years ago

Sounds feasible. We don't currently consume this gem right now, but if you want to add that functionality I will merge.

fmquaglia commented 9 years ago

Right on @ghempton . You'll have it shortly. Thanks, man.

draknor commented 9 years ago

I added this to my clone - will send PR momentarily.

fmquaglia commented 9 years ago

I've been using @draknor 's branch, and so far it works really well. Thanks matey.

draknor commented 9 years ago

No problem - glad to help! Will try to get my other enhancements better segregated & organized so I can send PRs for those, too.