graphql-client
graphql-client copied to clipboard
Support for Marshal?
After executing a query, the result is an anonymous class with Schema::ObjectClass as an ancestor. To prevent from fetching the resource multiple times, ideally it would be nice to store it in a cache for example:
result = Rails.cache.fetch('some-key') do
client.query(SomeQuery, variables: { })
end
However since this is an anonymous class, it's not possible to Marshal it. I can convert it into a Hash to_h but I lose the convenience of accessing values as result: result.some_type vs result["some_type"].
Thoughts?