From 00724a52405376f56924326a20744346a8d6a8d8 Mon Sep 17 00:00:00 2001 From: "T.J. Schuck" Date: Fri, 8 Dec 2017 16:03:26 -0500 Subject: [PATCH 1/5] Bump `twitter` gem version dependency https://github.com/sferik/t/commit/b40e2088971811a83f917b22bc928ed8ee30e21b changed the location of BASE_URL from Twitter::REST::Client to Twitter::REST::Request, but that change happened in version 6.2.0 of the twitter gem, so the dependency here needs to be bumped --- t.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t.gemspec b/t.gemspec index 934aaac5..b5baf8bb 100644 --- a/t.gemspec +++ b/t.gemspec @@ -10,7 +10,7 @@ Gem::Specification.new do |spec| spec.add_dependency 'oauth', '~> 0.5.1' spec.add_dependency 'retryable', '~> 2.0' spec.add_dependency 'thor', ['>= 0.19.1', '< 2'] - spec.add_dependency 'twitter', '~> 6.0' + spec.add_dependency 'twitter', '~> 6.2' spec.add_development_dependency 'bundler', '~> 1.0' spec.author = 'Erik Michaels-Ober' spec.description = 'A command-line power tool for Twitter.' From 56c2aa3dd1b75b48f495dcb5df8d1aefb2aa1669 Mon Sep 17 00:00:00 2001 From: "T.J. Schuck" Date: Fri, 8 Dec 2017 16:06:57 -0500 Subject: [PATCH 2/5] Bump `webmock` dependency version 3.1.0 of webmock adds http.rb 3.0.0 compatibility (see https://github.com/bblimke/webmock/blob/master/CHANGELOG.md#310), and twitter gem version 6.2.0 bumps http.rb version to ~> 3.0 (see https://rubygems.org/gems/twitter/versions/6.2.0) --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index ec023deb..7a53659a 100644 --- a/Gemfile +++ b/Gemfile @@ -13,7 +13,7 @@ group :test do gem 'simplecov', '>= 0.9' gem 'timecop' gem 'tins' - gem 'webmock', '>= 1.10.1' + gem 'webmock', '>= 3.1.0' end gemspec From 98d505cc8311d229e8e6ee662a1b82716ea5f1d2 Mon Sep 17 00:00:00 2001 From: "T.J. Schuck" Date: Fri, 8 Dec 2017 16:09:02 -0500 Subject: [PATCH 3/5] Twitter 6.2.0 no longer uses deprecated `update_with_media` endpoint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As of https://github.com/sferik/twitter/commit/e1e0095058d92c29bb0e5f142cb38ad4e6857e32#diff-5ffd489b9cb331064f65077d37562b9c, the twitter gem no longer uses the deprecated `update_with_media` endpoint — it now calls upload followed by update with the previously uploaded media IDs. --- spec/cli_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/cli_spec.rb b/spec/cli_spec.rb index 5646f6cc..71665fa9 100644 --- a/spec/cli_spec.rb +++ b/spec/cli_spec.rb @@ -3898,7 +3898,7 @@ it 'requests the correct resource' do @cli.update('Testing') expect(a_request(:post, 'https://upload.twitter.com/1.1/media/upload.json')).to have_been_made - expect(a_post('/1.1/statuses/update_with_media.json')).to have_been_made + expect(a_post('/1.1/statuses/update.json')).to have_been_made end it 'has the correct output' do @cli.update('Testing') From 8d95467ff78e1d5777827b4d5b8b229fe53ec11e Mon Sep 17 00:00:00 2001 From: "T.J. Schuck" Date: Fri, 8 Dec 2017 16:11:34 -0500 Subject: [PATCH 4/5] Return a media payload response from upload request MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The twitter gem depends on the `media_id` key that’s returned as part of the upload request, so this adds a fixture that includes it. Before this change, these tests were throwing the following error: ``` TypeError: no implicit conversion of Symbol into Integer # /home/travis/.rvm/gems/ruby-2.3.3/gems/twitter-6.2.0/lib/twitter/rest/tweets.rb:227:in `[]' # /home/travis/.rvm/gems/ruby-2.3.3/gems/twitter-6.2.0/lib/twitter/rest/tweets.rb:227:in `block in update_with_media' # /home/travis/.rvm/gems/ruby-2.3.3/gems/twitter-6.2.0/lib/twitter/utils.rb:23:in `block in pmap' # /home/travis/.rvm/gems/ruby-2.3.3/gems/twitter-6.2.0/lib/twitter/utils.rb:23:in `collect' # /home/travis/.rvm/gems/ruby-2.3.3/gems/twitter-6.2.0/lib/twitter/utils.rb:23:in `pmap' # /home/travis/.rvm/gems/ruby-2.3.3/gems/twitter-6.2.0/lib/twitter/rest/tweets.rb:226:in `update_with_media' # ./lib/t/cli.rb:612:in `reply' # ./spec/cli_spec.rb:2562:in `block (4 levels) in ' ``` --- spec/cli_spec.rb | 4 ++-- spec/fixtures/media.json | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 spec/fixtures/media.json diff --git a/spec/cli_spec.rb b/spec/cli_spec.rb index 71665fa9..b7334cc2 100644 --- a/spec/cli_spec.rb +++ b/spec/cli_spec.rb @@ -2550,7 +2550,7 @@ context 'with file' do before do @cli.options = @cli.options.merge('file' => fixture_path + '/long.png') - stub_request(:post, 'https://upload.twitter.com/1.1/media/upload.json') + stub_request(:post, 'https://upload.twitter.com/1.1/media/upload.json').to_return(body: fixture('media.json'), headers: {content_type: 'application/json; charset=utf-8'}) stub_post('/1.1/statuses/update.json').to_return(body: fixture('status.json'), headers: {content_type: 'application/json; charset=utf-8'}) end it 'requests the correct resource' do @@ -3892,7 +3892,7 @@ context 'with file' do before do @cli.options = @cli.options.merge('file' => fixture_path + '/long.png') - stub_request(:post, 'https://upload.twitter.com/1.1/media/upload.json') + stub_request(:post, 'https://upload.twitter.com/1.1/media/upload.json').to_return(body: fixture('media.json'), headers: {content_type: 'application/json; charset=utf-8'}) stub_post('/1.1/statuses/update.json').to_return(body: fixture('status.json'), headers: {content_type: 'application/json; charset=utf-8'}) end it 'requests the correct resource' do diff --git a/spec/fixtures/media.json b/spec/fixtures/media.json new file mode 100644 index 00000000..28fc2e43 --- /dev/null +++ b/spec/fixtures/media.json @@ -0,0 +1 @@ +{"image":{"w":428,"h":428,"image_type":"image/png"},"media_id":470030289822314497,"media_id_string":"470030289822314497","size":68900} From 74c8adb31aaaa9ffd1d154bf98282e0e2eb408bd Mon Sep 17 00:00:00 2001 From: aCandidMind Date: Fri, 27 Dec 2019 12:15:42 +0100 Subject: [PATCH 5/5] Bump bundler to ~2.1 --- t.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t.gemspec b/t.gemspec index 934aaac5..3db8aabe 100644 --- a/t.gemspec +++ b/t.gemspec @@ -11,7 +11,7 @@ Gem::Specification.new do |spec| spec.add_dependency 'retryable', '~> 2.0' spec.add_dependency 'thor', ['>= 0.19.1', '< 2'] spec.add_dependency 'twitter', '~> 6.0' - spec.add_development_dependency 'bundler', '~> 1.0' + spec.add_development_dependency 'bundler', '~> 2.1' spec.author = 'Erik Michaels-Ober' spec.description = 'A command-line power tool for Twitter.' spec.email = 'sferik@gmail.com'