Class: ThriftHelpers::Connection::HTTP

Inherits:
Base
  • Object
show all
Defined in:
lib/thrift_client/connection/http.rb

Instance Attribute Summary

Attributes inherited from Base

#server, #transport

Instance Method Summary collapse

Methods inherited from Base

#close

Constructor Details

#initialize(*args) ⇒ HTTP

Returns a new instance of HTTP.



4
5
6
7
8
9
# File 'lib/thrift_client/connection/http.rb', line 4

def initialize(*args)
  super *args

  uri = parse_server(@server)
  @transport = Thrift::HTTPClientTransport.new(@server)
end

Instance Method Details

#connect!Object



11
12
13
14
15
# File 'lib/thrift_client/connection/http.rb', line 11

def connect!
  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = uri.scheme == "https"
  http.get(uri.path)
end

#open?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/thrift_client/connection/http.rb', line 17

def open?
  true
end