A couple of days ago, I wrote about the “tweet analyzer” I was working on. Really, it was just an excuse to play around with a popular API and sinatra. Going into the project, there was no real ultimate goal…However, there were a couple of small goals.
- Learn something new, this goes without saying it it happens all the time, easy one!
- Practice with HTTP request methods
- Pull data from the API
- Interpret data from API
- Visually represent data.
- Try and make it as simple as possible.
In the finished product, all the goals were accomplished. Since there was never really that “ultimate goal”, it’s slightly random in the different data it visually represents. However, it’s very easy to create another method to modify the data in some way then visually graph it.
Also, if you remember from my last post I was having an issue with the groupdate gem (see previous post for details). Anyway, the I ended up removing it from the project and just writing my own methods to do what the gem was essentially doing.
In a way, the nice thing about not having a endpoint for the project is I can just add more easily, not feeling bound by some constraint. That is actually what I did with the twittercounter API along with HTTParty.
Here’s an example using the httparty along with the twittercounter.
This is pretty simple stuff, just a method that sends the request to twittercounter returning a hash (in this case with dates/follower_counts). One thing about the JSON returned, the date was a strange format that had text in front of it. I ended up writing another method to “scrub” this text from the date.
Thats about it, most of the graphs I used could take a hash as a parameter, which made displaying the data easy. Heres what it looks like.
In the end, this was a fun project with lots of opportunities to experiment and play around with new things. I definitely learned a lot. Check it out live here, tweet data. Also, the repo is here. Keep in mind styling wasn’t a priority with this project :) .