lib/dbx/gateway.rb in dbx-api-0.1.1 vs lib/dbx/gateway.rb in dbx-api-0.2.0
- old
+ new
@@ -4,15 +4,17 @@
require_relative "databricks/databricks"
# This class is a gateway to the Databricks API.
# https://docs.databricks.com/api-explorer/workspace/introduction
class DatabricksGateway
- def initialize(host: ENV.fetch("DBX_HOST", nil), token: ENV.fetch("DBX_TOKEN", nil), warehouse: ENV.fetch("DBX_WAREHOUSE_ID", nil))
+ def initialize(host: ENV.fetch("DBX_HOST", nil), token: ENV.fetch("DBX_TOKEN", nil),
+ warehouse: ENV.fetch("DBX_WAREHOUSE_ID", nil), sleep_timer: 5)
@base_url = host
@uri = URI(@base_url)
@token = token
@warehouse = warehouse
+ @sleep_timer = sleep_timer
end
# HTTP request headers
def request_headers
{
@@ -21,9 +23,10 @@
"Accept" => "application/json"
}
end
# HTTP connection object
+ # @return [Net::HTTP]
def http
http = Net::HTTP.new(@uri.host, @uri.port)
http.use_ssl = true
http
end