Class: Square::EmployeesApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/square/api/employees_api.rb

Overview

EmployeesApi

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseApi

#initialize, #new_api_call_builder, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from Square::BaseApi

Instance Method Details

#list_employees(location_id: nil, status: nil, limit: nil, cursor: nil) ⇒ ListEmployeesResponse Hash

TODO: type endpoint description here EmployeeStatus to filter the employee by. returned on each page. the specified page of results.

Parameters:

  • location_id (String) (defaults to: nil)

    Optional parameter: Example:

  • status (EmployeeStatus) (defaults to: nil)

    Optional parameter: Specifies the

  • limit (Integer) (defaults to: nil)

    Optional parameter: The number of employees to be

  • cursor (String) (defaults to: nil)

    Optional parameter: The token required to retrieve

Returns:

  • (ListEmployeesResponse Hash)

    response from the API call



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/square/api/employees_api.rb', line 13

def list_employees(location_id: nil,
                   status: nil,
                   limit: nil,
                   cursor: nil)
  warn 'Endpoint list_employees in EmployeesApi is deprecated'
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v2/employees',
                                 'default')
               .query_param(new_parameter(location_id, key: 'location_id'))
               .query_param(new_parameter(status, key: 'status'))
               .query_param(new_parameter(limit, key: 'limit'))
               .query_param(new_parameter(cursor, key: 'cursor'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
end

#retrieve_employee(id:) ⇒ RetrieveEmployeeResponse Hash

TODO: type endpoint description here requested.

Parameters:

  • id (String)

    Required parameter: UUID for the employee that was

Returns:

  • (RetrieveEmployeeResponse Hash)

    response from the API call



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/square/api/employees_api.rb', line 39

def retrieve_employee(id:)
  warn 'Endpoint retrieve_employee in EmployeesApi is deprecated'
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v2/employees/{id}',
                                 'default')
               .template_param(new_parameter(id, key: 'id')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
end