=begin #Tripletex API OpenAPI spec version: 2.69.5 Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.4.24 =end require 'uri' module TripletexRubyClient class LedgervoucherApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # [BETA] Delete voucher by ID. # # @param id Element ID # @param [Hash] opts the optional parameters # @return [nil] def delete(id, opts = {}) delete_with_http_info(id, opts) nil end # [BETA] Delete voucher by ID. # # @param id Element ID # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def delete_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LedgervoucherApi.delete ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling LedgervoucherApi.delete" end # resource path local_var_path = '/ledger/voucher/{id}'.sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} # header parameters header_params = {} # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['tokenAuthScheme'] 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: LedgervoucherApi#delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # [BETA] Delete attachment. # # @param voucher_id ID of voucher containing the attachment to delete. # @param [Hash] opts the optional parameters # @option opts [Integer] :version Version of voucher containing the attachment to delete. # @option opts [BOOLEAN] :send_to_inbox Should the attachment be sent to inbox rather than deleted? (default to false) # @option opts [BOOLEAN] :split If sendToInbox is true, should the attachment be split into one voucher per page? (default to false) # @return [nil] def delete_attachment(voucher_id, opts = {}) delete_attachment_with_http_info(voucher_id, opts) nil end # [BETA] Delete attachment. # # @param voucher_id ID of voucher containing the attachment to delete. # @param [Hash] opts the optional parameters # @option opts [Integer] :version Version of voucher containing the attachment to delete. # @option opts [BOOLEAN] :send_to_inbox Should the attachment be sent to inbox rather than deleted? # @option opts [BOOLEAN] :split If sendToInbox is true, should the attachment be split into one voucher per page? # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def delete_attachment_with_http_info(voucher_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LedgervoucherApi.delete_attachment ...' end # verify the required parameter 'voucher_id' is set if @api_client.config.client_side_validation && voucher_id.nil? fail ArgumentError, "Missing the required parameter 'voucher_id' when calling LedgervoucherApi.delete_attachment" end if @api_client.config.client_side_validation && !opts[:'version'].nil? && opts[:'version'] < 0 fail ArgumentError, 'invalid value for "opts[:"version"]" when calling LedgervoucherApi.delete_attachment, must be greater than or equal to 0.' end # resource path local_var_path = '/ledger/voucher/{voucherId}/attachment'.sub('{' + 'voucherId' + '}', voucher_id.to_s) # query parameters query_params = {} query_params[:'version'] = opts[:'version'] if !opts[:'version'].nil? query_params[:'sendToInbox'] = opts[:'send_to_inbox'] if !opts[:'send_to_inbox'].nil? query_params[:'split'] = opts[:'split'] if !opts[:'split'].nil? # header parameters header_params = {} # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['tokenAuthScheme'] 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: LedgervoucherApi#delete_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get PDF representation of voucher by ID. # # @param voucher_id Voucher ID from which PDF is downloaded. # @param [Hash] opts the optional parameters # @option opts [String] :return_type 'String' type set as default # @return [String] def download_pdf(voucher_id, opts = {}) data, _status_code, _headers = download_pdf_with_http_info(voucher_id, opts) data end # Get PDF representation of voucher by ID. # # @param voucher_id Voucher ID from which PDF is downloaded. # @param [Hash] opts the optional parameters # @option opts [String] :return_type 'String' type set as default # @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers def download_pdf_with_http_info(voucher_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LedgervoucherApi.download_pdf ...' end # verify the required parameter 'voucher_id' is set if @api_client.config.client_side_validation && voucher_id.nil? fail ArgumentError, "Missing the required parameter 'voucher_id' when calling LedgervoucherApi.download_pdf" end # resource path local_var_path = '/ledger/voucher/{voucherId}/pdf'.sub('{' + 'voucherId' + '}', voucher_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/octet-stream']) # form parameters form_params = {} # return_type return_type = opts[:'return_type'] || 'String' # http body (model) post_body = nil auth_names = ['tokenAuthScheme'] 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 => return_type) if @api_client.config.debugging @api_client.config.logger.debug "API called: LedgervoucherApi#download_pdf\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # [BETA] Find vouchers based on the external voucher number. # # @param [Hash] opts the optional parameters # @option opts [String] :external_voucher_number The external voucher number, when voucher is created from import. # @option opts [Integer] :from From index (default to 0) # @option opts [Integer] :count Number of elements to return (default to 1000) # @option opts [String] :sorting Sorting pattern # @option opts [String] :fields Fields filter pattern # @return [ListResponseVoucher] def external_voucher_number(opts = {}) data, _status_code, _headers = external_voucher_number_with_http_info(opts) data end # [BETA] Find vouchers based on the external voucher number. # # @param [Hash] opts the optional parameters # @option opts [String] :external_voucher_number The external voucher number, when voucher is created from import. # @option opts [Integer] :from From index # @option opts [Integer] :count Number of elements to return # @option opts [String] :sorting Sorting pattern # @option opts [String] :fields Fields filter pattern # @return [Array<(ListResponseVoucher, Fixnum, Hash)>] ListResponseVoucher data, response status code and response headers def external_voucher_number_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LedgervoucherApi.external_voucher_number ...' end # resource path local_var_path = '/ledger/voucher/>externalVoucherNumber' # query parameters query_params = {} query_params[:'externalVoucherNumber'] = opts[:'external_voucher_number'] if !opts[:'external_voucher_number'].nil? query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil? query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil? query_params[:'sorting'] = opts[:'sorting'] if !opts[:'sorting'].nil? query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil? # header parameters header_params = {} # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['tokenAuthScheme'] 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 => 'ListResponseVoucher') if @api_client.config.debugging @api_client.config.logger.debug "API called: LedgervoucherApi#external_voucher_number\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get voucher by ID. # # @param id Element ID # @param [Hash] opts the optional parameters # @option opts [String] :fields Fields filter pattern # @return [ResponseWrapperVoucher] def get(id, opts = {}) data, _status_code, _headers = get_with_http_info(id, opts) data end # Get voucher by ID. # # @param id Element ID # @param [Hash] opts the optional parameters # @option opts [String] :fields Fields filter pattern # @return [Array<(ResponseWrapperVoucher, Fixnum, Hash)>] ResponseWrapperVoucher data, response status code and response headers def get_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LedgervoucherApi.get ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling LedgervoucherApi.get" end # resource path local_var_path = '/ledger/voucher/{id}'.sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil? # header parameters header_params = {} # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['tokenAuthScheme'] 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 => 'ResponseWrapperVoucher') if @api_client.config.debugging @api_client.config.logger.debug "API called: LedgervoucherApi#get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # [BETA] Upload a document to create one or more vouchers. Valid document formats are PDF, PNG, JPEG, TIFF and EHF. Send as multipart form. # # @param file The file # @param [Hash] opts the optional parameters # @option opts [String] :description Optional description to use for the voucher(s). If omitted the file name will be used. # @option opts [BOOLEAN] :split If the document consists of several pages, should the document be split into one voucher per page? (default to false) # @return [ListResponseVoucher] def import_document(file, opts = {}) data, _status_code, _headers = import_document_with_http_info(file, opts) data end # [BETA] Upload a document to create one or more vouchers. Valid document formats are PDF, PNG, JPEG, TIFF and EHF. Send as multipart form. # # @param file The file # @param [Hash] opts the optional parameters # @option opts [String] :description Optional description to use for the voucher(s). If omitted the file name will be used. # @option opts [BOOLEAN] :split If the document consists of several pages, should the document be split into one voucher per page? # @return [Array<(ListResponseVoucher, Fixnum, Hash)>] ListResponseVoucher data, response status code and response headers def import_document_with_http_info(file, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LedgervoucherApi.import_document ...' end # verify the required parameter 'file' is set if @api_client.config.client_side_validation && file.nil? fail ArgumentError, "Missing the required parameter 'file' when calling LedgervoucherApi.import_document" end # resource path local_var_path = '/ledger/voucher/importDocument' # query parameters query_params = {} query_params[:'split'] = opts[:'split'] if !opts[:'split'].nil? # header parameters header_params = {} # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data']) # form parameters form_params = {} form_params['file'] = file form_params['description'] = opts[:'description'] if !opts[:'description'].nil? # http body (model) post_body = nil auth_names = ['tokenAuthScheme'] 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 => 'ListResponseVoucher') if @api_client.config.debugging @api_client.config.logger.debug "API called: LedgervoucherApi#import_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Import GBAT10. Send as multipart form. # # @param generate_vat_postings If the import should generate VAT postings # @param file The file # @param [Hash] opts the optional parameters # @option opts [String] :encoding The file encoding (default to utf-8) # @return [nil] def import_gbat10(generate_vat_postings, file, opts = {}) import_gbat10_with_http_info(generate_vat_postings, file, opts) nil end # Import GBAT10. Send as multipart form. # # @param generate_vat_postings If the import should generate VAT postings # @param file The file # @param [Hash] opts the optional parameters # @option opts [String] :encoding The file encoding # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def import_gbat10_with_http_info(generate_vat_postings, file, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LedgervoucherApi.import_gbat10 ...' end # verify the required parameter 'generate_vat_postings' is set if @api_client.config.client_side_validation && generate_vat_postings.nil? fail ArgumentError, "Missing the required parameter 'generate_vat_postings' when calling LedgervoucherApi.import_gbat10" end # verify the required parameter 'file' is set if @api_client.config.client_side_validation && file.nil? fail ArgumentError, "Missing the required parameter 'file' when calling LedgervoucherApi.import_gbat10" end # resource path local_var_path = '/ledger/voucher/importGbat10' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data']) # form parameters form_params = {} form_params['generateVatPostings'] = generate_vat_postings form_params['file'] = file form_params['encoding'] = opts[:'encoding'] if !opts[:'encoding'].nil? # http body (model) post_body = nil auth_names = ['tokenAuthScheme'] 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) if @api_client.config.debugging @api_client.config.logger.debug "API called: LedgervoucherApi#import_gbat10\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # [BETA] Find non-posted vouchers. # # @param include_non_approved Include non-approved vouchers in the result. # @param [Hash] opts the optional parameters # @option opts [String] :date_from From and including # @option opts [String] :date_to To and excluding # @option opts [String] :changed_since Only return elements that have changed since this date and time # @option opts [Integer] :from From index (default to 0) # @option opts [Integer] :count Number of elements to return (default to 1000) # @option opts [String] :sorting Sorting pattern # @option opts [String] :fields Fields filter pattern # @return [ListResponseVoucher] def non_posted(include_non_approved, opts = {}) data, _status_code, _headers = non_posted_with_http_info(include_non_approved, opts) data end # [BETA] Find non-posted vouchers. # # @param include_non_approved Include non-approved vouchers in the result. # @param [Hash] opts the optional parameters # @option opts [String] :date_from From and including # @option opts [String] :date_to To and excluding # @option opts [String] :changed_since Only return elements that have changed since this date and time # @option opts [Integer] :from From index # @option opts [Integer] :count Number of elements to return # @option opts [String] :sorting Sorting pattern # @option opts [String] :fields Fields filter pattern # @return [Array<(ListResponseVoucher, Fixnum, Hash)>] ListResponseVoucher data, response status code and response headers def non_posted_with_http_info(include_non_approved, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LedgervoucherApi.non_posted ...' end # verify the required parameter 'include_non_approved' is set if @api_client.config.client_side_validation && include_non_approved.nil? fail ArgumentError, "Missing the required parameter 'include_non_approved' when calling LedgervoucherApi.non_posted" end # resource path local_var_path = '/ledger/voucher/>nonPosted' # query parameters query_params = {} query_params[:'includeNonApproved'] = include_non_approved query_params[:'dateFrom'] = opts[:'date_from'] if !opts[:'date_from'].nil? query_params[:'dateTo'] = opts[:'date_to'] if !opts[:'date_to'].nil? query_params[:'changedSince'] = opts[:'changed_since'] if !opts[:'changed_since'].nil? query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil? query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil? query_params[:'sorting'] = opts[:'sorting'] if !opts[:'sorting'].nil? query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil? # header parameters header_params = {} # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['tokenAuthScheme'] 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 => 'ListResponseVoucher') if @api_client.config.debugging @api_client.config.logger.debug "API called: LedgervoucherApi#non_posted\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # [BETA] Returns a data structure containing meta information about operations that are available for this voucher. Currently only implemented for DELETE: It is possible to check if the voucher is deletable. # # @param id Element ID # @param [Hash] opts the optional parameters # @option opts [String] :fields Fields filter pattern # @return [ResponseWrapperVoucherOptions] def options(id, opts = {}) data, _status_code, _headers = options_with_http_info(id, opts) data end # [BETA] Returns a data structure containing meta information about operations that are available for this voucher. Currently only implemented for DELETE: It is possible to check if the voucher is deletable. # # @param id Element ID # @param [Hash] opts the optional parameters # @option opts [String] :fields Fields filter pattern # @return [Array<(ResponseWrapperVoucherOptions, Fixnum, Hash)>] ResponseWrapperVoucherOptions data, response status code and response headers def options_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LedgervoucherApi.options ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling LedgervoucherApi.options" end # resource path local_var_path = '/ledger/voucher/{id}/options'.sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil? # header parameters header_params = {} # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['tokenAuthScheme'] 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 => 'ResponseWrapperVoucherOptions') if @api_client.config.debugging @api_client.config.logger.debug "API called: LedgervoucherApi#options\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Add new voucher. IMPORTANT: Also creates postings. Only the gross amounts will be used # # @param [Hash] opts the optional parameters # @option opts [BOOLEAN] :send_to_ledger Should the voucher be sent to ledger? Requires the \"Advanced Voucher\" permission. (default to true) # @option opts [Voucher] :body JSON representing the new object to be created. Should not have ID and version set. # @return [ResponseWrapperVoucher] def post(opts = {}) data, _status_code, _headers = post_with_http_info(opts) data end # Add new voucher. IMPORTANT: Also creates postings. Only the gross amounts will be used # # @param [Hash] opts the optional parameters # @option opts [BOOLEAN] :send_to_ledger Should the voucher be sent to ledger? Requires the \"Advanced Voucher\" permission. # @option opts [Voucher] :body JSON representing the new object to be created. Should not have ID and version set. # @return [Array<(ResponseWrapperVoucher, Fixnum, Hash)>] ResponseWrapperVoucher data, response status code and response headers def post_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LedgervoucherApi.post ...' end # resource path local_var_path = '/ledger/voucher' # query parameters query_params = {} query_params[:'sendToLedger'] = opts[:'send_to_ledger'] if !opts[:'send_to_ledger'].nil? # header parameters header_params = {} # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=utf-8']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(opts[:'body']) auth_names = ['tokenAuthScheme'] 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 => 'ResponseWrapperVoucher') if @api_client.config.debugging @api_client.config.logger.debug "API called: LedgervoucherApi#post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # [BETA] Update voucher. Postings with guiRow==0 will be deleted and regenerated. # # @param id Element ID # @param [Hash] opts the optional parameters # @option opts [BOOLEAN] :send_to_ledger Should the voucher be sent to ledger? Requires the \"Advanced Voucher\" permission. (default to true) # @option opts [Voucher] :body Partial object describing what should be updated # @return [ResponseWrapperVoucher] def put(id, opts = {}) data, _status_code, _headers = put_with_http_info(id, opts) data end # [BETA] Update voucher. Postings with guiRow==0 will be deleted and regenerated. # # @param id Element ID # @param [Hash] opts the optional parameters # @option opts [BOOLEAN] :send_to_ledger Should the voucher be sent to ledger? Requires the \"Advanced Voucher\" permission. # @option opts [Voucher] :body Partial object describing what should be updated # @return [Array<(ResponseWrapperVoucher, Fixnum, Hash)>] ResponseWrapperVoucher data, response status code and response headers def put_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LedgervoucherApi.put ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling LedgervoucherApi.put" end # resource path local_var_path = '/ledger/voucher/{id}'.sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} query_params[:'sendToLedger'] = opts[:'send_to_ledger'] if !opts[:'send_to_ledger'].nil? # header parameters header_params = {} # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=utf-8']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(opts[:'body']) auth_names = ['tokenAuthScheme'] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ResponseWrapperVoucher') if @api_client.config.debugging @api_client.config.logger.debug "API called: LedgervoucherApi#put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # [BETA] Update multiple vouchers. Postings with guiRow==0 will be deleted and regenerated. # # @param [Hash] opts the optional parameters # @option opts [BOOLEAN] :send_to_ledger Should the voucher be sent to ledger? Requires the \"Advanced Voucher\" permission. (default to true) # @option opts [Array] :body JSON representing updates to object. Should have ID and version set. # @return [ListResponseVoucher] def put_list(opts = {}) data, _status_code, _headers = put_list_with_http_info(opts) data end # [BETA] Update multiple vouchers. Postings with guiRow==0 will be deleted and regenerated. # # @param [Hash] opts the optional parameters # @option opts [BOOLEAN] :send_to_ledger Should the voucher be sent to ledger? Requires the \"Advanced Voucher\" permission. # @option opts [Array] :body JSON representing updates to object. Should have ID and version set. # @return [Array<(ListResponseVoucher, Fixnum, Hash)>] ListResponseVoucher data, response status code and response headers def put_list_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LedgervoucherApi.put_list ...' end # resource path local_var_path = '/ledger/voucher/list' # query parameters query_params = {} query_params[:'sendToLedger'] = opts[:'send_to_ledger'] if !opts[:'send_to_ledger'].nil? # header parameters header_params = {} # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=utf-8']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(opts[:'body']) auth_names = ['tokenAuthScheme'] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ListResponseVoucher') if @api_client.config.debugging @api_client.config.logger.debug "API called: LedgervoucherApi#put_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Reverses the voucher, and returns the reversed voucher. Supports reversing most voucher types, except salary transactions. # # @param id ID of voucher that should be reversed. # @param date Reverse voucher date # @param [Hash] opts the optional parameters # @return [ResponseWrapperVoucher] def reverse(id, date, opts = {}) data, _status_code, _headers = reverse_with_http_info(id, date, opts) data end # Reverses the voucher, and returns the reversed voucher. Supports reversing most voucher types, except salary transactions. # # @param id ID of voucher that should be reversed. # @param date Reverse voucher date # @param [Hash] opts the optional parameters # @return [Array<(ResponseWrapperVoucher, Fixnum, Hash)>] ResponseWrapperVoucher data, response status code and response headers def reverse_with_http_info(id, date, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LedgervoucherApi.reverse ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling LedgervoucherApi.reverse" end # verify the required parameter 'date' is set if @api_client.config.client_side_validation && date.nil? fail ArgumentError, "Missing the required parameter 'date' when calling LedgervoucherApi.reverse" end # resource path local_var_path = '/ledger/voucher/{id}/:reverse'.sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} query_params[:'date'] = date # header parameters header_params = {} # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['tokenAuthScheme'] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ResponseWrapperVoucher') if @api_client.config.debugging @api_client.config.logger.debug "API called: LedgervoucherApi#reverse\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Find vouchers corresponding with sent data. # # @param date_from From and including # @param date_to To and excluding # @param [Hash] opts the optional parameters # @option opts [String] :id List of IDs # @option opts [String] :number List of IDs # @option opts [Integer] :number_from From and including # @option opts [Integer] :number_to To and excluding # @option opts [String] :type_id List of IDs # @option opts [Integer] :from From index (default to 0) # @option opts [Integer] :count Number of elements to return (default to 1000) # @option opts [String] :sorting Sorting pattern # @option opts [String] :fields Fields filter pattern # @return [VoucherSearchResponse] def search(date_from, date_to, opts = {}) data, _status_code, _headers = search_with_http_info(date_from, date_to, opts) data end # Find vouchers corresponding with sent data. # # @param date_from From and including # @param date_to To and excluding # @param [Hash] opts the optional parameters # @option opts [String] :id List of IDs # @option opts [String] :number List of IDs # @option opts [Integer] :number_from From and including # @option opts [Integer] :number_to To and excluding # @option opts [String] :type_id List of IDs # @option opts [Integer] :from From index # @option opts [Integer] :count Number of elements to return # @option opts [String] :sorting Sorting pattern # @option opts [String] :fields Fields filter pattern # @return [Array<(VoucherSearchResponse, Fixnum, Hash)>] VoucherSearchResponse data, response status code and response headers def search_with_http_info(date_from, date_to, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LedgervoucherApi.search ...' end # verify the required parameter 'date_from' is set if @api_client.config.client_side_validation && date_from.nil? fail ArgumentError, "Missing the required parameter 'date_from' when calling LedgervoucherApi.search" end # verify the required parameter 'date_to' is set if @api_client.config.client_side_validation && date_to.nil? fail ArgumentError, "Missing the required parameter 'date_to' when calling LedgervoucherApi.search" end # resource path local_var_path = '/ledger/voucher' # query parameters query_params = {} query_params[:'dateFrom'] = date_from query_params[:'dateTo'] = date_to query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil? query_params[:'number'] = opts[:'number'] if !opts[:'number'].nil? query_params[:'numberFrom'] = opts[:'number_from'] if !opts[:'number_from'].nil? query_params[:'numberTo'] = opts[:'number_to'] if !opts[:'number_to'].nil? query_params[:'typeId'] = opts[:'type_id'] if !opts[:'type_id'].nil? query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil? query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil? query_params[:'sorting'] = opts[:'sorting'] if !opts[:'sorting'].nil? query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil? # header parameters header_params = {} # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['tokenAuthScheme'] 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 => 'VoucherSearchResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: LedgervoucherApi#search\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # [BETA] Send voucher to inbox. # # @param id ID of voucher that should be sent to inbox. # @param [Hash] opts the optional parameters # @option opts [Integer] :version Version of voucher that should be sent to inbox. # @option opts [String] :comment Description of why the voucher was rejected. This parameter is only used if the approval feature is enabled. # @return [ResponseWrapperVoucher] def send_to_inbox(id, opts = {}) data, _status_code, _headers = send_to_inbox_with_http_info(id, opts) data end # [BETA] Send voucher to inbox. # # @param id ID of voucher that should be sent to inbox. # @param [Hash] opts the optional parameters # @option opts [Integer] :version Version of voucher that should be sent to inbox. # @option opts [String] :comment Description of why the voucher was rejected. This parameter is only used if the approval feature is enabled. # @return [Array<(ResponseWrapperVoucher, Fixnum, Hash)>] ResponseWrapperVoucher data, response status code and response headers def send_to_inbox_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LedgervoucherApi.send_to_inbox ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling LedgervoucherApi.send_to_inbox" end if @api_client.config.client_side_validation && !opts[:'version'].nil? && opts[:'version'] < 0 fail ArgumentError, 'invalid value for "opts[:"version"]" when calling LedgervoucherApi.send_to_inbox, must be greater than or equal to 0.' end # resource path local_var_path = '/ledger/voucher/{id}/:sendToInbox'.sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} query_params[:'version'] = opts[:'version'] if !opts[:'version'].nil? query_params[:'comment'] = opts[:'comment'] if !opts[:'comment'].nil? # header parameters header_params = {} # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['tokenAuthScheme'] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ResponseWrapperVoucher') if @api_client.config.debugging @api_client.config.logger.debug "API called: LedgervoucherApi#send_to_inbox\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # [BETA] Send voucher to ledger. # # @param id ID of voucher that should be sent to ledger. # @param [Hash] opts the optional parameters # @option opts [Integer] :version Version of voucher that should be sent to ledger. # @option opts [Integer] :number Voucher number to use. If omitted or 0 the system will assign the number. (default to 0) # @return [ResponseWrapperVoucher] def send_to_ledger(id, opts = {}) data, _status_code, _headers = send_to_ledger_with_http_info(id, opts) data end # [BETA] Send voucher to ledger. # # @param id ID of voucher that should be sent to ledger. # @param [Hash] opts the optional parameters # @option opts [Integer] :version Version of voucher that should be sent to ledger. # @option opts [Integer] :number Voucher number to use. If omitted or 0 the system will assign the number. # @return [Array<(ResponseWrapperVoucher, Fixnum, Hash)>] ResponseWrapperVoucher data, response status code and response headers def send_to_ledger_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LedgervoucherApi.send_to_ledger ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling LedgervoucherApi.send_to_ledger" end if @api_client.config.client_side_validation && !opts[:'version'].nil? && opts[:'version'] < 0 fail ArgumentError, 'invalid value for "opts[:"version"]" when calling LedgervoucherApi.send_to_ledger, must be greater than or equal to 0.' end if @api_client.config.client_side_validation && !opts[:'number'].nil? && opts[:'number'] < 0 fail ArgumentError, 'invalid value for "opts[:"number"]" when calling LedgervoucherApi.send_to_ledger, must be greater than or equal to 0.' end # resource path local_var_path = '/ledger/voucher/{id}/:sendToLedger'.sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} query_params[:'version'] = opts[:'version'] if !opts[:'version'].nil? query_params[:'number'] = opts[:'number'] if !opts[:'number'].nil? # header parameters header_params = {} # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['tokenAuthScheme'] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ResponseWrapperVoucher') if @api_client.config.debugging @api_client.config.logger.debug "API called: LedgervoucherApi#send_to_ledger\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Upload attachment to voucher. If the voucher already has an attachment the content will be appended to the existing attachment as new PDF page(s). Valid document formats are PDF, PNG, JPEG and TIFF. Non PDF formats will be converted to PDF. Send as multipart form. # # @param voucher_id Voucher ID to upload attachment to. # @param file The file # @param [Hash] opts the optional parameters # @return [nil] def upload_attachment(voucher_id, file, opts = {}) upload_attachment_with_http_info(voucher_id, file, opts) nil end # Upload attachment to voucher. If the voucher already has an attachment the content will be appended to the existing attachment as new PDF page(s). Valid document formats are PDF, PNG, JPEG and TIFF. Non PDF formats will be converted to PDF. Send as multipart form. # # @param voucher_id Voucher ID to upload attachment to. # @param file The file # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def upload_attachment_with_http_info(voucher_id, file, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LedgervoucherApi.upload_attachment ...' end # verify the required parameter 'voucher_id' is set if @api_client.config.client_side_validation && voucher_id.nil? fail ArgumentError, "Missing the required parameter 'voucher_id' when calling LedgervoucherApi.upload_attachment" end # verify the required parameter 'file' is set if @api_client.config.client_side_validation && file.nil? fail ArgumentError, "Missing the required parameter 'file' when calling LedgervoucherApi.upload_attachment" end # resource path local_var_path = '/ledger/voucher/{voucherId}/attachment'.sub('{' + 'voucherId' + '}', voucher_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data']) # form parameters form_params = {} form_params['file'] = file # http body (model) post_body = nil auth_names = ['tokenAuthScheme'] 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) if @api_client.config.debugging @api_client.config.logger.debug "API called: LedgervoucherApi#upload_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # [DEPRECATED] Use POST ledger/voucher/{voucherId}/attachment instead. # # @param voucher_id Voucher ID to upload PDF to. # @param file_name File name to store the pdf under. Will not be the same as the filename on the file returned. # @param file The file # @param [Hash] opts the optional parameters # @return [nil] def upload_pdf(voucher_id, file_name, file, opts = {}) upload_pdf_with_http_info(voucher_id, file_name, file, opts) nil end # [DEPRECATED] Use POST ledger/voucher/{voucherId}/attachment instead. # # @param voucher_id Voucher ID to upload PDF to. # @param file_name File name to store the pdf under. Will not be the same as the filename on the file returned. # @param file The file # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def upload_pdf_with_http_info(voucher_id, file_name, file, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LedgervoucherApi.upload_pdf ...' end # verify the required parameter 'voucher_id' is set if @api_client.config.client_side_validation && voucher_id.nil? fail ArgumentError, "Missing the required parameter 'voucher_id' when calling LedgervoucherApi.upload_pdf" end # verify the required parameter 'file_name' is set if @api_client.config.client_side_validation && file_name.nil? fail ArgumentError, "Missing the required parameter 'file_name' when calling LedgervoucherApi.upload_pdf" end # verify the required parameter 'file' is set if @api_client.config.client_side_validation && file.nil? fail ArgumentError, "Missing the required parameter 'file' when calling LedgervoucherApi.upload_pdf" end # resource path local_var_path = '/ledger/voucher/{voucherId}/pdf/{fileName}'.sub('{' + 'voucherId' + '}', voucher_id.to_s).sub('{' + 'fileName' + '}', file_name.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data']) # form parameters form_params = {} form_params['file'] = file # http body (model) post_body = nil auth_names = ['tokenAuthScheme'] 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) if @api_client.config.debugging @api_client.config.logger.debug "API called: LedgervoucherApi#upload_pdf\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Find vouchers in voucher reception. # # @param [Hash] opts the optional parameters # @option opts [String] :date_from From and including # @option opts [String] :date_to To and excluding # @option opts [String] :search_text Search # @option opts [Integer] :from From index (default to 0) # @option opts [Integer] :count Number of elements to return (default to 1000) # @option opts [String] :sorting Sorting pattern # @option opts [String] :fields Fields filter pattern # @return [ListResponseVoucher] def voucher_reception(opts = {}) data, _status_code, _headers = voucher_reception_with_http_info(opts) data end # Find vouchers in voucher reception. # # @param [Hash] opts the optional parameters # @option opts [String] :date_from From and including # @option opts [String] :date_to To and excluding # @option opts [String] :search_text Search # @option opts [Integer] :from From index # @option opts [Integer] :count Number of elements to return # @option opts [String] :sorting Sorting pattern # @option opts [String] :fields Fields filter pattern # @return [Array<(ListResponseVoucher, Fixnum, Hash)>] ListResponseVoucher data, response status code and response headers def voucher_reception_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LedgervoucherApi.voucher_reception ...' end # resource path local_var_path = '/ledger/voucher/>voucherReception' # query parameters query_params = {} query_params[:'dateFrom'] = opts[:'date_from'] if !opts[:'date_from'].nil? query_params[:'dateTo'] = opts[:'date_to'] if !opts[:'date_to'].nil? query_params[:'searchText'] = opts[:'search_text'] if !opts[:'search_text'].nil? query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil? query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil? query_params[:'sorting'] = opts[:'sorting'] if !opts[:'sorting'].nil? query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil? # header parameters header_params = {} # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['tokenAuthScheme'] 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 => 'ListResponseVoucher') if @api_client.config.debugging @api_client.config.logger.debug "API called: LedgervoucherApi#voucher_reception\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end