Sha256: 7deed4c11a75e2115630cd7d3404c62f020b788692846ffc803ac53dae661c09

Contents?: true

Size: 764 Bytes

Versions: 1

Compression:

Stored size: 764 Bytes

Contents

module PartyBus
  module Events
    class Create
      def self.perform_using(
        connection_id:,
        payload:,
        timestamp: Time.now,
        topic:
      )
        new(connection_id, payload, topic, timestamp).perform
      end

      def initialize(connection_id, payload, topic, timestamp)
        @connection_id = connection_id
        @topic = topic
        @payload = payload
        @timestamp = timestamp
      end

      def perform
        @response ||= PartyBus::Client.post(
          body: {
            event: {
              payload: @payload,
              topic: @topic,
            }
          },
          path: "/api/v1/connections/#{@connection_id}/events",
          timestamp: @timestamp
        )
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
party_bus-0.4.0 lib/party_bus/events/create.rb