module EventSource::EventStore::HTTP::Controls::Write

Public Class Methods

call(events=nil, instances: nil, stream_name: nil) click to toggle source
# File lib/event_source/event_store/http/controls/write.rb, line 6
def self.call(events=nil, instances: nil, stream_name: nil)
  stream_name ||= StreamName.example

  if events.nil?
    instances ||= 1

    events = instances.times.map do |position|
      EventData::Write.example
    end
  else
    events = Array(events)
  end

  ::EventStore::HTTP::Write.(events, stream_name)

  stream_name
end