Using the Twitter gem to pull a Twitter List using slugs

Viewed 25

This question piggy backs off

Get list timeline by using Twitter gem.

In this case however, I'm trying to pull the list itself as opposed to the list_timeline, passing in the list slug, per the documentation here:

https://rdoc.info/gems/twitter/Twitter%2FREST%2FLists:list

and grab some of the relevant info about the list, per the methods listed here:

https://rdoc.info/gems/twitter/Twitter/List

This is the code I'm using to do this, I want my retrieve_a_list function to return an object of type Twitter::List

def
@client = Twitter::REST::Client.new do |config|
  config.consumer_key        = "YOUR_CONSUMER_KEY"
  config.consumer_secret     = "YOUR_CONSUMER_SECRET"
  config.access_token        = "YOUR_ACCESS_TOKEN"
  config.access_token_secret = "YOUR_ACCESS_SECRET"
end


def retrieve_a_list(slug)
  @list_info = @client.list(slug)
  return @list_info
end

Calling this function in the ruby console gives the following error, and I'm not sure if this is because I'm inputing the slug incorrectly or something else is going on here.

[6] pry(main)> list = C.retrieve_a_list('emilyslist')
Twitter::Error::NotFound: Sorry, that page does not exist.
from /Users/drewbateman/.rvm/gems/ruby-2.7.4/gems/twitter-7.0.0/lib/twitter/rest/request.rb:97:in `fail_or_return_response_body'

I've verified that https://twitter.com/emilyslist actually exists. This is the same error for basically all lists I try and I'm not sure where I'm going wrong here

0 Answers
Related