Sha256: cb7bb10e1e20e4bf5aa7d49762f7da24317155b76c6439f9b8732bf724fa6d80

Contents?: true

Size: 892 Bytes

Versions: 2

Compression:

Stored size: 892 Bytes

Contents

module Sonic
  class ServiceChecker

    attr_accessor :protocol
    attr_accessor :host
    attr_accessor :port
    attr_accessor :path
    attr_accessor :payload
    attr_accessor :ssl_key
    attr_accessor :ssl_cert
    attr_accessor :response
    attr_accessor :error

    def initialize(protocol, host, port, path=nil, payload=nil, ssl_cert=nil, ssl_key=nil)
      @protocol = protocol
      @host     = host
      @port     = port
      @path     = path
      @payload  = payload
      @ssl_key  = ssl_key
      @ssl_cert  = ssl_cert
    end

    def check_service()
      @response = nil
      @error = nil
      case protocol
      when :http, :https
        http = Protocol::HTTP.new(self)
        http.get
      when :amqp
        amqp = Protocol::AMQP.new(self)
        amqp.check
      when :tcp
        tcp = Protocol::TCP.new(self)
        tcp.send
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sonic-0.1.3 lib/sonic/service_checker.rb
sonic-0.0.2 lib/sonic/service_checker.rb