Sha256: fbaa25d3575fe4e84be5954296af5dc36e9546e6db557437553c81fa05b9a47f

Contents?: true

Size: 617 Bytes

Versions: 2

Compression:

Stored size: 617 Bytes

Contents

# frozen_string_literal: true

module GraphQL
  module Client
    class GraphNode < GraphObject
      def build_minimal_query
        Query::QueryDocument.new(query.schema) do |root|
          root.add_field('node', id: data.fetch('id')) do |node|
            node.add_inline_fragment(query.resolver_type.name) do |fragment|
              fragment.add_field('id')
              yield fragment
            end
          end
        end
      end

      def refetch_query
        build_minimal_query do |node_fragment|
          node_fragment.selection_set = query.selection_set
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
graphql_client-0.4.1 lib/graphql_client/graph_node.rb
graphql_client-0.3.3 lib/graphql_client/graph_node.rb