Sha256: 8a253a01f92131665e2a657c13eb3d16c0387760dd1d67e02a5595c16a545d1d

Contents?: true

Size: 1015 Bytes

Versions: 4

Compression:

Stored size: 1015 Bytes

Contents

module PartyBus
  module Events
    class Create
      def self.perform_using(
        entity_id: PartyBus.configuration.entity_id,
        payload:,
        resource_type:,
        resource_action:,
        source_id: PartyBus.configuration.source_id
      )
        new(entity_id, resource_type, resource_action, payload, source_id).perform
      end

      def initialize(entity_id, resource_type, resource_action, payload, source_id)
        @entity_id = entity_id
        @resource_type = resource_type
        @resource_action = resource_action
        @payload = payload
        @source_id = source_id
      end

      def perform
        @response ||= PartyBus::Client.post(
          entity_id: @entity_id,
          path: '/api/v1/events',
          body: {
            event: {
              payload: @payload,
              resource_type: @resource_type,
              resource_action: @resource_action,
              source_id: @source_id
            }
          }
        )
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
party_bus-0.1.16 lib/party_bus/events/create.rb
party_bus-0.1.15 lib/party_bus/events/create.rb
party_bus-0.1.14 lib/party_bus/events/create.rb
party_bus-0.1.13 lib/party_bus/events/create.rb