Sha256: 317f15333abd0d7dde38ddd731c36fb3d8b56d9733702c1514bdd4aef94bb130

Contents?: true

Size: 812 Bytes

Versions: 3

Compression:

Stored size: 812 Bytes

Contents

module Algolia
  module Transport
    class StatefulHost
      include CallType

      attr_reader :url, :protocol, :accept
      attr_accessor :last_use, :retry_count, :up

      # @param url [String] host url
      # @option options [binary] :accept accept type flag
      # @option options [DateTime] :last_use last usage date
      # @option options [Integer] :retry_count number of retries
      # @option options [Boolean] :up host status
      #
      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.key?(:up) ? opts[:up] : true
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
algolia-3.0.0.alpha.6 lib/algolia/transport/stateful_host.rb
algolia-3.0.0.alpha.5 lib/algolia/transport/stateful_host.rb
algolia-3.0.0.alpha.2 lib/algolia/transport/stateful_host.rb