Class: Algolia::Transport::StatefulHost

Inherits:
Object
  • Object
show all
Includes:
CallType
Defined in:
lib/algolia/transport/stateful_host.rb

Overview

Class StatefulHost

Constant Summary

Constants included from CallType

CallType::READ, CallType::WRITE

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, opts = {}) ⇒ StatefulHost

Returns a new instance of StatefulHost.



16
17
18
19
20
21
22
23
# File 'lib/algolia/transport/stateful_host.rb', line 16

def initialize(url, opts = {})
  @url         = url
  @protocol    = opts[:protocol] || 'https://'
  @accept      = opts[:accept] || (READ | WRITE)
  @last_use    = opts[:last_use] || Time.now.utc
  @retry_count = opts[:retry_count] || 0
  @up          = opts.has_key?(:up) ? opts[:up] : true
end

Instance Attribute Details

#acceptObject (readonly)

Returns the value of attribute accept.



7
8
9
# File 'lib/algolia/transport/stateful_host.rb', line 7

def accept
  @accept
end

#last_useObject

Returns the value of attribute last_use.



8
9
10
# File 'lib/algolia/transport/stateful_host.rb', line 8

def last_use
  @last_use
end

#protocolObject (readonly)

Returns the value of attribute protocol.



7
8
9
# File 'lib/algolia/transport/stateful_host.rb', line 7

def protocol
  @protocol
end

#retry_countObject

Returns the value of attribute retry_count.



8
9
10
# File 'lib/algolia/transport/stateful_host.rb', line 8

def retry_count
  @retry_count
end

#upObject

Returns the value of attribute up.



8
9
10
# File 'lib/algolia/transport/stateful_host.rb', line 8

def up
  @up
end

#urlObject (readonly)

Returns the value of attribute url.



7
8
9
# File 'lib/algolia/transport/stateful_host.rb', line 7

def url
  @url
end