Class: Messenger
  
  
  
Overview
  
    
Messengers handle passing a target into a message template for rendering warehouse messages
   
 
  
  
    
      Instance Method Summary
      collapse
    
    
  
  
  
  
  
  
  
  
  
  
  alias_association, convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!
  
  
  
  
  
  
  
  
  Methods included from Squishify
  extended
  
  
  
    Instance Method Details
    
      
  
  
    #as_json(_options = {})  ⇒ Object 
  
  
  
  
    
      
17
18
19 
     | 
    
      # File 'app/models/messenger.rb', line 17
def as_json(_options = {})
  { root => render_class.to_hash(target), 'lims' => configatron.amqp.lims_id! }
end
     | 
  
 
    
      
  
  
    #render_class  ⇒ Object 
  
  
  
  
    
      
9
10
11 
     | 
    
      # File 'app/models/messenger.rb', line 9
def render_class
  "Api::Messages::#{template}".constantize
end
     | 
  
 
    
      
  
  
    #resend  ⇒ Object 
  
  
  
  
    
      
28
29
30 
     | 
    
      # File 'app/models/messenger.rb', line 28
def resend
  Warren.handler << Warren::Message::Short.new(self)
end 
     | 
  
 
    
      
  
  
    #routing_key  ⇒ Object 
  
  
  
  
    
      
13
14
15 
     | 
    
      # File 'app/models/messenger.rb', line 13
def routing_key
  "message.#{root}.#{id}"
end
     | 
  
 
    
      
  
  
    #template  ⇒ Object 
  
  
  
  
    
      
21
22
23
24
25
26 
     | 
    
      # File 'app/models/messenger.rb', line 21
def template
        read_attribute(:template).gsub(/IO$/, 'Io')
end
     |