=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 TimesheettimeClockApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Find time clock entry by ID. # # @param id Element ID # @param [Hash] opts the optional parameters # @option opts [String] :fields Fields filter pattern # @return [ResponseWrapperTimeClock] def get(id, opts = {}) data, _status_code, _headers = get_with_http_info(id, opts) data end # Find time clock entry by ID. # # @param id Element ID # @param [Hash] opts the optional parameters # @option opts [String] :fields Fields filter pattern # @return [Array<(ResponseWrapperTimeClock, Fixnum, Hash)>] ResponseWrapperTimeClock 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: TimesheettimeClockApi.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 TimesheettimeClockApi.get" end # resource path local_var_path = '/timesheet/timeClock/{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 => 'ResponseWrapperTimeClock') if @api_client.config.debugging @api_client.config.logger.debug "API called: TimesheettimeClockApi#get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Find a user’s present running time clock. # # @param [Hash] opts the optional parameters # @option opts [Integer] :employee_id Employee ID. Defaults to ID of token owner. # @option opts [String] :fields Fields filter pattern # @return [ResponseWrapperTimeClock] def get_present(opts = {}) data, _status_code, _headers = get_present_with_http_info(opts) data end # Find a user’s present running time clock. # # @param [Hash] opts the optional parameters # @option opts [Integer] :employee_id Employee ID. Defaults to ID of token owner. # @option opts [String] :fields Fields filter pattern # @return [Array<(ResponseWrapperTimeClock, Fixnum, Hash)>] ResponseWrapperTimeClock data, response status code and response headers def get_present_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TimesheettimeClockApi.get_present ...' end # resource path local_var_path = '/timesheet/timeClock/present' # query parameters query_params = {} query_params[:'employeeId'] = opts[:'employee_id'] if !opts[:'employee_id'].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 => 'ResponseWrapperTimeClock') if @api_client.config.debugging @api_client.config.logger.debug "API called: TimesheettimeClockApi#get_present\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update time clock by ID. # # @param id Element ID # @param [Hash] opts the optional parameters # @option opts [TimeClock] :body Partial object describing what should be updated # @return [ResponseWrapperTimeClock] def put(id, opts = {}) data, _status_code, _headers = put_with_http_info(id, opts) data end # Update time clock by ID. # # @param id Element ID # @param [Hash] opts the optional parameters # @option opts [TimeClock] :body Partial object describing what should be updated # @return [Array<(ResponseWrapperTimeClock, Fixnum, Hash)>] ResponseWrapperTimeClock 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: TimesheettimeClockApi.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 TimesheettimeClockApi.put" end # resource path local_var_path = '/timesheet/timeClock/{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 => 'ResponseWrapperTimeClock') if @api_client.config.debugging @api_client.config.logger.debug "API called: TimesheettimeClockApi#put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Find time clock entries corresponding with sent data. # # @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] :date_from From and including # @option opts [String] :date_to To and excluding # @option opts [String] :hour_id List of IDs # @option opts [BOOLEAN] :is_running Equals # @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 [ListResponseTimeClock] def search(opts = {}) data, _status_code, _headers = search_with_http_info(opts) data end # Find time clock entries corresponding with sent data. # # @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] :date_from From and including # @option opts [String] :date_to To and excluding # @option opts [String] :hour_id List of IDs # @option opts [BOOLEAN] :is_running Equals # @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<(ListResponseTimeClock, Fixnum, Hash)>] ListResponseTimeClock 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: TimesheettimeClockApi.search ...' end # resource path local_var_path = '/timesheet/timeClock' # query parameters query_params = {} 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[:'dateFrom'] = opts[:'date_from'] if !opts[:'date_from'].nil? query_params[:'dateTo'] = opts[:'date_to'] if !opts[:'date_to'].nil? query_params[:'hourId'] = opts[:'hour_id'] if !opts[:'hour_id'].nil? query_params[:'isRunning'] = opts[:'is_running'] if !opts[:'is_running'].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 => 'ListResponseTimeClock') if @api_client.config.debugging @api_client.config.logger.debug "API called: TimesheettimeClockApi#search\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Start time clock. # # @param activity_id Activity ID # @param [Hash] opts the optional parameters # @option opts [Integer] :employee_id Employee ID. Defaults to ID of token owner. # @option opts [Integer] :project_id Project ID (default to 0) # @option opts [String] :date Optional. Default is today’s date # @return [ResponseWrapperTimeClock] def start(activity_id, opts = {}) data, _status_code, _headers = start_with_http_info(activity_id, opts) data end # Start time clock. # # @param activity_id Activity ID # @param [Hash] opts the optional parameters # @option opts [Integer] :employee_id Employee ID. Defaults to ID of token owner. # @option opts [Integer] :project_id Project ID # @option opts [String] :date Optional. Default is today’s date # @return [Array<(ResponseWrapperTimeClock, Fixnum, Hash)>] ResponseWrapperTimeClock data, response status code and response headers def start_with_http_info(activity_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TimesheettimeClockApi.start ...' end # verify the required parameter 'activity_id' is set if @api_client.config.client_side_validation && activity_id.nil? fail ArgumentError, "Missing the required parameter 'activity_id' when calling TimesheettimeClockApi.start" end # resource path local_var_path = '/timesheet/timeClock/:start' # query parameters query_params = {} query_params[:'activityId'] = activity_id query_params[:'employeeId'] = opts[:'employee_id'] if !opts[:'employee_id'].nil? query_params[:'projectId'] = opts[:'project_id'] if !opts[:'project_id'].nil? query_params[:'date'] = opts[:'date'] if !opts[:'date'].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 => 'ResponseWrapperTimeClock') if @api_client.config.debugging @api_client.config.logger.debug "API called: TimesheettimeClockApi#start\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Stop time clock. # # @param id Element ID # @param [Hash] opts the optional parameters # @option opts [Integer] :version Number of current version (default to 0) # @return [nil] def stop(id, opts = {}) stop_with_http_info(id, opts) nil end # Stop time clock. # # @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 stop_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TimesheettimeClockApi.stop ...' 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 TimesheettimeClockApi.stop" end # resource path local_var_path = '/timesheet/timeClock/{id}/:stop'.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(:PUT, 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: TimesheettimeClockApi#stop\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end