Class: Grumlin::Middlewares::BuildQuery

Inherits:
Middleware
  • Object
show all
Defined in:
lib/grumlin/middlewares/build_query.rb

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/grumlin/middlewares/build_query.rb', line 4

def call(env)
  env[:query] = {
    requestId: SecureRandom.uuid,
    op: :bytecode,
    processor: env[:session_id] ? :session : :traversal,
    args: {
      gremlin: {
        :@type => "g:Bytecode",
        :@value => env[:bytecode]
      },
      aliases: { g: :g },
      session: env[:session_id]
    }.compact
  }
  @app.call(env)
end