buytruckload/geonames_api — pull request #21 by mceachen (2014-08-10 02:23:09+00:00)
Title: Support for marshalled objects

When consumers use marshalled objects (like from a cache), and the first exposure to a GeoNamesAPI class is through a marshalled instance, none of the synthetic methods (like geoname_id) will exist until a non-cached instantiation occurs.

This PR adds support for this situation by adding the magick Marshal hooks, `marshal_load` and `marshal_dump`, and making the constructor use the same codepath as Marshal.

The spec needed a class that it could be assured hadn't had `parse_response` called on it before the spec ran—hence, `TestPlace`, and the `place.ser` (which is auto-regenerated by the spec if the file is missing, but then that run of the spec doesn't mean the spec passes—you have to run it again—which is why I'm adding it to the PR).