check for nil in ruby client's to_hash method

Fixes https://github.com/gilt/apidoc/issues/214