stripe/stripe-ruby — pull request #118 by vandrijevik (2014-02-12 19:29:05+00:00)
Title: Improved StripeObject#to_hash

Calling `to_hash` on any `StripeObject` returns the values hash, which may have nested `StripeObjects`. To get a hash of a `StripeObject` where its nested attributes are also converted to hashes currently requires a round-trip via JSON, which is ugly:

```
customer = Stripe::Customer.all.first
JSON.parse(customer.to_json)
```

This pull request avoids the round-trip by making `to_hash` work on nested attributes as well. The only difference from the round-trip via JSON is that `to_hash` will result in symbol keys, which I believe is preferable, since `@values` has symbol keys as well.