Class: EventStoreClient::HTTP::Commands::Projections::Update

Inherits:
Command
  • Object
show all
Defined in:
lib/event_store_client/adapters/http/commands/projections/update.rb

Instance Method Summary collapse

Methods inherited from Command

inherited

Instance Method Details

#call(name, streams, options: {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/event_store_client/adapters/http/commands/projections/update.rb', line 8

def call(name, streams, options: {})
  data =
    "      fromStreams(\#{streams})\n      .when({\n        $any: function(s,e) {\n          linkTo(\"\#{name}\", e)\n        }\n      })\n    STRING\n  res = connection.call(\n    :put,\n    \"/projection/\#{name}/query?type=js&enabled=yes&emit=true&trackemittedstreams=true\", # rubocop:disable Metrics/LineLength\n    body: data,\n    headers: {}\n  )\n\n  (200...300).cover?(res.status) ? Success() : Failure(res)\nend\n"