summaryrefslogtreecommitdiff
path: root/app/models/poke_message.rb
blob: b134ba976b08b613599c1f13a9f44a17681dd6bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class PokeMessage
  attr_reader :fingerprint, :state

  def initialize(fingerprint:, state: )
    @fingerprint = fingerprint
    @state = state
  end

  def routing_key
    "commands.poke.#{fingerprint}"
  end

  def to_hash
    {
      fingerprint: fingerprint,
      state: state
    }
  end

  def to_json
    to_hash.to_json
  end
end