Sha256: ae3f732fb96c40ed9a1613daa1baa2816614986cac8cbd1478d945fd7086883a
Contents?: true
Size: 544 Bytes
Versions: 2
Compression:
Stored size: 544 Bytes
Contents
# frozen_string_literal: true require "net/http" require "uri" require "json" module GraphQL module Stitching class RemoteClient def initialize(url:, headers:{}) @url = url @headers = headers end def call(location, document, variables) response = Net::HTTP.post( URI(@url), { "query" => document, "variables" => variables }.to_json, { "Content-Type" => "application/json" }.merge!(@headers) ) JSON.parse(response.body) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
graphql-stitching-0.1.0 | lib/graphql/stitching/remote_client.rb |
graphql-stitching-0.0.1 | lib/graphql/stitching/remote_client.rb |