=begin #DocuSign Rooms API - v2 #An API for an integrator to access the features of DocuSign Rooms OpenAPI spec version: v2 Contact: devcenter@docusign.com Generated by: https://github.com/swagger-api/swagger-codegen.git =end require "uri" module DocuSign_Rooms class GetDocumentOptions # attr_accessor :include_contents def self.default @@default ||= GetDocumentOptions.new end end class DocumentsApi attr_accessor :api_client def initialize(api_client = DocumentsApi.default) @api_client = api_client end # Grants access to a document for a user. # # @param document_id # @param account_id # @param document_user_for_create # @return [DocumentUser] def create_document_user(document_id, account_id, document_user_for_create) data, _status_code, _headers = create_document_user_with_http_info(document_id, account_id, document_user_for_create) return data end # Grants access to a document for a user. # # @param document_id # @param account_id # @param document_user_for_create # @return [Array<(DocumentUser, Fixnum, Hash)>] DocumentUser data, response status code and response headers def create_document_user_with_http_info(document_id, account_id, document_user_for_create) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: DocumentsApi.create_document_user ..." end # verify the required parameter 'document_id' is set fail ArgumentError, "Missing the required parameter 'document_id' when calling DocumentsApi.create_document_user" if document_id.nil? # verify the required parameter 'document_user_for_create' is set fail ArgumentError, "Missing the required parameter 'document_user_for_create' when calling DocumentsApi.create_document_user" if document_user_for_create.nil? # verify the required parameter 'account_id' is set fail ArgumentError, "Missing the required parameter 'account_id' when calling DocumentsApi.create_document_user" if account_id.nil? # resource path local_var_path = "/v2/accounts/{accountId}/documents/{documentId}/users".sub('{format}','json').sub('{' + 'documentId' + '}', document_id.to_s).sub('{' + 'accountId' + '}', account_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(document_user_for_create) auth_names = [] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'DocumentUser') if @api_client.config.debugging @api_client.config.logger.debug "API called: DocumentsApi#create_document_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Deletes a document. # # @param document_id # @param account_id # @return [nil] def delete_document(document_id, account_id) delete_document_with_http_info(document_id, account_id) return nil end # Deletes a document. # # @param document_id # @param account_id # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def delete_document_with_http_info(document_id, account_id) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: DocumentsApi.delete_document ..." end # verify the required parameter 'document_id' is set fail ArgumentError, "Missing the required parameter 'document_id' when calling DocumentsApi.delete_document" if document_id.nil? # verify the required parameter 'account_id' is set fail ArgumentError, "Missing the required parameter 'account_id' when calling DocumentsApi.delete_document" if account_id.nil? # resource path local_var_path = "/v2/accounts/{accountId}/documents/{documentId}".sub('{format}','json').sub('{' + 'documentId' + '}', document_id.to_s).sub('{' + 'accountId' + '}', account_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: DocumentsApi#delete_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get information about the Document with the given DocumentId. # # @param document_id # @param account_id # @param DocuSign_Rooms::GetDocumentOptions Options for modifying the behavior of the function. # @return [Document] def get_document(document_id, account_id, options = DocuSign_Rooms::GetDocumentOptions.default) data, _status_code, _headers = get_document_with_http_info(document_id, account_id, options) return data end # Get information about the Document with the given DocumentId. # # @param document_id # @param account_id # @param DocuSign_Rooms::GetDocumentOptions Options for modifying the behavior of the function. # @return [Array<(Document, Fixnum, Hash)>] Document data, response status code and response headers def get_document_with_http_info(document_id, account_id, options = DocuSign_Rooms::GetDocumentOptions.default) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: DocumentsApi.get_document ..." end # verify the required parameter 'document_id' is set fail ArgumentError, "Missing the required parameter 'document_id' when calling DocumentsApi.get_document" if document_id.nil? # verify the required parameter 'account_id' is set fail ArgumentError, "Missing the required parameter 'account_id' when calling DocumentsApi.get_document" if account_id.nil? # resource path local_var_path = "/v2/accounts/{accountId}/documents/{documentId}".sub('{format}','json').sub('{' + 'documentId' + '}', document_id.to_s).sub('{' + 'accountId' + '}', account_id.to_s) # query parameters query_params = {} query_params[:'includeContents'] = options.include_contents if !options.include_contents.nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Document') if @api_client.config.debugging @api_client.config.logger.debug "API called: DocumentsApi#get_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end