lib/grumlin/client.rb in grumlin-0.10.1 vs lib/grumlin/client.rb in grumlin-0.11.0

- old
+ new

@@ -95,11 +95,11 @@ # TODO: support yielding def write(bytecode) raise NotConnectedError unless connected? - request = bytecode.to_query + request = to_query(bytecode.to_bytecode) channel = @request_dispatcher.add_request(request) @transport.write(request) begin channel.dequeue.flat_map { |item| Typing.cast(item) } @@ -117,8 +117,20 @@ private def build_transport Transport.new(@url, parent: @parent, **@client_options) + end + + def to_query(bytecode) + { + requestId: SecureRandom.uuid, + op: "bytecode", + processor: "traversal", + args: { + gremlin: bytecode, + aliases: { g: :g } + } + } end end end