kylejginavan / youtube_it

An object-oriented Ruby wrapper for the YouTube GData API
http://groups.google.com/group/ruby-youtube-library
595 stars 223 forks source link

Faraday conflict #114

Closed danhunter closed 12 years ago

danhunter commented 12 years ago

I'm running the Instagram gem alongside the youtube_it gem so I can connect to both social networks.. Not sure if this is an issue with the Instagram gem or the youtube_it gem but..

It seems like they are suffering from conflicting Faraday middleware? I get the following output:

ArgumentError: wrong number of arguments (3 for 2)
    from /Users/xxx/.rvm/gems/ruby-1.9.3-p125/gems/youtube_it-2.1.7/lib/youtube_it/middleware/faraday_oauth2.rb:9:in `initialize'
    from /Users/xxx/.rvm/gems/ruby-1.9.3-p125/gems/faraday-0.8.4/lib/faraday/middleware.rb:21:in `new'
    from /Users/xxx/.rvm/gems/ruby-1.9.3-p125/gems/faraday-0.8.4/lib/faraday/middleware.rb:21:in `new'
    from /Users/xxx/.rvm/gems/ruby-1.9.3-p125/gems/faraday-0.8.4/lib/faraday/builder.rb:43:in `build'
    from /Users/xxx/.rvm/gems/ruby-1.9.3-p125/gems/faraday-0.8.4/lib/faraday/builder.rb:78:in `block in to_app'
    from /Users/xxx/.rvm/gems/ruby-1.9.3-p125/gems/faraday-0.8.4/lib/faraday/builder.rb:78:in `each'
    from /Users/xxx/.rvm/gems/ruby-1.9.3-p125/gems/faraday-0.8.4/lib/faraday/builder.rb:78:in `inject'
    from /Users/xxx/.rvm/gems/ruby-1.9.3-p125/gems/faraday-0.8.4/lib/faraday/builder.rb:78:in `to_app'
    from /Users/xxx/.rvm/gems/ruby-1.9.3-p125/gems/faraday-0.8.4/lib/faraday/connection.rb:74:in `app'
    from /Users/xxx/.rvm/gems/ruby-1.9.3-p125/gems/faraday-0.8.4/lib/faraday/connection.rb:226:in `run_request'
    from /Users/xxx/.rvm/gems/ruby-1.9.3-p125/gems/faraday-0.8.4/lib/faraday/connection.rb:87:in `get'
    from /Users/xxx/.rvm/gems/ruby-1.9.3-p125/bundler/gems/instagram-ruby-gem-84f1a918e477/lib/instagram/request.rb:28:in `request'
    from /Users/xxx/.rvm/gems/ruby-1.9.3-p125/bundler/gems/instagram-ruby-gem-84f1a918e477/lib/instagram/request.rb:6:in `get'
    from /Users/xxx/.rvm/gems/ruby-1.9.3-p125/bundler/gems/instagram-ruby-gem-84f1a918e477/lib/instagram/client/users.rb:37:in `user_search'
    from /Users/xxx/.rvm/gems/ruby-1.9.3-p125/bundler/gems/instagram-ruby-gem-84f1a918e477/lib/instagram.rb:19:in `method_missing'
    from (irb):1
    from /Users/xxx/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.8/lib/rails/commands/console.rb:47:in `start'
    from /Users/xxx/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.8/lib/rails/commands/console.rb:8:in `start'
    from /Users/xxx/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.8/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

..when I try and run any Instagram request.

Using ruby 1.9.3-p125 and rails 3.2.8. The project also uses the Twitter gem (which also uses Faraday) but there are no conflicts with that.

Also posted here: https://github.com/Instagram/instagram-ruby-gem/issues/48

danhunter commented 12 years ago

I've prevented the error by re-ordering my Gemfile. Youtube_it is required to be added before the Instagram gem.. ?!

chebyte commented 12 years ago

maybe when you loaded instragram later overwrite some methods and works oks, I dont pretty sure but thanks for the advice

akrishhna commented 11 years ago

I got the same error and re-ordering of Gemfile resolved the error but I am getting a warning as below /.rvm/gems/ruby-1.9.3-p327@appmanager/gems/faraday_middleware-0.9.0/lib/faraday_middleware/request/oauth2.rb:62: warning: already initialized constant OAuth2 How can I get rid of this?

akrishhna commented 11 years ago

https://github.com/Instagram/instagram-ruby-gem/pull/53 This fixes the warning and conflict i.e no need to re-order Gemfile.