Module: FileboundClient::Endpoints::DocumentBinaryData
- Defined in:
- lib/filebound_client/endpoints/document_binary_data.rb
Overview
Module for DocumentBinaryData resource endpoint
Instance Method Summary collapse
-
#add_binary_data(extension, file_id, binary_data) ⇒ Hash
Adds binary data.
-
#add_to_indexing_queue(extension, binary_data, project_id = nil) ⇒ Hash
Adds binary data to the indexing queue.
-
#retrieve_binary_data(document_id, query_params = nil) ⇒ binary
Retrieves document binary data.
-
#update_binary_data(document_id, extension, binary_data) ⇒ Hash
Updates binary data.
Instance Method Details
#add_binary_data(extension, file_id, binary_data) ⇒ Hash
Adds binary data
18 19 20 21 22 23 24 25 |
# File 'lib/filebound_client/endpoints/document_binary_data.rb', line 18 def add_binary_data(extension, file_id, binary_data) raise FileboundClientException.new('extension is required', 0) if extension.blank? # rubocop:disable Metrics/LineLength raise FileboundClientException.new('file_id is required and must be greater than 0 when adding binary data', 0) if file_id.blank? || file_id.zero? # rubocop:enable Metrics/LineLength raise FileboundClientException.new('binary_data is required', 0) if binary_data.blank? post('/documentBinaryData/0', nil, id: 0, extension: extension, fileId: file_id, documentToUpload: binary_data) end |
#add_to_indexing_queue(extension, binary_data, project_id = nil) ⇒ Hash
Adds binary data to the indexing queue
44 45 46 47 48 49 50 |
# File 'lib/filebound_client/endpoints/document_binary_data.rb', line 44 def add_to_indexing_queue(extension, binary_data, project_id = nil) raise FileboundClientException.new('extension is required', 0) if extension.blank? raise FileboundClientException.new('binary_data is required', 0) if binary_data.blank? body = { extension: extension, documentToUpload: binary_data } body[:projectId] = project_id unless project_id.blank? put('/documentBinaryData', nil, body) end |
#retrieve_binary_data(document_id, query_params = nil) ⇒ binary
Retrieves document binary data
9 10 11 |
# File 'lib/filebound_client/endpoints/document_binary_data.rb', line 9 def retrieve_binary_data(document_id, query_params = nil) get_binary("/documentBinaryData/#{document_id}", query_params) end |
#update_binary_data(document_id, extension, binary_data) ⇒ Hash
Updates binary data
32 33 34 35 36 37 |
# File 'lib/filebound_client/endpoints/document_binary_data.rb', line 32 def update_binary_data(document_id, extension, binary_data) raise FileboundClientException.new('extension is required', 0) if extension.blank? raise FileboundClientException.new('binary_data is required', 0) if binary_data.blank? post("/documentBinaryData/#{document_id}", nil, id: document_id, extension: extension, documentToUpload: binary_data) end |