=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 DepartmentApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Delete department 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 # Delete department 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: DepartmentApi.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 DepartmentApi.delete" end # resource path local_var_path = '/department/{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: DepartmentApi#delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get department by ID. # # @param id Element ID # @param [Hash] opts the optional parameters # @option opts [String] :fields Fields filter pattern # @return [ResponseWrapperDepartment] def get(id, opts = {}) data, _status_code, _headers = get_with_http_info(id, opts) data end # Get department by ID. # # @param id Element ID # @param [Hash] opts the optional parameters # @option opts [String] :fields Fields filter pattern # @return [Array<(ResponseWrapperDepartment, Fixnum, Hash)>] ResponseWrapperDepartment 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: DepartmentApi.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 DepartmentApi.get" end # resource path local_var_path = '/department/{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 => 'ResponseWrapperDepartment') if @api_client.config.debugging @api_client.config.logger.debug "API called: DepartmentApi#get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # [BETA] Add new department. # # @param [Hash] opts the optional parameters # @option opts [Department] :body JSON representing the new object to be created. Should not have ID and version set. # @return [ResponseWrapperDepartment] def post(opts = {}) data, _status_code, _headers = post_with_http_info(opts) data end # [BETA] Add new department. # # @param [Hash] opts the optional parameters # @option opts [Department] :body JSON representing the new object to be created. Should not have ID and version set. # @return [Array<(ResponseWrapperDepartment, Fixnum, Hash)>] ResponseWrapperDepartment 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: DepartmentApi.post ...' end # resource path local_var_path = '/department' # query parameters query_params = {} # 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 => 'ResponseWrapperDepartment') if @api_client.config.debugging @api_client.config.logger.debug "API called: DepartmentApi#post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # [BETA] Register new departments. # # @param [Hash] opts the optional parameters # @option opts [Array] :body JSON representing a list of new object to be created. Should not have ID and version set. # @return [ListResponseDepartment] def post_list(opts = {}) data, _status_code, _headers = post_list_with_http_info(opts) data end # [BETA] Register new departments. # # @param [Hash] opts the optional parameters # @option opts [Array] :body JSON representing a list of new object to be created. Should not have ID and version set. # @return [Array<(ListResponseDepartment, Fixnum, Hash)>] ListResponseDepartment data, response status code and response headers def post_list_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DepartmentApi.post_list ...' end # resource path local_var_path = '/department/list' # query parameters query_params = {} # 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 => 'ListResponseDepartment') if @api_client.config.debugging @api_client.config.logger.debug "API called: DepartmentApi#post_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # [BETA] Update department. # # @param id Element ID # @param [Hash] opts the optional parameters # @option opts [Department] :body Partial object describing what should be updated # @return [ResponseWrapperDepartment] def put(id, opts = {}) data, _status_code, _headers = put_with_http_info(id, opts) data end # [BETA] Update department. # # @param id Element ID # @param [Hash] opts the optional parameters # @option opts [Department] :body Partial object describing what should be updated # @return [Array<(ResponseWrapperDepartment, Fixnum, Hash)>] ResponseWrapperDepartment 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: DepartmentApi.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 DepartmentApi.put" end # resource path local_var_path = '/department/{id}'.sub('{' + 'id' + '}', 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(['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 => 'ResponseWrapperDepartment') if @api_client.config.debugging @api_client.config.logger.debug "API called: DepartmentApi#put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # [BETA] Update multiple departments. # # @param [Hash] opts the optional parameters # @option opts [Array] :body JSON representing updates to object. Should have ID and version set. # @return [ListResponseDepartment] def put_list(opts = {}) data, _status_code, _headers = put_list_with_http_info(opts) data end # [BETA] Update multiple departments. # # @param [Hash] opts the optional parameters # @option opts [Array] :body JSON representing updates to object. Should have ID and version set. # @return [Array<(ListResponseDepartment, Fixnum, Hash)>] ListResponseDepartment 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: DepartmentApi.put_list ...' end # resource path local_var_path = '/department/list' # query parameters query_params = {} # 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 => 'ListResponseDepartment') if @api_client.config.debugging @api_client.config.logger.debug "API called: DepartmentApi#put_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # [BETA] Wildcard search. # # @param [Hash] opts the optional parameters # @option opts [String] :query Containing # @option opts [Integer] :count Number of elements to return (default to 25) # @option opts [String] :fields Fields filter pattern (default to id, name) # @option opts [Integer] :from From index (default to 0) # @option opts [String] :sorting Sorting pattern # @return [ListResponseDepartment] def query(opts = {}) data, _status_code, _headers = query_with_http_info(opts) data end # [BETA] Wildcard search. # # @param [Hash] opts the optional parameters # @option opts [String] :query Containing # @option opts [Integer] :count Number of elements to return # @option opts [String] :fields Fields filter pattern # @option opts [Integer] :from From index # @option opts [String] :sorting Sorting pattern # @return [Array<(ListResponseDepartment, Fixnum, Hash)>] ListResponseDepartment data, response status code and response headers def query_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DepartmentApi.query ...' end # resource path local_var_path = '/department/query' # query parameters query_params = {} query_params[:'query'] = opts[:'query'] if !opts[:'query'].nil? query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil? query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil? query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil? query_params[:'sorting'] = opts[:'sorting'] if !opts[:'sorting'].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 => 'ListResponseDepartment') if @api_client.config.debugging @api_client.config.logger.debug "API called: DepartmentApi#query\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Find department corresponding with sent data. # # @param [Hash] opts the optional parameters # @option opts [String] :id List of IDs # @option opts [String] :name Containing # @option opts [String] :department_number Containing # @option opts [String] :department_manager_id List of IDs # @option opts [BOOLEAN] :is_inactive true - return only inactive departments; false - return only active departments; unspecified - return both types # @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 [ListResponseDepartment] def search(opts = {}) data, _status_code, _headers = search_with_http_info(opts) data end # Find department corresponding with sent data. # # @param [Hash] opts the optional parameters # @option opts [String] :id List of IDs # @option opts [String] :name Containing # @option opts [String] :department_number Containing # @option opts [String] :department_manager_id List of IDs # @option opts [BOOLEAN] :is_inactive true - return only inactive departments; false - return only active departments; unspecified - return both types # @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<(ListResponseDepartment, Fixnum, Hash)>] ListResponseDepartment data, response status code and response headers def search_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DepartmentApi.search ...' end # resource path local_var_path = '/department' # query parameters query_params = {} query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil? query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil? query_params[:'departmentNumber'] = opts[:'department_number'] if !opts[:'department_number'].nil? query_params[:'departmentManagerId'] = opts[:'department_manager_id'] if !opts[:'department_manager_id'].nil? query_params[:'isInactive'] = opts[:'is_inactive'] if !opts[:'is_inactive'].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 => 'ListResponseDepartment') if @api_client.config.debugging @api_client.config.logger.debug "API called: DepartmentApi#search\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end