Class: Algolia::Transport::StatefulHost
- Inherits:
 - 
      Object
      
        
- Object
 - Algolia::Transport::StatefulHost
 
 
- Includes:
 - CallType
 
- Defined in:
 - lib/algolia/transport/stateful_host.rb
 
Constant Summary
Constants included from CallType
CallType::READ, CallType::WRITE
Instance Attribute Summary collapse
- 
  
    
      #accept  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute accept.
 - 
  
    
      #last_use  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute last_use.
 - 
  
    
      #port  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute port.
 - 
  
    
      #protocol  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute protocol.
 - 
  
    
      #retry_count  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute retry_count.
 - 
  
    
      #up  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute up.
 - 
  
    
      #url  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute url.
 
Instance Method Summary collapse
- 
  
    
      #initialize(url, opts = {})  ⇒ StatefulHost 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of StatefulHost.
 
Constructor Details
#initialize(url, opts = {}) ⇒ StatefulHost
Returns a new instance of StatefulHost.
      15 16 17 18 19 20 21 22 23  | 
    
      # File 'lib/algolia/transport/stateful_host.rb', line 15 def initialize(url, opts = {}) @url = url @protocol = opts[:protocol] || "https://" @port = opts[:port] @accept = opts[:accept] || (READ | WRITE) @last_use = opts[:last_use] || Time.now.utc @retry_count = opts[:retry_count] || 0 @up = opts.key?(:up) ? opts[:up] : true end  | 
  
Instance Attribute Details
#accept ⇒ Object (readonly)
Returns the value of attribute accept.
      6 7 8  | 
    
      # File 'lib/algolia/transport/stateful_host.rb', line 6 def accept @accept end  | 
  
#last_use ⇒ Object
Returns the value of attribute last_use.
      7 8 9  | 
    
      # File 'lib/algolia/transport/stateful_host.rb', line 7 def last_use @last_use end  | 
  
#port ⇒ Object (readonly)
Returns the value of attribute port.
      6 7 8  | 
    
      # File 'lib/algolia/transport/stateful_host.rb', line 6 def port @port end  | 
  
#protocol ⇒ Object (readonly)
Returns the value of attribute protocol.
      6 7 8  | 
    
      # File 'lib/algolia/transport/stateful_host.rb', line 6 def protocol @protocol end  | 
  
#retry_count ⇒ Object
Returns the value of attribute retry_count.
      7 8 9  | 
    
      # File 'lib/algolia/transport/stateful_host.rb', line 7 def retry_count @retry_count end  | 
  
#up ⇒ Object
Returns the value of attribute up.
      7 8 9  | 
    
      # File 'lib/algolia/transport/stateful_host.rb', line 7 def up @up end  | 
  
#url ⇒ Object (readonly)
Returns the value of attribute url.
      6 7 8  | 
    
      # File 'lib/algolia/transport/stateful_host.rb', line 6 def url @url end  |