add `to_hash` alias to `to_h` method
fixes #277
Hi 👋 Thanks for the great gem!
0.17.0 breaks as_json/to_json on graphql response because now ObjectClass class has definer variable that has circular references and ActiveSupport(as_json) tries to call instance_values if object doesn't have to_hash method.
response.data.instance_values["definer"].instance_values["klass"].instance_values["null_type"].instance_values["of_klass"].instance_values["null_type"].instance_values["of_klass"]
To fix this, I'd like to add to_hash method to the relevant classes. This allows ActiveSupport to handle as_json / to_json without referencing internal variables. There are already to_h methods to return original_hash or data in several classes so I just added the alias to that.
This error itself might not be the concern that this library should care about, but I think it feels more natural if we can get an actual response or data instead of internal variables like definer when calling response.as_json / response.to_json in the Rails project.
Hi 👋 @rmosolgo, @jhawthorn my team is affected by https://github.com/github/graphql-client/issues/277 and this PR proposes a fix. Would it be possible to review this? Thanks!