=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 TimesheetentryApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Delete timesheet entry by ID. # # @param id Element ID # @param [Hash] opts the optional parameters # @option opts [Integer] :version Number of current version # @return [nil] def delete(id, opts = {}) delete_with_http_info(id, opts) nil end # Delete timesheet entry by ID. # # @param id Element ID # @param [Hash] opts the optional parameters # @option opts [Integer] :version Number of current version # @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: TimesheetentryApi.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 TimesheetentryApi.delete" end # resource path local_var_path = '/timesheet/entry/{id}'.sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} query_params[:'version'] = opts[:'version'] if !opts[:'version'].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: TimesheetentryApi#delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Find timesheet entry by ID. # # @param id Element ID # @param [Hash] opts the optional parameters # @option opts [String] :fields Fields filter pattern # @return [ResponseWrapperTimesheetEntry] def get(id, opts = {}) data, _status_code, _headers = get_with_http_info(id, opts) data end # Find timesheet entry by ID. # # @param id Element ID # @param [Hash] opts the optional parameters # @option opts [String] :fields Fields filter pattern # @return [Array<(ResponseWrapperTimesheetEntry, Fixnum, Hash)>] ResponseWrapperTimesheetEntry 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: TimesheetentryApi.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 TimesheetentryApi.get" end # resource path local_var_path = '/timesheet/entry/{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 => 'ResponseWrapperTimesheetEntry') if @api_client.config.debugging @api_client.config.logger.debug "API called: TimesheetentryApi#get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Find recently used timesheet activities. # # @param project_id ID of project to find activities for # @param [Hash] opts the optional parameters # @option opts [Integer] :employee_id ID of employee to find activities for. Defaults to ID of token owner. # @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 [ListResponseActivity] def get_recent_activities(project_id, opts = {}) data, _status_code, _headers = get_recent_activities_with_http_info(project_id, opts) data end # Find recently used timesheet activities. # # @param project_id ID of project to find activities for # @param [Hash] opts the optional parameters # @option opts [Integer] :employee_id ID of employee to find activities for. Defaults to ID of token owner. # @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<(ListResponseActivity, Fixnum, Hash)>] ListResponseActivity data, response status code and response headers def get_recent_activities_with_http_info(project_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TimesheetentryApi.get_recent_activities ...' end # verify the required parameter 'project_id' is set if @api_client.config.client_side_validation && project_id.nil? fail ArgumentError, "Missing the required parameter 'project_id' when calling TimesheetentryApi.get_recent_activities" end # resource path local_var_path = '/timesheet/entry/>recentActivities' # query parameters query_params = {} query_params[:'projectId'] = project_id query_params[:'employeeId'] = opts[:'employee_id'] if !opts[:'employee_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 => 'ListResponseActivity') if @api_client.config.debugging @api_client.config.logger.debug "API called: TimesheetentryApi#get_recent_activities\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Find projects with recent activities (timesheet entry registered). # # @param [Hash] opts the optional parameters # @option opts [Integer] :employee_id ID of employee with recent project hours Defaults to ID of token owner. # @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 [ListResponseProject] def get_recent_projects(opts = {}) data, _status_code, _headers = get_recent_projects_with_http_info(opts) data end # Find projects with recent activities (timesheet entry registered). # # @param [Hash] opts the optional parameters # @option opts [Integer] :employee_id ID of employee with recent project hours Defaults to ID of token owner. # @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<(ListResponseProject, Fixnum, Hash)>] ListResponseProject data, response status code and response headers def get_recent_projects_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TimesheetentryApi.get_recent_projects ...' end # resource path local_var_path = '/timesheet/entry/>recentProjects' # query parameters query_params = {} query_params[:'employeeId'] = opts[:'employee_id'] if !opts[:'employee_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 => 'ListResponseProject') if @api_client.config.debugging @api_client.config.logger.debug "API called: TimesheetentryApi#get_recent_projects\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Find total hours registered on an employee in a specific period. # # @param [Hash] opts the optional parameters # @option opts [Integer] :employee_id ID of employee to find hours for. Defaults to ID of token owner. # @option opts [String] :start_date Format is yyyy-MM-dd (from and incl.). Defaults to today. # @option opts [String] :end_date Format is yyyy-MM-dd (to and excl.). Defaults to tomorrow. # @option opts [String] :fields Fields filter pattern # @return [ResponseWrapperBigDecimal] def get_total_hours(opts = {}) data, _status_code, _headers = get_total_hours_with_http_info(opts) data end # Find total hours registered on an employee in a specific period. # # @param [Hash] opts the optional parameters # @option opts [Integer] :employee_id ID of employee to find hours for. Defaults to ID of token owner. # @option opts [String] :start_date Format is yyyy-MM-dd (from and incl.). Defaults to today. # @option opts [String] :end_date Format is yyyy-MM-dd (to and excl.). Defaults to tomorrow. # @option opts [String] :fields Fields filter pattern # @return [Array<(ResponseWrapperBigDecimal, Fixnum, Hash)>] ResponseWrapperBigDecimal data, response status code and response headers def get_total_hours_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TimesheetentryApi.get_total_hours ...' end # resource path local_var_path = '/timesheet/entry/>totalHours' # query parameters query_params = {} query_params[:'employeeId'] = opts[:'employee_id'] if !opts[:'employee_id'].nil? query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil? query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].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 => 'ResponseWrapperBigDecimal') if @api_client.config.debugging @api_client.config.logger.debug "API called: TimesheetentryApi#get_total_hours\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Add new timesheet entry. Only one entry per employee/date/activity/project combination is supported. # # @param [Hash] opts the optional parameters # @option opts [TimesheetEntry] :body JSON representing the new object to be created. Should not have ID and version set. # @return [ResponseWrapperTimesheetEntry] def post(opts = {}) data, _status_code, _headers = post_with_http_info(opts) data end # Add new timesheet entry. Only one entry per employee/date/activity/project combination is supported. # # @param [Hash] opts the optional parameters # @option opts [TimesheetEntry] :body JSON representing the new object to be created. Should not have ID and version set. # @return [Array<(ResponseWrapperTimesheetEntry, Fixnum, Hash)>] ResponseWrapperTimesheetEntry 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: TimesheetentryApi.post ...' end # resource path local_var_path = '/timesheet/entry' # 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 => 'ResponseWrapperTimesheetEntry') if @api_client.config.debugging @api_client.config.logger.debug "API called: TimesheetentryApi#post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Add new timesheet entry. Multiple objects for several users can be sent in the same request. # # @param [Hash] opts the optional parameters # @option opts [Array] :body List of timesheet entry objects # @return [ListResponseTimesheetEntry] def post_list(opts = {}) data, _status_code, _headers = post_list_with_http_info(opts) data end # Add new timesheet entry. Multiple objects for several users can be sent in the same request. # # @param [Hash] opts the optional parameters # @option opts [Array] :body List of timesheet entry objects # @return [Array<(ListResponseTimesheetEntry, Fixnum, Hash)>] ListResponseTimesheetEntry 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: TimesheetentryApi.post_list ...' end # resource path local_var_path = '/timesheet/entry/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 => 'ListResponseTimesheetEntry') if @api_client.config.debugging @api_client.config.logger.debug "API called: TimesheetentryApi#post_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update timesheet entry by ID. Note: Timesheet entry object fields which are present but not set, or set to 0, will be nulled. # # @param id Element ID # @param [Hash] opts the optional parameters # @option opts [TimesheetEntry] :body Partial object describing what should be updated # @return [ResponseWrapperTimesheetEntry] def put(id, opts = {}) data, _status_code, _headers = put_with_http_info(id, opts) data end # Update timesheet entry by ID. Note: Timesheet entry object fields which are present but not set, or set to 0, will be nulled. # # @param id Element ID # @param [Hash] opts the optional parameters # @option opts [TimesheetEntry] :body Partial object describing what should be updated # @return [Array<(ResponseWrapperTimesheetEntry, Fixnum, Hash)>] ResponseWrapperTimesheetEntry 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: TimesheetentryApi.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 TimesheetentryApi.put" end # resource path local_var_path = '/timesheet/entry/{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 => 'ResponseWrapperTimesheetEntry') if @api_client.config.debugging @api_client.config.logger.debug "API called: TimesheetentryApi#put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update timesheet entry. Multiple objects for different users can be sent in the same request. # # @param [Hash] opts the optional parameters # @option opts [Array] :body List of timesheet entry objects to update # @return [ListResponseTimesheetEntry] def put_list(opts = {}) data, _status_code, _headers = put_list_with_http_info(opts) data end # Update timesheet entry. Multiple objects for different users can be sent in the same request. # # @param [Hash] opts the optional parameters # @option opts [Array] :body List of timesheet entry objects to update # @return [Array<(ListResponseTimesheetEntry, Fixnum, Hash)>] ListResponseTimesheetEntry 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: TimesheetentryApi.put_list ...' end # resource path local_var_path = '/timesheet/entry/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 => 'ListResponseTimesheetEntry') if @api_client.config.debugging @api_client.config.logger.debug "API called: TimesheetentryApi#put_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Find timesheet entry 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] :employee_id List of IDs # @option opts [String] :project_id List of IDs # @option opts [String] :activity_id List of IDs # @option opts [String] :comment Containing # @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 [TimesheetEntrySearchResponse] def search(date_from, date_to, opts = {}) data, _status_code, _headers = search_with_http_info(date_from, date_to, opts) data end # Find timesheet entry 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] :employee_id List of IDs # @option opts [String] :project_id List of IDs # @option opts [String] :activity_id List of IDs # @option opts [String] :comment Containing # @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<(TimesheetEntrySearchResponse, Fixnum, Hash)>] TimesheetEntrySearchResponse 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: TimesheetentryApi.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 TimesheetentryApi.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 TimesheetentryApi.search" end # resource path local_var_path = '/timesheet/entry' # 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[:'employeeId'] = opts[:'employee_id'] if !opts[:'employee_id'].nil? query_params[:'projectId'] = opts[:'project_id'] if !opts[:'project_id'].nil? query_params[:'activityId'] = opts[:'activity_id'] if !opts[:'activity_id'].nil? query_params[:'comment'] = opts[:'comment'] if !opts[:'comment'].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 => 'TimesheetEntrySearchResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: TimesheetentryApi#search\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end