Class: AnswerLayer::ConnectionsResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/answerlayer/resources/connections.rb

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from AnswerLayer::Resource

Instance Method Details

#listObject



5
6
7
# File 'lib/answerlayer/resources/connections.rb', line 5

def list
  request(method: :get, path: "/connections/")
end

#schema(connection_id:) ⇒ Object



13
14
15
# File 'lib/answerlayer/resources/connections.rb', line 13

def schema(connection_id:)
  request(method: :get, path: "/connections/#{connection_id}/schema")
end

#test_existing(connection_id:) ⇒ Object



9
10
11
# File 'lib/answerlayer/resources/connections.rb', line 9

def test_existing(connection_id:)
  to_api_response(request(method: :post, path: "/connections/#{connection_id}/test_existing"))
end

#upload_csv(file:, name: nil, has_header: nil, delimiter: nil) ⇒ Object



17
18
19
# File 'lib/answerlayer/resources/connections.rb', line 17

def upload_csv(file:, name: nil, has_header: nil, delimiter: nil)
  request(method: :post, path: "/csv/upload", multipart: compact(file: file, name: name, has_header: has_header, delimiter: delimiter))
end

#upload_duckdb(file:, name: nil) ⇒ Object



21
22
23
# File 'lib/answerlayer/resources/connections.rb', line 21

def upload_duckdb(file:, name: nil)
  request(method: :post, path: "/duckdb/upload", multipart: compact(file: file, name: name))
end