Class: Urbit::AckMessage

Inherits:
Message show all
Defined in:
lib/urbit/ack_message.rb

Instance Attribute Summary collapse

Attributes inherited from Message

#app, #channel, #contents, #id, #mark

Instance Method Summary collapse

Methods inherited from Message

#channel_url, #request_body, #ship, #to_a, #transmit

Constructor Details

#initialize(channel:, sse_message_id:) ⇒ AckMessage

Returns a new instance of AckMessage.



5
6
7
8
# File 'lib/urbit/ack_message.rb', line 5

def initialize(channel:, sse_message_id:)
  super(channel: channel)
  @ack_id  = sse_message_id
end

Instance Attribute Details

#ack_idObject (readonly)

Returns the value of attribute ack_id.



3
4
5
# File 'lib/urbit/ack_message.rb', line 3

def ack_id
  @ack_id
end

Instance Method Details

#actionObject



10
11
12
# File 'lib/urbit/ack_message.rb', line 10

def action
  "ack"
end

#to_hObject



14
15
16
17
# File 'lib/urbit/ack_message.rb', line 14

def to_h
  # Need to use the older hash style due to the key having a dash.
  {'id' => self.id, 'action' => self.action, 'event-id' => self.ack_id}
end

#to_sObject



19
20
21
# File 'lib/urbit/ack_message.rb', line 19

def to_s
  "an AckMessage(#{self.to_h})"
end