Class: RubySnowflake::Client::HttpConnectionWrapper
- Inherits:
-
Object
- Object
- RubySnowflake::Client::HttpConnectionWrapper
- Defined in:
- lib/ruby_snowflake/client/http_connection_wrapper.rb
Instance Method Summary collapse
-
#initialize(hostname, port) ⇒ HttpConnectionWrapper
constructor
A new instance of HttpConnectionWrapper.
- #request(request) ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(hostname, port) ⇒ HttpConnectionWrapper
Returns a new instance of HttpConnectionWrapper.
6 7 8 9 |
# File 'lib/ruby_snowflake/client/http_connection_wrapper.rb', line 6 def initialize(hostname, port) @hostname = hostname @port = port end |
Instance Method Details
#request(request) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/ruby_snowflake/client/http_connection_wrapper.rb', line 18 def request(request) # connections can timeout and close, re-open them # which is what the connection pool expects start unless connection.active? begin connection.request(request) rescue StandardError => error raise RequestError.new "HTTP error requesting data", cause: error end end |
#start ⇒ Object
11 12 13 14 15 16 |
# File 'lib/ruby_snowflake/client/http_connection_wrapper.rb', line 11 def start @connection = Net::HTTP.start(@hostname, @port, use_ssl: true) self rescue StandardError raise ConnectionError.new "Error connecting to server." end |