You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
=> client = Twitter::REST::Client.new { |config| ... }
=> client.statuses(19, 20, 432656548536401920, map: true)`
=> TypeError: no implicit conversion of Symbol into Integer from /gems/twitter-5.16.0/lib/twitter/identity.rb:16:in 'fetch'
This appears to be because of the different response formats being returned by the Twitter endpoint for map: true vs map: false (the default).
With map: false you get an array with hash elements for any tweet that exists for the ids passed.
[
{
"created_at":"Tue Mar 21 20:50:14 +0000 2006",
"id":20,
"id_str":"20",
"text":"just setting up my twttr",
...
},
{
"created_at":"Sun Feb 09 23:25:34 +0000 2014",
"id":432656548536401920,
"id_str":"432656548536401920",
"text":"POST statuses\/update. Great way to start. https:\/\/t.co\/9S8YO69xzf (disclaimer, this was not posted via the API).",
...
}
]
But with map: true you get a hash with a root key of id and a value containing a hash which maps each tweet id passed (whether it exists or not) to the tweet's attributes. For example, passing ids 19, 20, 21, you get:
{
"id":{
"19":null,
"20":{
"created_at":"Tue Mar 21 20:50:14 +0000 2006",
"id":20,
"id_str":"20",
"text":"just setting up my twttr",
...
},
"21":{
"created_at":"Tue Mar 21 20:51:43 +0000 2006",
"id":21,
"id_str":"21",
"text":"just setting up my twttr",
...
}
}
}
The text was updated successfully, but these errors were encountered:
Hi @davebell, is there a use case for which you'd want to use the map param? I understand that it may be useful to know which tweets exist and which do not, but apart from that I can't quite figure out what else would be different.
Hi @stve - I've recently come across this too! Given that it's included in the Twitter API, it would be really useful to have the support for the map: true option. Use case is just what you identified - quickly and easily checking for deleted tweets.
If you attempt to use the
map: true
option for the Twitter::REST::Tweets#statuses REST API call (see https://dev.twitter.com/rest/reference/get/statuses/lookup), you'll get an exception.This appears to be because of the different response formats being returned by the Twitter endpoint for
map: true
vsmap: false
(the default).With
map: false
you get an array with hash elements for any tweet that exists for the ids passed.But with
map: true
you get a hash with a root key ofid
and a value containing a hash which maps each tweet id passed (whether it exists or not) to the tweet's attributes. For example, passing ids19, 20, 21
, you get:The text was updated successfully, but these errors were encountered: