t-ruby: `authorize': uninitialized constant Twitter::REST::Client::BASE_URL (NameError)
$ t authorize Welcome! Before you can use t, you’ll first need to register an application with Twitter. Just follow the steps below:
- Sign in to the Twitter Application Management site and click “Create New App”.
- Complete the required fields and submit the form. Note: Your application must have a unique name.
- Go to the Permissions tab of your application, and change the Access setting to “Read, Write and Access direct messages”.
- Go to the Keys and Access Tokens tab to view the consumer key and secret which you’ll need to copy and paste below when prompted.
Press [Enter] to open the Twitter Developer site.
Enter your API key: <snip>
Enter your API secret: <snop>
/Library/Ruby/Gems/2.3.0/gems/t-3.1.0/lib/t/cli.rb:82:in authorize': uninitialized constant Twitter::REST::Client::BASE_URL (NameError) from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in run’
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in invoke_command' from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor.rb:387:in dispatch’
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/base.rb:466:in start' from /Library/Ruby/Gems/2.3.0/gems/t-3.1.0/bin/t:20:in <top (required)>’
from /usr/local/bin/t:22:in load' from /usr/local/bin/t:22:in <main>’
$ uname -srm Darwin 17.5.0 x86_64 $ sw_vers ProductName: Mac OS X ProductVersion: 10.13.4 $ system_profiler SPSoftwareDataType Software:
System Software Overview:
System Version: macOS 10.13.4 (17E202)
Kernel Version: Darwin 17.5.0
Boot Volume: osx
Boot Mode: Normal
$ t --version 3.1.0
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 26
- Comments: 16
tworks with v6.1.0 of the twitter gem, so I fixed it by running:The simplest upstream fix is to change
t.gemspec’s twitter dependency to~> 6.1.0instead of~> 6.0. (Submitted a pull request with this change: #412)For anyone who is looking for a quick solution, you can try https://github.com/sferik/twitter/issues/878#issuecomment-392878152
It works for me.
This workaround no longer works as of Ruby 3 on OS/X:
Earlier @epitron solution works for authentication, but then dm is still not working https://github.com/sferik/t/issues/405. Updating twitter dependency to 7.0 fixes this, but with it the authentication is broken… So what I ended up doing to be able to log in and to send a dm:
First, authentication is broken after twitter gem 6.1.0 so downgrade to it after t-3.1.0 gem installation:
Now authenticate, most things should work after that. To get dm working make sure first the app has permission for dm’s (hidden under “Permissions” tab on API control panel).
Then to make DM’s work, set up 7.0.0 version of Twitter package to be used as a dependency first in
/usr/local/lib/ruby/gems/2.7.0/gems/t-3.1.0/t.gemspecs.add_runtime_dependency(%q<twitter>.freeze, [">= 6.1"])And then install it in place of 6.1.0.
Now you should have this installed and working with direct messaging functionality. If you need to re-authorize the app you need roll back 6.1.0 first.
Additionally hide ruby
faradaydeprecation warnings as noted in https://github.com/sferik/t/issues/424#issuecomment-643549067, this is something else that seems to be glitching on both Ubuntu and Mac homebrew side.Thank you for your help. In Ubuntu 20.04, the file to edit the dependencies is
/var/lib/gems/2.7.0/specifications/t-3.1.0.gemspecHey, that fix works for me. It should be noted that you also need rdoc as well. That’s probably obvious to people who already know ruby, but it wasn’t for me. 😃
This fixed it for me.
Use this fork instead: https://github.com/xiaocang/t
Build and install instructions:
@epitron’s solution worked for me too. Thank you.
Thanks @epitron your simple solution worked a treat.