class EventStoreClient::HTTP::Commands::Projections::Create
Public Instance Methods
call(name, streams, options: {})
click to toggle source
# File lib/event_store_client/adapters/http/commands/projections/create.rb, line 8 def call(name, streams, options: {}) data = <<~STRING fromStreams(#{streams}) .when({ $any: function(s,e) { linkTo("#{name}", e) } }) STRING res = connection.call( :post, "/projections/continuous?name=#{name}&type=js&enabled=yes&emit=true&trackemittedstreams=true", # rubocop:disable Metrics/LineLength body: data, headers: {} ) (200...300).cover?(res.status) ? Success() : Failure(res) end