HTTParty Divorces JSON
So I guess dropping ActiveSupport just wasn’t enough for you people. You demanded more! Almost right away the windows and jruby people started whining (I kid, I kid). Oh, and then Pratik got a little bothered by the JSON gem’s interference with Rails. Let me just say that the HTTParty is not an exclusive one, so I figured I’d look into making life easier for the aforementioned party poopers.
Tonight, after watching a couple movies, I felt like hacking, so I decided to remove the JSON gem as a dependency. I remembered that ActiveSupport actually uses YAML (a core library) with some tweaks to parse JSON, so I pulled in that bit of code and HTTParty was officially free of its only remaining chaperone. Yep, now when you install HTTParty, no other gems install.
I also did some refactoring, fixed a few bugs, added a ton of specs and started to document the code base a bit. Nothing super new other than the lack of the JSON gem, but I figured I would officially invite windows, jruby and Pratik to the party.
So what is next for HTTParty? I’ve been thinking about that a lot and I have a few ideas. I’d love to see integration of HappyMapper and HTTParty. I’m thinking this would be pretty easy with a :parser option in the request methods. Maybe something like this:
HTTParty.get('http://foo.com', :parser => Foo)
Any thoughts or preferences on something like this? Then when HTTParty attempts to parse the response, it would call Foo.parse, so you could make your own parsing classes or use HappyMapper objects. Any better ideas? Also, do you have any pain points with HTTParty? Things you find monotonous when consuming web services that would be well suited for the party? Let me know.