Class: Chatpdf::Api::FileUpload
- Inherits:
-
Base
- Object
- Base
- Chatpdf::Api::FileUpload
show all
- Defined in:
- lib/chatpdf/api/file_upload.rb
Instance Attribute Summary
Attributes inherited from Base
#client
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#add_pdf_via_upload(file_path) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/chatpdf/api/file_upload.rb', line 4
def add_pdf_via_upload(file_path)
file = File.new(file_path ,'rb')
response = client.upload_file("/sources/add-file", {
body: {
file: file
}
})
file.close
ResponseHandler.new(response).response_body
end
|
#add_pdf_via_url(url) ⇒ Object
16
17
18
19
20
21
22
23
24
|
# File 'lib/chatpdf/api/file_upload.rb', line 16
def add_pdf_via_url(url)
response = client.request("/sources/add-url", {
body: {
url: url
}
})
ResponseHandler.new(response).response_body
end
|