Fix version handling so that it builds on Ruby 2.0+

The essential parts are 6872f5d9dff6bed8faa55dfecf60513c481fdc35 and 344922465205ef31637926dadf018e00627b320b which fixes the gem build error.
It seems like it's not a good idea to require libraries in gemspec. I borrowed the code from faraday.

I also added some refactoring commits which do not affect the code meaning. If you don't like it, please feel free to cherry-pick the commits.

Tested in Ruby 2.1.0 w/ Rails 4.0.2.