Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`authorize': uninitialized constant Twitter::REST::Client::BASE_URL (NameError) #402

Open
improvethings opened this issue May 31, 2018 · 16 comments

Comments

@improvethings
Copy link

@improvethings improvethings commented May 31, 2018

$ t authorize
Welcome! Before you can use t, you'll first need to register an
application with Twitter. Just follow the steps below:

  1. Sign in to the Twitter Application Management site and click
    "Create New App".
  2. Complete the required fields and submit the form.
    Note: Your application must have a unique name.
  3. Go to the Permissions tab of your application, and change the
    Access setting to "Read, Write and Access direct messages".
  4. 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:
Enter your API secret:
/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

'

$ 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

@keekerdc
Copy link

@keekerdc keekerdc commented Jun 4, 2018

Can reproduce here. Probably an update to the twitter gem?

@fronbasal
Copy link

@fronbasal fronbasal commented Jun 9, 2018

Having the same issue.

@jpluscplusm
Copy link

@jpluscplusm jpluscplusm commented Jun 10, 2018

Same issue here, just installed t system-wide on OSX 10.11.6.

Traceback (most recent call last):
	7: from /usr/local/bin/t:23:in `<main>'
	6: from /usr/local/bin/t:23:in `load'
	5: from /usr/local/lib/ruby/gems/2.5.0/gems/t-3.1.0/bin/t:20:in `<top (required)>'
	4: from /usr/local/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
	3: from /usr/local/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
	2: from /usr/local/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
	1: from /usr/local/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
/usr/local/lib/ruby/gems/2.5.0/gems/t-3.1.0/lib/t/cli.rb:82:in `authorize': uninitialized constant Twitter::REST::Client::BASE_URL (NameError)
$ t --version
3.1.0

@wayne5540
Copy link

@wayne5540 wayne5540 commented Jun 11, 2018

For anyone who is looking for a quick solution, you can try sferik/twitter#878 (comment)

It works for me.

@jorisvanzundert
Copy link

@jorisvanzundert jorisvanzundert commented Jul 23, 2018

Had the same issue on ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin17], for me this fix sferik/twitter#878 (comment) worked by addressing the https://github.com/sferik/twitter api differently.

I cannot however estimate if this fix would mend the problem in general and in a proper way. Hope that a better informed maintainer can judge?

@devlato
Copy link

@devlato devlato commented Feb 8, 2019

The issue still reproduces. Any way to fix that?

@epitron
Copy link

@epitron epitron commented Feb 25, 2019

t works with v6.1.0 of the twitter gem, so I fixed it by running:

$ gem install twitter -v 6.1.0
$ gem uninstall twitter -v 6.2.0

The simplest upstream fix is to change t.gemspec's twitter dependency to ~> 6.1.0 instead of ~> 6.0. (Submitted a pull request with this change: #412)

@mitchellkrogza
Copy link

@mitchellkrogza mitchellkrogza commented Jun 2, 2019

Thanks @epitron your simple solution worked a treat.

@epitron
Copy link

@epitron epitron commented Jun 3, 2019

@sferik Would you mind merging the pull request? (#412) This gem has been in a broken state for a while.

@galenfarrel
Copy link

@galenfarrel galenfarrel commented Jul 19, 2019

t works with v6.1.0 of the twitter gem, so I fixed it by running:

$ gem install twitter -v 6.1.0
$ gem uninstall twitter -v 6.2.0

The simplest upstream fix is to change t.gemspec's twitter dependency to ~> 6.1.0 instead of ~> 6.0. (Submitted a pull request with this change: #412)

This fixed it for me.

@Eoin-ONeill-Yokai
Copy link

@Eoin-ONeill-Yokai Eoin-ONeill-Yokai commented Jul 24, 2019

Hey, 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. :)

@natterstefan
Copy link

@natterstefan natterstefan commented Dec 29, 2019

@epitron's solution worked for me too. Thank you.

@jasalt
Copy link

@jasalt jasalt commented Jun 13, 2020

Earlier @epitron solution works for authentication, but then dm is still not working #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:

gem install twitter -v 6.1.0
gem uninstall twitter -v 6.2.0

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.gemspec

s.add_runtime_dependency(%q<twitter>.freeze, [">= 6.1"])

And then install it in place of 6.1.0.

gem install twitter -v 7.0.0
gem uninstall twitter -v 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 faraday deprecation warnings as noted in #424 (comment), this is something else that seems to be glitching on both Ubuntu and Mac homebrew side.

@pdelteil
Copy link

@pdelteil pdelteil commented Jul 8, 2020

gem uninstall twitter -v 6.1.0

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.gemspec

@dmuth
Copy link

@dmuth dmuth commented Mar 13, 2021

This workaround no longer works as of Ruby 3 on OS/X:

image

@k4rtik
Copy link

@k4rtik k4rtik commented Jun 7, 2021

Use this fork instead: https://github.com/xiaocang/t

Build and install instructions:

gem build t.gemspec
gem install t-3.1.1.gem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet