Class: PartyBus::Events::Create
- Inherits:
-
Object
- Object
- PartyBus::Events::Create
- Defined in:
- lib/party_bus/events/create.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(connection_id, payload, topic, timestamp) ⇒ Create
constructor
A new instance of Create.
- #perform ⇒ Object
Constructor Details
#initialize(connection_id, payload, topic, timestamp) ⇒ Create
Returns a new instance of Create.
13 14 15 16 17 18 |
# File 'lib/party_bus/events/create.rb', line 13 def initialize(connection_id, payload, topic, ) @connection_id = connection_id @topic = topic @payload = payload = end |
Class Method Details
.perform_using(connection_id: PartyBus.configuration.connection_id, payload:, timestamp: Time.now, topic:) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/party_bus/events/create.rb', line 4 def self.perform_using( connection_id: PartyBus.configuration.connection_id, payload:, timestamp: Time.now, topic: ) new(connection_id, payload, topic, ).perform end |
Instance Method Details
#perform ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/party_bus/events/create.rb', line 20 def perform @response ||= PartyBus::Client.post( body: { event: { payload: @payload, topic: @topic, } }, path: "/api/v1/connections/#{@connection_id}/events", timestamp: ) end |