2

サイトをスクレイピングし、取得した情報の一部を使用してビデオを YouTube に投稿するタスクを持つアプリケーションがあります。

アプリケーションを ruby​​ 2 に更新した後、YouTube のアップロードが機能しなくなり、次のように表示されるようになりました。

(ArgumentError) "wrong number of arguments (2 for 0..1)"
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/youtube_it 2.1.13/lib/youtube_it/chain_io.rb:66:in `read'
/usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http/generic_request.rb:202:in `copy_stream'
/usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http/generic_request.rb:202:in `send_request_with_body_stream'
/usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http/generic_request.rb:132:in `exec'
/usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http.rb:1403:in `block in transport_request'
/usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http.rb:1402:in `catch'
/usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http.rb:1402:in `transport_request'
/usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http.rb:1375:in `request'
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/rest-client-1.6.7/lib/restclient/net_http_ext.rb:51:in `request'
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/newrelic_rpm-3.6.0.83/lib/new_relic/agent/instrumentation/net.rb:25:in `block in request_with_newrelic_trace'
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/newrelic_rpm-3.6.0.83/lib/new_relic/agent/cross_app_tracing.rb:39:in `trace_http_request'
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/newrelic_rpm-3.6.0.83/lib/new_relic/agent/instrumentation/net.rb:24:in `request_with_newrelic_trace'
/usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http.rb:1368:in `block in request'
/usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http.rb:851:in `start'
/usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http.rb:1366:in `request'
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/rest-client-1.6.7/lib/restclient/net_http_ext.rb:51:in `request'
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/newrelic_rpm-3.6.0.83/lib/new_relic/agent/instrumentation/net.rb:25:in `block in request_with_newrelic_trace'
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/newrelic_rpm-3.6.0.83/lib/new_relic/agent/cross_app_tracing.rb:39:in `trace_http_request'
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/newrelic_rpm-3.6.0.83/lib/new_relic/agent/instrumentation/net.rb:24:in `request_with_newrelic_trace'
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/faraday-0.8.7/lib/faraday/adapter/net_http.rb:75:in `perform_request'
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/faraday-0.8.7/lib/faraday/adapter/net_http.rb:38:in `call'
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/faraday-0.8.7/lib/faraday/response.rb:8:in `call'
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/youtube_it-2.1.13/lib/youtube_it/middleware/faraday_authheader.rb:17:in `call'
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/faraday-0.8.7/lib/faraday/connection.rb:247:in `run_request'
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/faraday-0.8.7/lib/faraday/connection.rb:112:in `post'
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/youtube_it-2.1.13/lib/youtube_it/request/video_upload.rb:92:in `upload'
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/youtube_it-2.1.13/lib/youtube_it/client.rb:106:in `video_upload'
/home/deployer/apps/project/current/app/models/cme_event.rb:169:in `upload_on_youtube'

これは、 net/httpのように見える引数の数に関する単純なばかげたエラー で、前の引数の代わりに 2 つの引数を関数に渡します。オプションのパラメーターを追加してyoutube_it gemのコードを変更しようとしましたが、まだうまくいきません。

それで、これを破ったRuby 2のnet/httpで何が変わったのか知っている人はいますか?

4

1 に答える 1