lib/crate_ruby/client.rb in crate_ruby-0.1.0 vs lib/crate_ruby/client.rb in crate_ruby-0.2.0
- old
+ new
@@ -43,10 +43,11 @@
@logger = opts[:logger] || CrateRuby.logger
@http_options = opts[:http_options] || { read_timeout: 3600 }
@schema = opts[:schema] || 'doc'
@username = opts[:username]
@password = opts[:password]
+ @ssl = opts[:ssl] || false
end
def inspect
%(#<CrateRuby::Client:#{object_id}>)
end
@@ -218,10 +219,12 @@
"/_blobs/#{table}/#{digest}"
end
def connection
host, port = @servers.first.split(':')
- Net::HTTP.new(host, port)
+ http = Net::HTTP.new(host, port)
+ http.use_ssl = true if @ssl
+ return http
end
def request(req, http_options = {})
options = @http_options.merge(http_options)
connection.start do |http|