Class: Mj::GraphQL::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/mj/graphql/client.rb

Instance Method Summary collapse

Instance Method Details

#send(request) ⇒ Object



8
9
10
11
12
13
# File 'lib/mj/graphql/client.rb', line 8

def send(request)
  base_url = request.endpoint.split("/graphql").first
  base_request = Koine::RestClient::Request.new(base_url: base_url)
  http_client = Koine::RestClient::Client.new(base_request: base_request)
  http_client.post("/graphql", request.to_h, headers: request.headers)
end