I have an application that uses the LinkedIn gem, but I need to move on to using the LinkedIn implementation of OAuth2, which comes in another gem .
I need to support oAuth1 requests in the source stone for existing users, but I need to support OAuth2 for new users heading forward.
The problem is that both of these gems use the LinkedIn namespace for their module names, and depending on the order I include them in my Gemfile, one clobbers the other.
I tried adding require: false to the gemfile like this:
gem 'linkedin', require: false gem 'linkedin-oauth2', require: false
But, oddly enough, when I go to the console, the first is still required, and the second is not:
irb(main):001:0> require 'linkedin' => false irb(main):002:0> require 'linkedin-oauth2' => true
Is this related to how you work? Is it possible to load only one of these gems each in separate lib files without knocking each other together?
EDIT
I realized that I needed LinkedIn in one of my specification files, which caused it to autoload, but this still did not fix the problem of dumped things.
When I have both stones installed, and I run:
irb(main):001:0> require 'linkedin' => true irb(main):002:0> ::LinkedIn::Client.new NameError: uninitialized constant Api::QueryHelpers from /Users/me/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/linkedin-1.1.0/lib/linked_in/client.rb:8:in `<class:Client>' irb(main):004:0> require 'linkedin-oauth2' => true
But if I remove linkedin-oauth2 from my gemfile, it works fine:
irb(main):002:0> require 'linkedin' => true irb(main):004:0> ::LinkedIn::Client.new =>
Why is this, especially since linkedin-oauth2 not required in the first example, but an error occurs. Maybe due to the fact that they require support for files in the LinkedIn stone? It seems all the same that this should not affect it.