Class: PureCloud::WorkforceManagementApi

Inherits:
Object
  • Object
show all
Defined in:
lib/purecloud/api/workforce_management_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ WorkforceManagementApi

Returns a new instance of WorkforceManagementApi.



23
24
25
# File 'lib/purecloud/api/workforce_management_api.rb', line 23

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



21
22
23
# File 'lib/purecloud/api/workforce_management_api.rb', line 21

def api_client
  @api_client
end

Instance Method Details

#get_adherence(user_id, opts = {}) ⇒ UserScheduleAdherence

Get a list of UserScheduleAdherence records for the requested users

Parameters:

  • user_id

    User Id(s) for which to fetch current schedule adherence information. Max of 100 userIds per request

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



32
33
34
35
# File 'lib/purecloud/api/workforce_management_api.rb', line 32

def get_adherence(user_id, opts = {})
  data, status_code, headers = get_adherence_with_http_info(user_id, opts)
  return data
end

#get_adherence_with_http_info(user_id, opts = {}) ⇒ Array<(UserScheduleAdherence, Fixnum, Hash)>

Get a list of UserScheduleAdherence records for the requested users

Parameters:

  • user_id

    User Id(s) for which to fetch current schedule adherence information. Max of 100 userIds per request

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(UserScheduleAdherence, Fixnum, Hash)>)

    UserScheduleAdherence data, response status code and response headers



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/purecloud/api/workforce_management_api.rb', line 42

def get_adherence_with_http_info(user_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: WorkforceManagementApi#get_adherence ..."
  end
  
  # verify the required parameter 'user_id' is set
  fail "Missing the required parameter 'user_id' when calling get_adherence" if user_id.nil?
  
  # resource path
  local_var_path = "/api/v2/workforcemanagement/adherence".sub('{format}','json')

  # query parameters
  query_params = {}
  query_params[:'userId'] = @api_client.build_collection_param(user_id, :multi)

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  _header_accept = ['application/json']
  _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result

  # HTTP header 'Content-Type'
  _header_content_type = ['application/json']
  header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  
  auth_names = ['PureCloud Auth']
  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 => 'UserScheduleAdherence')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WorkforceManagementApi#get_adherence\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#post_longtermforecasts(body, opts = {}) ⇒ ForecastCreationCompletion

Create a forecast

Parameters:

  • body

    The request body

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



93
94
95
96
# File 'lib/purecloud/api/workforce_management_api.rb', line 93

def post_longtermforecasts(body, opts = {})
  data, status_code, headers = post_longtermforecasts_with_http_info(body, opts)
  return data
end

#post_longtermforecasts_with_http_info(body, opts = {}) ⇒ Array<(ForecastCreationCompletion, Fixnum, Hash)>

Create a forecast

Parameters:

  • body

    The request body

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ForecastCreationCompletion, Fixnum, Hash)>)

    ForecastCreationCompletion data, response status code and response headers



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/purecloud/api/workforce_management_api.rb', line 103

def post_longtermforecasts_with_http_info(body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: WorkforceManagementApi#post_longtermforecasts ..."
  end
  
  # verify the required parameter 'body' is set
  fail "Missing the required parameter 'body' when calling post_longtermforecasts" if body.nil?
  
  # resource path
  local_var_path = "/api/v2/workforcemanagement/longtermforecasts".sub('{format}','json')

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}

  # HTTP header 'Accept' (if needed)
  _header_accept = ['application/json']
  _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result

  # HTTP header 'Content-Type'
  _header_content_type = ['application/json']
  header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(body)
  
  auth_names = ['PureCloud Auth']
  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 => 'ForecastCreationCompletion')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WorkforceManagementApi#post_longtermforecasts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end