Class: Dolibarr::Api::Documents
- Inherits:
-
Object
- Object
- Dolibarr::Api::Documents
- Defined in:
- lib/dolibarr-api/api/documents.rb
Instance Method Summary collapse
- #builddoc(documents_builddoc_model:) ⇒ Object
- #bulk_destroy(modulepart:, original_file:) ⇒ Object
- #download(modulepart:, original_file: nil) ⇒ Object
-
#initialize(connection) ⇒ Documents
constructor
A new instance of Documents.
- #retrieve_documents_list_by_element(modulepart:, id: nil, ref: nil, sortfield: nil, sortorder: nil, limit: nil, page: nil, content_type: nil, pagination_data: nil) ⇒ Object
- #upload(create_documents_model:) ⇒ Object
Constructor Details
#initialize(connection) ⇒ Documents
Returns a new instance of Documents.
5 6 7 |
# File 'lib/dolibarr-api/api/documents.rb', line 5 def initialize(connection) @connection = connection end |
Instance Method Details
#builddoc(documents_builddoc_model:) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/dolibarr-api/api/documents.rb', line 9 def builddoc(documents_builddoc_model:) raise ArgumentError, 'documents_builddoc_model is required' if documents_builddoc_model.nil? @connection.call( :PUT, '/documents/builddoc', type: nil, auth: ['api_key'], body: documents_builddoc_model ) end |
#bulk_destroy(modulepart:, original_file:) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/dolibarr-api/api/documents.rb', line 21 def bulk_destroy(modulepart:, original_file:) raise ArgumentError, 'modulepart is required' if modulepart.nil? raise ArgumentError, 'original_file is required' if original_file.nil? @connection.call( :DELETE, '/documents', type: nil, auth: ['api_key'], query: { 'modulepart' => modulepart, 'original_file' => original_file } ) end |
#download(modulepart:, original_file: nil) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/dolibarr-api/api/documents.rb', line 34 def download(modulepart:, original_file: nil) raise ArgumentError, 'modulepart is required' if modulepart.nil? @connection.call( :GET, '/documents/download', type: nil, auth: ['api_key'], query: { 'modulepart' => modulepart, 'original_file' => original_file } ) end |
#retrieve_documents_list_by_element(modulepart:, id: nil, ref: nil, sortfield: nil, sortorder: nil, limit: nil, page: nil, content_type: nil, pagination_data: nil) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/dolibarr-api/api/documents.rb', line 46 def retrieve_documents_list_by_element(modulepart:, id: nil, ref: nil, sortfield: nil, sortorder: nil, limit: nil, page: nil, content_type: nil, pagination_data: nil) raise ArgumentError, 'modulepart is required' if modulepart.nil? @connection.call( :GET, '/documents', type: nil, auth: ['api_key'], query: { 'modulepart' => modulepart, 'id' => id, 'ref' => ref, 'sortfield' => sortfield, 'sortorder' => sortorder, 'limit' => limit, 'page' => page, 'content_type' => content_type, 'pagination_data' => pagination_data } ) end |
#upload(create_documents_model:) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/dolibarr-api/api/documents.rb', line 58 def upload(create_documents_model:) raise ArgumentError, 'create_documents_model is required' if create_documents_model.nil? @connection.call( :POST, '/documents/upload', type: nil, auth: ['api_key'], body: create_documents_model ) end |