diff --git a/lib/dato_cms_graphql.rb b/lib/dato_cms_graphql.rb index 09a9311..a56714a 100644 --- a/lib/dato_cms_graphql.rb +++ b/lib/dato_cms_graphql.rb @@ -34,19 +34,12 @@ def headers(context) Client = GraphQL::Client.new(schema: Schema, execute: HTTP) end - def self._query(query, variables: {}) - response = Client.query(query, variables: variables) - response.data.items - end - def self.query(query, variables: {}) - Client.query(query, variables: variables).data.items.map do |result| - result.to_h.deep_transform_keys { |k| k.underscore } - end + Client.query(query, variables: variables).data end def self.query_one(query, variables: {}) - Client.query(query, variables: variables).data.item.to_h.deep_transform_keys { |k| k.underscore } + Client.query(query, variables: variables).data end def self.count(query, variables: {}) diff --git a/lib/dato_cms_graphql/fields.rb b/lib/dato_cms_graphql/fields.rb index 333c27c..3f398ff 100644 --- a/lib/dato_cms_graphql/fields.rb +++ b/lib/dato_cms_graphql/fields.rb @@ -1,6 +1,7 @@ module DatoCmsGraphql class Fields attr_accessor :rv + def initialize(fields) @fields = fields @rv = ""