Class: Dispatcher::Base
- Inherits:
 - 
      Object
      
        
- Object
 - Dispatcher::Base
 
 
- Defined in:
 - lib/bns/dispatcher/base.rb
 
Overview
Serves as a foundational structure for implementing specific dispatchers. Acting as an interface, this class defines essential attributes and methods, providing a blueprint for creating custom dispatchers tailored to different platforms or services.
Direct Known Subclasses
Instance Attribute Summary collapse
- 
  
    
      #name  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute name.
 - 
  
    
      #webhook  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute webhook.
 
Instance Method Summary collapse
- 
  
    
      #dispatch(_payload)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
A method meant to send messages to an specific destination depending on the implementation.
 - 
  
    
      #initialize(config)  ⇒ Base 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
Initializes the dispatcher with essential configuration parameters.
 
Constructor Details
#initialize(config) ⇒ Base
Initializes the dispatcher with essential configuration parameters.
      16 17 18 19  | 
    
      # File 'lib/bns/dispatcher/base.rb', line 16 def initialize(config) @webhook = config[:webhook] @name = config[:name] end  | 
  
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
      12 13 14  | 
    
      # File 'lib/bns/dispatcher/base.rb', line 12 def name @name end  | 
  
#webhook ⇒ Object (readonly)
Returns the value of attribute webhook.
      12 13 14  | 
    
      # File 'lib/bns/dispatcher/base.rb', line 12 def webhook @webhook end  | 
  
Instance Method Details
#dispatch(_payload) ⇒ Object
A method meant to send messages to an specific destination depending on the implementation. Must be overridden by subclasses, with specific logic based on the use case.
 returns a Discord::Response
      27 28 29  | 
    
      # File 'lib/bns/dispatcher/base.rb', line 27 def dispatch(_payload) raise Domain::Exceptions::FunctionNotImplemented end  |