=begin #Square Connect API OpenAPI spec version: 2.0 Contact: developers@squareup.com Generated by: https://github.com/swagger-api/swagger-codegen.git =end require "uri" module SquareConnect class V1EmployeesApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # CreateEmployee # Use the CreateEmployee endpoint to add an employee to a Square account. Employees created with the Connect API have an initial status of `INACTIVE`. Inactive employees cannot sign in to Square Point of Sale until they are activated from the Square Dashboard. Employee status cannot be changed with the Connect API. # @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. # @param [Hash] opts the optional parameters # @return [V1Employee] def create_employee(body, opts = {}) data, _status_code, _headers = create_employee_with_http_info(body, opts) return data end # CreateEmployee # Use the CreateEmployee endpoint to add an employee to a Square account. Employees created with the Connect API have an initial status of `INACTIVE`. Inactive employees cannot sign in to Square Point of Sale until they are activated from the Square Dashboard. Employee status cannot be changed with the Connect API. <aside class=\"important\"> Employee entities cannot be deleted. To disable employee profiles, set the employee's status to <code>INACTIVE</code> </aside> # @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. # @param [Hash] opts the optional parameters # @return [Array<(V1Employee, Fixnum, Hash)>] V1Employee data, response status code and response headers def create_employee_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: V1EmployeesApi.create_employee ..." end # verify the required parameter 'body' is set fail ArgumentError, "Missing the required parameter 'body' when calling V1EmployeesApi.create_employee" if body.nil? # resource path local_var_path = "/v1/me/employees".sub('{format}','json') # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params['Square-Version'] = "2019-05-08" # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(body) auth_names = ['oauth2'] 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 => 'V1Employee') if @api_client.config.debugging @api_client.config.logger.debug "API called: V1EmployeesApi#create_employee\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # CreateEmployeeRole # Creates an employee role you can then assign to employees. Square accounts can include any number of roles that can be assigned to employees. These roles define the actions and permissions granted to an employee with that role. For example, an employee with a \"Shift Manager\" role might be able to issue refunds in Square Point of Sale, whereas an employee with a \"Clerk\" role might not. Roles are assigned with the [V1UpdateEmployee](#endpoint-v1updateemployee) endpoint. An employee can have only one role at a time. If an employee has no role, they have none of the permissions associated with roles. All employees can accept payments with Square Point of Sale. # @param employee_role An EmployeeRole object with a name and permissions, and an optional owner flag. # @param [Hash] opts the optional parameters # @return [V1EmployeeRole] def create_employee_role(employee_role, opts = {}) data, _status_code, _headers = create_employee_role_with_http_info(employee_role, opts) return data end # CreateEmployeeRole # Creates an employee role you can then assign to employees. Square accounts can include any number of roles that can be assigned to employees. These roles define the actions and permissions granted to an employee with that role. For example, an employee with a \"Shift Manager\" role might be able to issue refunds in Square Point of Sale, whereas an employee with a \"Clerk\" role might not. Roles are assigned with the [V1UpdateEmployee](#endpoint-v1updateemployee) endpoint. An employee can have only one role at a time. If an employee has no role, they have none of the permissions associated with roles. All employees can accept payments with Square Point of Sale. # @param employee_role An EmployeeRole object with a name and permissions, and an optional owner flag. # @param [Hash] opts the optional parameters # @return [Array<(V1EmployeeRole, Fixnum, Hash)>] V1EmployeeRole data, response status code and response headers def create_employee_role_with_http_info(employee_role, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: V1EmployeesApi.create_employee_role ..." end # verify the required parameter 'employee_role' is set fail ArgumentError, "Missing the required parameter 'employee_role' when calling V1EmployeesApi.create_employee_role" if employee_role.nil? # resource path local_var_path = "/v1/me/roles".sub('{format}','json') # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params['Square-Version'] = "2019-05-08" # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(employee_role) auth_names = ['oauth2'] 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 => 'V1EmployeeRole') if @api_client.config.debugging @api_client.config.logger.debug "API called: V1EmployeesApi#create_employee_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # CreateTimecard # Creates a timecard for an employee and clocks them in with an `API_CREATE` event and a `clockin_time` set to the current time unless the request provides a different value. To import timecards from another system (rather than clocking someone in). Specify the `clockin_time` and* `clockout_time` in the request. Timecards correspond to exactly one shift for a given employee, bounded by the `clockin_time` and `clockout_time` fields. An employee is considered clocked in if they have a timecard that doesn't have a `clockout_time` set. An employee that is currently clocked in cannot be clocked in a second time. # @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. # @param [Hash] opts the optional parameters # @return [V1Timecard] def create_timecard(body, opts = {}) data, _status_code, _headers = create_timecard_with_http_info(body, opts) return data end # CreateTimecard # Creates a timecard for an employee and clocks them in with an `API_CREATE` event and a `clockin_time` set to the current time unless the request provides a different value. To import timecards from another system (rather than clocking someone in). Specify the `clockin_time` and* `clockout_time` in the request. Timecards correspond to exactly one shift for a given employee, bounded by the `clockin_time` and `clockout_time` fields. An employee is considered clocked in if they have a timecard that doesn't have a `clockout_time` set. An employee that is currently clocked in cannot be clocked in a second time. # @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. # @param [Hash] opts the optional parameters # @return [Array<(V1Timecard, Fixnum, Hash)>] V1Timecard data, response status code and response headers def create_timecard_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: V1EmployeesApi.create_timecard ..." end # verify the required parameter 'body' is set fail ArgumentError, "Missing the required parameter 'body' when calling V1EmployeesApi.create_timecard" if body.nil? # resource path local_var_path = "/v1/me/timecards".sub('{format}','json') # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params['Square-Version'] = "2019-05-08" # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(body) auth_names = ['oauth2'] 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 => 'V1Timecard') if @api_client.config.debugging @api_client.config.logger.debug "API called: V1EmployeesApi#create_timecard\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # DeleteTimecard # Deletes a timecard. Timecards can also be deleted through the Square Dashboard. Deleted timecards are still accessible through Connect API endpoints, but cannot be modified. The `deleted` field of the `Timecard` object indicates whether the timecard has been deleted. *Note**: By default, deleted timecards appear alongside valid timecards in results returned by the [ListTimecards](#endpoint-v1employees-listtimecards) endpoint. To filter deleted timecards, include the `deleted` query parameter in the list request. # @param timecard_id The ID of the timecard to delete. # @param [Hash] opts the optional parameters # @return [Object] def delete_timecard(timecard_id, opts = {}) data, _status_code, _headers = delete_timecard_with_http_info(timecard_id, opts) return data end # DeleteTimecard # Deletes a timecard. Timecards can also be deleted through the Square Dashboard. Deleted timecards are still accessible through Connect API endpoints, but cannot be modified. The `deleted` field of the `Timecard` object indicates whether the timecard has been deleted. *Note**: By default, deleted timecards appear alongside valid timecards in results returned by the [ListTimecards](#endpoint-v1employees-listtimecards) endpoint. To filter deleted timecards, include the `deleted` query parameter in the list request. <aside> Only approved accounts can manage their employees with Square. Unapproved accounts cannot use employee management features with the API. </aside> # @param timecard_id The ID of the timecard to delete. # @param [Hash] opts the optional parameters # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers def delete_timecard_with_http_info(timecard_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: V1EmployeesApi.delete_timecard ..." end # verify the required parameter 'timecard_id' is set fail ArgumentError, "Missing the required parameter 'timecard_id' when calling V1EmployeesApi.delete_timecard" if timecard_id.nil? # resource path local_var_path = "/v1/me/timecards/{timecard_id}".sub('{format}','json').sub('{' + 'timecard_id' + '}', timecard_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params['Square-Version'] = "2019-05-08" # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['oauth2'] 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, :return_type => 'Object') if @api_client.config.debugging @api_client.config.logger.debug "API called: V1EmployeesApi#delete_timecard\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # ListCashDrawerShifts # Provides the details for all of a location's cash drawer shifts during a date range. The date range you specify cannot exceed 90 days. # @param location_id The ID of the location to list cash drawer shifts for. # @param [Hash] opts the optional parameters # @option opts [String] :order The order in which cash drawer shifts are listed in the response, based on their created_at field. Default value: ASC # @option opts [String] :begin_time The beginning of the requested reporting period, in ISO 8601 format. Default value: The current time minus 90 days. # @option opts [String] :end_time The beginning of the requested reporting period, in ISO 8601 format. Default value: The current time. # @return [Array] def list_cash_drawer_shifts(location_id, opts = {}) data, _status_code, _headers = list_cash_drawer_shifts_with_http_info(location_id, opts) return data end # ListCashDrawerShifts # Provides the details for all of a location's cash drawer shifts during a date range. The date range you specify cannot exceed 90 days. # @param location_id The ID of the location to list cash drawer shifts for. # @param [Hash] opts the optional parameters # @option opts [String] :order The order in which cash drawer shifts are listed in the response, based on their created_at field. Default value: ASC # @option opts [String] :begin_time The beginning of the requested reporting period, in ISO 8601 format. Default value: The current time minus 90 days. # @option opts [String] :end_time The beginning of the requested reporting period, in ISO 8601 format. Default value: The current time. # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers def list_cash_drawer_shifts_with_http_info(location_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: V1EmployeesApi.list_cash_drawer_shifts ..." end # verify the required parameter 'location_id' is set fail ArgumentError, "Missing the required parameter 'location_id' when calling V1EmployeesApi.list_cash_drawer_shifts" if location_id.nil? if opts[:'order'] && !['DESC', 'ASC'].include?(opts[:'order']) fail ArgumentError, 'invalid value for "order", must be one of DESC, ASC' end # resource path local_var_path = "/v1/{location_id}/cash-drawer-shifts".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s) # query parameters query_params = {} query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil? query_params[:'begin_time'] = opts[:'begin_time'] if !opts[:'begin_time'].nil? query_params[:'end_time'] = opts[:'end_time'] if !opts[:'end_time'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params['Square-Version'] = "2019-05-08" # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['oauth2'] 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 => 'Array') if @api_client.config.debugging @api_client.config.logger.debug "API called: V1EmployeesApi#list_cash_drawer_shifts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # ListEmployeeRoles # Provides summary information for all of a business's employee roles. # @param [Hash] opts the optional parameters # @option opts [String] :order The order in which employees are listed in the response, based on their created_at field.Default value: ASC # @option opts [Integer] :limit The maximum integer number of employee entities to return in a single response. Default 100, maximum 200. # @option opts [String] :batch_token A pagination cursor to retrieve the next set of results for your original query to the endpoint. # @return [Array] def list_employee_roles(opts = {}) data, _status_code, _headers = list_employee_roles_with_http_info(opts) return data end # ListEmployeeRoles # Provides summary information for all of a business's employee roles. # @param [Hash] opts the optional parameters # @option opts [String] :order The order in which employees are listed in the response, based on their created_at field.Default value: ASC # @option opts [Integer] :limit The maximum integer number of employee entities to return in a single response. Default 100, maximum 200. # @option opts [String] :batch_token A pagination cursor to retrieve the next set of results for your original query to the endpoint. # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers def list_employee_roles_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: V1EmployeesApi.list_employee_roles ..." end if opts[:'order'] && !['DESC', 'ASC'].include?(opts[:'order']) fail ArgumentError, 'invalid value for "order", must be one of DESC, ASC' end # resource path local_var_path = "/v1/me/roles".sub('{format}','json') # query parameters query_params = {} query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'batch_token'] = opts[:'batch_token'] if !opts[:'batch_token'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params['Square-Version'] = "2019-05-08" # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['oauth2'] 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 => 'Array') if @api_client.config.debugging @api_client.config.logger.debug "API called: V1EmployeesApi#list_employee_roles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # ListEmployees # Provides summary information for all of a business's employees. # @param [Hash] opts the optional parameters # @option opts [String] :order The order in which employees are listed in the response, based on their created_at field. Default value: ASC # @option opts [String] :begin_updated_at If filtering results by their updated_at field, the beginning of the requested reporting period, in ISO 8601 format # @option opts [String] :end_updated_at If filtering results by there updated_at field, the end of the requested reporting period, in ISO 8601 format. # @option opts [String] :begin_created_at If filtering results by their created_at field, the beginning of the requested reporting period, in ISO 8601 format. # @option opts [String] :end_created_at If filtering results by their created_at field, the end of the requested reporting period, in ISO 8601 format. # @option opts [String] :status If provided, the endpoint returns only employee entities with the specified status (ACTIVE or INACTIVE). # @option opts [String] :external_id If provided, the endpoint returns only employee entities with the specified external_id. # @option opts [Integer] :limit The maximum integer number of employee entities to return in a single response. Default 100, maximum 200. # @option opts [String] :batch_token A pagination cursor to retrieve the next set of results for your original query to the endpoint. # @return [Array] def list_employees(opts = {}) data, _status_code, _headers = list_employees_with_http_info(opts) return data end # ListEmployees # Provides summary information for all of a business's employees. # @param [Hash] opts the optional parameters # @option opts [String] :order The order in which employees are listed in the response, based on their created_at field. Default value: ASC # @option opts [String] :begin_updated_at If filtering results by their updated_at field, the beginning of the requested reporting period, in ISO 8601 format # @option opts [String] :end_updated_at If filtering results by there updated_at field, the end of the requested reporting period, in ISO 8601 format. # @option opts [String] :begin_created_at If filtering results by their created_at field, the beginning of the requested reporting period, in ISO 8601 format. # @option opts [String] :end_created_at If filtering results by their created_at field, the end of the requested reporting period, in ISO 8601 format. # @option opts [String] :status If provided, the endpoint returns only employee entities with the specified status (ACTIVE or INACTIVE). # @option opts [String] :external_id If provided, the endpoint returns only employee entities with the specified external_id. # @option opts [Integer] :limit The maximum integer number of employee entities to return in a single response. Default 100, maximum 200. # @option opts [String] :batch_token A pagination cursor to retrieve the next set of results for your original query to the endpoint. # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers def list_employees_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: V1EmployeesApi.list_employees ..." end if opts[:'order'] && !['DESC', 'ASC'].include?(opts[:'order']) fail ArgumentError, 'invalid value for "order", must be one of DESC, ASC' end if opts[:'status'] && !['ACTIVE', 'INACTIVE'].include?(opts[:'status']) fail ArgumentError, 'invalid value for "status", must be one of ACTIVE, INACTIVE' end # resource path local_var_path = "/v1/me/employees".sub('{format}','json') # query parameters query_params = {} query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil? query_params[:'begin_updated_at'] = opts[:'begin_updated_at'] if !opts[:'begin_updated_at'].nil? query_params[:'end_updated_at'] = opts[:'end_updated_at'] if !opts[:'end_updated_at'].nil? query_params[:'begin_created_at'] = opts[:'begin_created_at'] if !opts[:'begin_created_at'].nil? query_params[:'end_created_at'] = opts[:'end_created_at'] if !opts[:'end_created_at'].nil? query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil? query_params[:'external_id'] = opts[:'external_id'] if !opts[:'external_id'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'batch_token'] = opts[:'batch_token'] if !opts[:'batch_token'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params['Square-Version'] = "2019-05-08" # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['oauth2'] 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 => 'Array') if @api_client.config.debugging @api_client.config.logger.debug "API called: V1EmployeesApi#list_employees\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # ListTimecardEvents # Provides summary information for all events associated with a particular timecard. # @param timecard_id The ID of the timecard to list events for. # @param [Hash] opts the optional parameters # @return [Array] def list_timecard_events(timecard_id, opts = {}) data, _status_code, _headers = list_timecard_events_with_http_info(timecard_id, opts) return data end # ListTimecardEvents # Provides summary information for all events associated with a particular timecard. <aside> Only approved accounts can manage their employees with Square. Unapproved accounts cannot use employee management features with the API. </aside> # @param timecard_id The ID of the timecard to list events for. # @param [Hash] opts the optional parameters # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers def list_timecard_events_with_http_info(timecard_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: V1EmployeesApi.list_timecard_events ..." end # verify the required parameter 'timecard_id' is set fail ArgumentError, "Missing the required parameter 'timecard_id' when calling V1EmployeesApi.list_timecard_events" if timecard_id.nil? # resource path local_var_path = "/v1/me/timecards/{timecard_id}/events".sub('{format}','json').sub('{' + 'timecard_id' + '}', timecard_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params['Square-Version'] = "2019-05-08" # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['oauth2'] 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 => 'Array') if @api_client.config.debugging @api_client.config.logger.debug "API called: V1EmployeesApi#list_timecard_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # ListTimecards # Provides summary information for all of a business's employee timecards. # @param [Hash] opts the optional parameters # @option opts [String] :order The order in which timecards are listed in the response, based on their created_at field. # @option opts [String] :employee_id If provided, the endpoint returns only timecards for the employee with the specified ID. # @option opts [String] :begin_clockin_time If filtering results by their clockin_time field, the beginning of the requested reporting period, in ISO 8601 format. # @option opts [String] :end_clockin_time If filtering results by their clockin_time field, the end of the requested reporting period, in ISO 8601 format. # @option opts [String] :begin_clockout_time If filtering results by their clockout_time field, the beginning of the requested reporting period, in ISO 8601 format. # @option opts [String] :end_clockout_time If filtering results by their clockout_time field, the end of the requested reporting period, in ISO 8601 format. # @option opts [String] :begin_updated_at If filtering results by their updated_at field, the beginning of the requested reporting period, in ISO 8601 format. # @option opts [String] :end_updated_at If filtering results by their updated_at field, the end of the requested reporting period, in ISO 8601 format. # @option opts [BOOLEAN] :deleted If true, only deleted timecards are returned. If false, only valid timecards are returned.If you don't provide this parameter, both valid and deleted timecards are returned. # @option opts [Integer] :limit The maximum integer number of employee entities to return in a single response. Default 100, maximum 200. # @option opts [String] :batch_token A pagination cursor to retrieve the next set of results for your original query to the endpoint. # @return [Array] def list_timecards(opts = {}) data, _status_code, _headers = list_timecards_with_http_info(opts) return data end # ListTimecards # Provides summary information for all of a business's employee timecards. # @param [Hash] opts the optional parameters # @option opts [String] :order The order in which timecards are listed in the response, based on their created_at field. # @option opts [String] :employee_id If provided, the endpoint returns only timecards for the employee with the specified ID. # @option opts [String] :begin_clockin_time If filtering results by their clockin_time field, the beginning of the requested reporting period, in ISO 8601 format. # @option opts [String] :end_clockin_time If filtering results by their clockin_time field, the end of the requested reporting period, in ISO 8601 format. # @option opts [String] :begin_clockout_time If filtering results by their clockout_time field, the beginning of the requested reporting period, in ISO 8601 format. # @option opts [String] :end_clockout_time If filtering results by their clockout_time field, the end of the requested reporting period, in ISO 8601 format. # @option opts [String] :begin_updated_at If filtering results by their updated_at field, the beginning of the requested reporting period, in ISO 8601 format. # @option opts [String] :end_updated_at If filtering results by their updated_at field, the end of the requested reporting period, in ISO 8601 format. # @option opts [BOOLEAN] :deleted If true, only deleted timecards are returned. If false, only valid timecards are returned.If you don't provide this parameter, both valid and deleted timecards are returned. # @option opts [Integer] :limit The maximum integer number of employee entities to return in a single response. Default 100, maximum 200. # @option opts [String] :batch_token A pagination cursor to retrieve the next set of results for your original query to the endpoint. # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers def list_timecards_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: V1EmployeesApi.list_timecards ..." end if opts[:'order'] && !['DESC', 'ASC'].include?(opts[:'order']) fail ArgumentError, 'invalid value for "order", must be one of DESC, ASC' end # resource path local_var_path = "/v1/me/timecards".sub('{format}','json') # query parameters query_params = {} query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil? query_params[:'employee_id'] = opts[:'employee_id'] if !opts[:'employee_id'].nil? query_params[:'begin_clockin_time'] = opts[:'begin_clockin_time'] if !opts[:'begin_clockin_time'].nil? query_params[:'end_clockin_time'] = opts[:'end_clockin_time'] if !opts[:'end_clockin_time'].nil? query_params[:'begin_clockout_time'] = opts[:'begin_clockout_time'] if !opts[:'begin_clockout_time'].nil? query_params[:'end_clockout_time'] = opts[:'end_clockout_time'] if !opts[:'end_clockout_time'].nil? query_params[:'begin_updated_at'] = opts[:'begin_updated_at'] if !opts[:'begin_updated_at'].nil? query_params[:'end_updated_at'] = opts[:'end_updated_at'] if !opts[:'end_updated_at'].nil? query_params[:'deleted'] = opts[:'deleted'] if !opts[:'deleted'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'batch_token'] = opts[:'batch_token'] if !opts[:'batch_token'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params['Square-Version'] = "2019-05-08" # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['oauth2'] 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 => 'Array') if @api_client.config.debugging @api_client.config.logger.debug "API called: V1EmployeesApi#list_timecards\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # RetrieveCashDrawerShift # Provides the details for a single cash drawer shift, including all events that occurred during the shift. # @param location_id The ID of the location to list cash drawer shifts for. # @param shift_id The shift's ID. # @param [Hash] opts the optional parameters # @return [V1CashDrawerShift] def retrieve_cash_drawer_shift(location_id, shift_id, opts = {}) data, _status_code, _headers = retrieve_cash_drawer_shift_with_http_info(location_id, shift_id, opts) return data end # RetrieveCashDrawerShift # Provides the details for a single cash drawer shift, including all events that occurred during the shift. # @param location_id The ID of the location to list cash drawer shifts for. # @param shift_id The shift's ID. # @param [Hash] opts the optional parameters # @return [Array<(V1CashDrawerShift, Fixnum, Hash)>] V1CashDrawerShift data, response status code and response headers def retrieve_cash_drawer_shift_with_http_info(location_id, shift_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: V1EmployeesApi.retrieve_cash_drawer_shift ..." end # verify the required parameter 'location_id' is set fail ArgumentError, "Missing the required parameter 'location_id' when calling V1EmployeesApi.retrieve_cash_drawer_shift" if location_id.nil? # verify the required parameter 'shift_id' is set fail ArgumentError, "Missing the required parameter 'shift_id' when calling V1EmployeesApi.retrieve_cash_drawer_shift" if shift_id.nil? # resource path local_var_path = "/v1/{location_id}/cash-drawer-shifts/{shift_id}".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s).sub('{' + 'shift_id' + '}', shift_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params['Square-Version'] = "2019-05-08" # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['oauth2'] 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 => 'V1CashDrawerShift') if @api_client.config.debugging @api_client.config.logger.debug "API called: V1EmployeesApi#retrieve_cash_drawer_shift\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # RetrieveEmployee # Provides the details for a single employee. # @param employee_id The employee's ID. # @param [Hash] opts the optional parameters # @return [V1Employee] def retrieve_employee(employee_id, opts = {}) data, _status_code, _headers = retrieve_employee_with_http_info(employee_id, opts) return data end # RetrieveEmployee # Provides the details for a single employee. # @param employee_id The employee's ID. # @param [Hash] opts the optional parameters # @return [Array<(V1Employee, Fixnum, Hash)>] V1Employee data, response status code and response headers def retrieve_employee_with_http_info(employee_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: V1EmployeesApi.retrieve_employee ..." end # verify the required parameter 'employee_id' is set fail ArgumentError, "Missing the required parameter 'employee_id' when calling V1EmployeesApi.retrieve_employee" if employee_id.nil? # resource path local_var_path = "/v1/me/employees/{employee_id}".sub('{format}','json').sub('{' + 'employee_id' + '}', employee_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params['Square-Version'] = "2019-05-08" # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['oauth2'] 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 => 'V1Employee') if @api_client.config.debugging @api_client.config.logger.debug "API called: V1EmployeesApi#retrieve_employee\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # RetrieveEmployeeRole # Provides the details for a single employee role. # @param role_id The role's ID. # @param [Hash] opts the optional parameters # @return [V1EmployeeRole] def retrieve_employee_role(role_id, opts = {}) data, _status_code, _headers = retrieve_employee_role_with_http_info(role_id, opts) return data end # RetrieveEmployeeRole # Provides the details for a single employee role. # @param role_id The role's ID. # @param [Hash] opts the optional parameters # @return [Array<(V1EmployeeRole, Fixnum, Hash)>] V1EmployeeRole data, response status code and response headers def retrieve_employee_role_with_http_info(role_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: V1EmployeesApi.retrieve_employee_role ..." end # verify the required parameter 'role_id' is set fail ArgumentError, "Missing the required parameter 'role_id' when calling V1EmployeesApi.retrieve_employee_role" if role_id.nil? # resource path local_var_path = "/v1/me/roles/{role_id}".sub('{format}','json').sub('{' + 'role_id' + '}', role_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params['Square-Version'] = "2019-05-08" # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['oauth2'] 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 => 'V1EmployeeRole') if @api_client.config.debugging @api_client.config.logger.debug "API called: V1EmployeesApi#retrieve_employee_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # RetrieveTimecard # Provides the details for a single timecard. # @param timecard_id The timecard's ID. # @param [Hash] opts the optional parameters # @return [V1Timecard] def retrieve_timecard(timecard_id, opts = {}) data, _status_code, _headers = retrieve_timecard_with_http_info(timecard_id, opts) return data end # RetrieveTimecard # Provides the details for a single timecard. <aside> Only approved accounts can manage their employees with Square. Unapproved accounts cannot use employee management features with the API. </aside> # @param timecard_id The timecard's ID. # @param [Hash] opts the optional parameters # @return [Array<(V1Timecard, Fixnum, Hash)>] V1Timecard data, response status code and response headers def retrieve_timecard_with_http_info(timecard_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: V1EmployeesApi.retrieve_timecard ..." end # verify the required parameter 'timecard_id' is set fail ArgumentError, "Missing the required parameter 'timecard_id' when calling V1EmployeesApi.retrieve_timecard" if timecard_id.nil? # resource path local_var_path = "/v1/me/timecards/{timecard_id}".sub('{format}','json').sub('{' + 'timecard_id' + '}', timecard_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params['Square-Version'] = "2019-05-08" # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['oauth2'] 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 => 'V1Timecard') if @api_client.config.debugging @api_client.config.logger.debug "API called: V1EmployeesApi#retrieve_timecard\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # UpdateEmployee # # @param employee_id The ID of the role to modify. # @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. # @param [Hash] opts the optional parameters # @return [V1Employee] def update_employee(employee_id, body, opts = {}) data, _status_code, _headers = update_employee_with_http_info(employee_id, body, opts) return data end # UpdateEmployee # # @param employee_id The ID of the role to modify. # @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. # @param [Hash] opts the optional parameters # @return [Array<(V1Employee, Fixnum, Hash)>] V1Employee data, response status code and response headers def update_employee_with_http_info(employee_id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: V1EmployeesApi.update_employee ..." end # verify the required parameter 'employee_id' is set fail ArgumentError, "Missing the required parameter 'employee_id' when calling V1EmployeesApi.update_employee" if employee_id.nil? # verify the required parameter 'body' is set fail ArgumentError, "Missing the required parameter 'body' when calling V1EmployeesApi.update_employee" if body.nil? # resource path local_var_path = "/v1/me/employees/{employee_id}".sub('{format}','json').sub('{' + 'employee_id' + '}', employee_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params['Square-Version'] = "2019-05-08" # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(body) auth_names = ['oauth2'] 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 => 'V1Employee') if @api_client.config.debugging @api_client.config.logger.debug "API called: V1EmployeesApi#update_employee\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # UpdateEmployeeRole # Modifies the details of an employee role. # @param role_id The ID of the role to modify. # @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. # @param [Hash] opts the optional parameters # @return [V1EmployeeRole] def update_employee_role(role_id, body, opts = {}) data, _status_code, _headers = update_employee_role_with_http_info(role_id, body, opts) return data end # UpdateEmployeeRole # Modifies the details of an employee role. # @param role_id The ID of the role to modify. # @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. # @param [Hash] opts the optional parameters # @return [Array<(V1EmployeeRole, Fixnum, Hash)>] V1EmployeeRole data, response status code and response headers def update_employee_role_with_http_info(role_id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: V1EmployeesApi.update_employee_role ..." end # verify the required parameter 'role_id' is set fail ArgumentError, "Missing the required parameter 'role_id' when calling V1EmployeesApi.update_employee_role" if role_id.nil? # verify the required parameter 'body' is set fail ArgumentError, "Missing the required parameter 'body' when calling V1EmployeesApi.update_employee_role" if body.nil? # resource path local_var_path = "/v1/me/roles/{role_id}".sub('{format}','json').sub('{' + 'role_id' + '}', role_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params['Square-Version'] = "2019-05-08" # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(body) auth_names = ['oauth2'] 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 => 'V1EmployeeRole') if @api_client.config.debugging @api_client.config.logger.debug "API called: V1EmployeesApi#update_employee_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # UpdateTimecard # Modifies the details of a timecard with an `API_EDIT` event for the timecard. Updating an active timecard with a `clockout_time` clocks the employee out. # @param timecard_id TThe ID of the timecard to modify. # @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. # @param [Hash] opts the optional parameters # @return [V1Timecard] def update_timecard(timecard_id, body, opts = {}) data, _status_code, _headers = update_timecard_with_http_info(timecard_id, body, opts) return data end # UpdateTimecard # Modifies the details of a timecard with an `API_EDIT` event for the timecard. Updating an active timecard with a `clockout_time` clocks the employee out. # @param timecard_id TThe ID of the timecard to modify. # @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. # @param [Hash] opts the optional parameters # @return [Array<(V1Timecard, Fixnum, Hash)>] V1Timecard data, response status code and response headers def update_timecard_with_http_info(timecard_id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: V1EmployeesApi.update_timecard ..." end # verify the required parameter 'timecard_id' is set fail ArgumentError, "Missing the required parameter 'timecard_id' when calling V1EmployeesApi.update_timecard" if timecard_id.nil? # verify the required parameter 'body' is set fail ArgumentError, "Missing the required parameter 'body' when calling V1EmployeesApi.update_timecard" if body.nil? # resource path local_var_path = "/v1/me/timecards/{timecard_id}".sub('{format}','json').sub('{' + 'timecard_id' + '}', timecard_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params['Square-Version'] = "2019-05-08" # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(body) auth_names = ['oauth2'] 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 => 'V1Timecard') if @api_client.config.debugging @api_client.config.logger.debug "API called: V1EmployeesApi#update_timecard\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end