Class: Altertable::Lakehouse::Adapters::NetHttpAdapter

Inherits:
Base
  • Object
show all
Defined in:
lib/altertable/lakehouse/adapters.rb

Instance Method Summary collapse

Constructor Details

#initialize(base_url:, timeout:, headers: {}) ⇒ NetHttpAdapter

Returns a new instance of NetHttpAdapter.



136
137
138
139
140
141
# File 'lib/altertable/lakehouse/adapters.rb', line 136

def initialize(base_url:, timeout:, headers: {})
  super
  require "net/http"
  require "uri"
  @uri = URI.parse(@base_url)
end

Instance Method Details

#delete(path, body: nil, params: {}, headers: {}, &block) ⇒ Object

rubocop:disable Lint/UnusedMethodArgument



151
152
153
# File 'lib/altertable/lakehouse/adapters.rb', line 151

def delete(path, body: nil, params: {}, headers: {}, &block) # rubocop:disable Lint/UnusedMethodArgument
  request(Net::HTTP::Delete, path, params: params, headers: headers, &block)
end

#get(path, body: nil, params: {}, headers: {}, &block) ⇒ Object

rubocop:disable Lint/UnusedMethodArgument



143
144
145
# File 'lib/altertable/lakehouse/adapters.rb', line 143

def get(path, body: nil, params: {}, headers: {}, &block) # rubocop:disable Lint/UnusedMethodArgument
  request(Net::HTTP::Get, path, params: params, headers: headers, &block)
end

#post(path, body: nil, params: {}, headers: {}, &block) ⇒ Object



147
148
149
# File 'lib/altertable/lakehouse/adapters.rb', line 147

def post(path, body: nil, params: {}, headers: {}, &block)
  request(Net::HTTP::Post, path, body: body, params: params, headers: headers, &block)
end