morgoth/picasa — pull request #13 by viniciusteles (2012-10-23 05:41:30+00:00)
Title: Request gzipped data to speed up transfers from Picasa Web

Wojciech, thanks a lot for this gem!

In order to speed up the transfer of data from Picasa Web, we can request gzipped data, instead of uncompressed data.

To achieve this goal, I propose the use of the gem HTTParty to handle
all of the HTTP connections. Not only because HTTParty already knows how
to handle compressed data properly, but also because it's a mature gem
for handling HTTP connections in general. And it's use can simplify the
connection code.

I created a new class Picasa::HTTP which sets all of the defaults for
HTTParty related to:

* base uri
* proxy
* headers
* format

So this doesn't need to be done at Picasa::Connection anymore. And since
all of the requests are similar, the logic was centralized in the new
method Picasa::Connection#exec_request for http methods get, post and
delete.

OBS:
* To request gzipped data from Picasa API it's necessary to have " (gzip)" in the user agent url and to set the appropriate Accept-Encoding header. See:
https://developers.google.com/picasa-web/faq_gdata#gzip
* I moved the constants API_URL, API_AUTH_URL and API_VERSION to the new
class Picasa::HTTP, because it looks like a more appropriate place.