Class: Messenger

Inherits:
ApplicationRecord show all
Defined in:
app/models/messenger.rb

Instance Method Summary collapse

Methods inherited from ApplicationRecord

convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!

Methods included from Warren::BroadcastMessages

#broadcast, included, #queue_associated_for_broadcast, #queue_for_broadcast, #warren

Instance Method Details

#as_json(_options = {}) ⇒ Object


18
19
20
21
# File 'app/models/messenger.rb', line 18

def as_json(_options = {})
  { root => render_class.to_hash(target),
    'lims' => configatron.amqp.lims_id! }
end

#render_classObject


10
11
12
# File 'app/models/messenger.rb', line 10

def render_class
  "Api::Messages::#{template}".constantize
end

#resendObject


23
24
25
# File 'app/models/messenger.rb', line 23

def resend
  broadcast
end

#routing_keyObject


14
15
16
# File 'app/models/messenger.rb', line 14

def routing_key
  "#{Rails.env}.message.#{root}.#{id}"
end

#shootObject

Raises:

  • (StandardErrror)

6
7
8
# File 'app/models/messenger.rb', line 6

def shoot
  raise StandardErrror, "Hey, don't shoot the messenger"
end