So I have some code:
#twitter api access config up here
Twitter.status(27558893223)
and I know I get all the tweet information from that Twitter.status line. What I want though isn't a Ruby object. I want the full JSON of that tweet so I can directly use it in populating my mongodb instance. Can I get some help on how to convert that tweet object into just JSON?
Thanks!
Couldn't you use JSON.generate method on Tweet.attrs
?
It mostly depends what all columns you want to populate in your DB. The doc here mentions pretty good info on what all elements you can fetch from Twitter::Tweet
.
For instance you can do things like mentioned below and store it accordingly to your DB instance.
Twitter.status(27558893223).source
Twitter.status(27558893223).from_user
Twitter.status(27558893223).from_user_id
Twitter.status(27558893223).lang
Or you could do Twitter.status(27558893223).attrs
and handle the JSON accordingly.
Let me know if I understood the question wrong.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With