Class: Algolia::Transport::StatefulHost

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

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.

Parameters:

  • url (String)

    host url

  • options (Hash)

    a customizable set of options



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

#acceptObject (readonly)

Returns the value of attribute accept.



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

def accept
  @accept
end

#last_useObject

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

#portObject (readonly)

Returns the value of attribute port.



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

def port
  @port
end

#protocolObject (readonly)

Returns the value of attribute protocol.



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

def protocol
  @protocol
end

#retry_countObject

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

#upObject

Returns the value of attribute up.



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

def up
  @up
end

#urlObject (readonly)

Returns the value of attribute url.



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

def url
  @url
end