Class: GustoEmbedded::Employees

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/gusto_embedded/employees.rb

Instance Method Summary collapse

Constructor Details

#initialize(sdk_config) ⇒ Employees

Returns a new instance of Employees.



17
18
19
# File 'lib/gusto_embedded/employees.rb', line 17

def initialize(sdk_config)
  @sdk_configuration = sdk_config
end

Instance Method Details

#create(company_id, request_body, x_gusto_api_version = nil) ⇒ Object

Raises:

  • (StandardError)


23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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
# File 'lib/gusto_embedded/employees.rb', line 23

def create(company_id, request_body, x_gusto_api_version = nil)
  # create - Create an employee
  # Create an employee.
  # 
  # scope: `employees:manage`
  request = ::GustoEmbedded::Operations::PostV1EmployeesRequest.new(
    
    company_id: company_id,
    request_body: request_body,
    x_gusto_api_version: x_gusto_api_version
  )
  url, params = @sdk_configuration.get_server_details
  base_url = Utils.template_url(url, params)
  url = Utils.generate_url(
    ::GustoEmbedded::Operations::PostV1EmployeesRequest,
    base_url,
    '/v1/companies/{company_id}/employees',
    request
  )
  headers = Utils.get_headers(request)
  req_content_type, data, form = Utils.serialize_request_body(request, :request_body, :json)
  headers['content-type'] = req_content_type
  raise StandardError, 'request body is required' if data.nil? && form.nil?
  headers['Accept'] = 'application/json'
  headers['user-agent'] = @sdk_configuration.user_agent

  r = @sdk_configuration.client.post(url) do |req|
    req.headers = headers
    security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
    Utils.configure_request_security(req, security) if !security.nil?
    if form
      req.body = Utils.encode_form(form)
    elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
      req.body = URI.encode_www_form(data)
    else
      req.body = data
    end
  end

  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')

  res = ::GustoEmbedded::Operations::PostV1EmployeesResponse.new(
    status_code: r.status, content_type: content_type, raw_response: r
  )
  if r.status == 201
    if Utils.match_content_type(content_type, 'application/json')
      out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::GustoEmbedded::Shared::Employee)
      res.employee = out
    end
  elsif r.status == 404
  elsif r.status == 422
    if Utils.match_content_type(content_type, 'application/json')
      out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::GustoEmbedded::Shared::UnprocessableEntityErrorObject)
      res.unprocessable_entity_error_object = out
    end
  end

  res
end

#create_historical(company_uuid, historical_employee_body, x_gusto_api_version = nil) ⇒ Object

Raises:

  • (StandardError)


128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/gusto_embedded/employees.rb', line 128

def create_historical(company_uuid, historical_employee_body, x_gusto_api_version = nil)
  # create_historical - Create a historical employee
  # Create a historical employee, an employee that was previously dismissed from the company in the current year.
  # 
  # scope: `employees:manage`
  request = ::GustoEmbedded::Operations::PostV1HistoricalEmployeesRequest.new(
    
    company_uuid: company_uuid,
    historical_employee_body: historical_employee_body,
    x_gusto_api_version: x_gusto_api_version
  )
  url, params = @sdk_configuration.get_server_details
  base_url = Utils.template_url(url, params)
  url = Utils.generate_url(
    ::GustoEmbedded::Operations::PostV1HistoricalEmployeesRequest,
    base_url,
    '/v1/companies/{company_uuid}/historical_employees',
    request
  )
  headers = Utils.get_headers(request)
  req_content_type, data, form = Utils.serialize_request_body(request, :historical_employee_body, :json)
  headers['content-type'] = req_content_type
  raise StandardError, 'request body is required' if data.nil? && form.nil?
  headers['Accept'] = 'application/json'
  headers['user-agent'] = @sdk_configuration.user_agent

  r = @sdk_configuration.client.post(url) do |req|
    req.headers = headers
    security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
    Utils.configure_request_security(req, security) if !security.nil?
    if form
      req.body = Utils.encode_form(form)
    elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
      req.body = URI.encode_www_form(data)
    else
      req.body = data
    end
  end

  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')

  res = ::GustoEmbedded::Operations::PostV1HistoricalEmployeesResponse.new(
    status_code: r.status, content_type: content_type, raw_response: r
  )
  if r.status == 201
    if Utils.match_content_type(content_type, 'application/json')
      out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::GustoEmbedded::Shared::Employee)
      res.employee = out
    end
  elsif r.status == 404
  elsif r.status == 422
    if Utils.match_content_type(content_type, 'application/json')
      out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::GustoEmbedded::Shared::UnprocessableEntityErrorObject)
      res.unprocessable_entity_error_object = out
    end
  end

  res
end

#delete(employee_id, x_gusto_api_version = nil) ⇒ Object



302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
# File 'lib/gusto_embedded/employees.rb', line 302

def delete(employee_id, x_gusto_api_version = nil)
  # delete - Delete an onboarding employee
  # Use this endpoint to delete an employee who is in onboarding. Deleting
  # an onboarded employee is not allowed and will return a 422 response. Please check out the Terminations api
  # if you need to terminate an onboarded employee.
  # 
  # scope: `employees:manage`
  request = ::GustoEmbedded::Operations::DeleteV1EmployeeRequest.new(
    
    employee_id: employee_id,
    x_gusto_api_version: x_gusto_api_version
  )
  url, params = @sdk_configuration.get_server_details
  base_url = Utils.template_url(url, params)
  url = Utils.generate_url(
    ::GustoEmbedded::Operations::DeleteV1EmployeeRequest,
    base_url,
    '/v1/employees/{employee_id}',
    request
  )
  headers = Utils.get_headers(request)
  headers['Accept'] = 'application/json'
  headers['user-agent'] = @sdk_configuration.user_agent

  r = @sdk_configuration.client.delete(url) do |req|
    req.headers = headers
    security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
    Utils.configure_request_security(req, security) if !security.nil?
  end

  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')

  res = ::GustoEmbedded::Operations::DeleteV1EmployeeResponse.new(
    status_code: r.status, content_type: content_type, raw_response: r
  )
  if r.status == 204
  elsif r.status == 404
  elsif r.status == 422
    if Utils.match_content_type(content_type, 'application/json')
      out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::GustoEmbedded::Shared::UnprocessableEntityErrorObject)
      res.unprocessable_entity_error_object = out
    end
  end

  res
end

#get(employee_id, include = nil, x_gusto_api_version = nil) ⇒ Object



190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
# File 'lib/gusto_embedded/employees.rb', line 190

def get(employee_id, include = nil, x_gusto_api_version = nil)
  # get - Get an employee
  # Get an employee.
  # 
  # scope: `employees:read`
  # 
  request = ::GustoEmbedded::Operations::GetV1EmployeesRequest.new(
    
    employee_id: employee_id,
    include: include,
    x_gusto_api_version: x_gusto_api_version
  )
  url, params = @sdk_configuration.get_server_details
  base_url = Utils.template_url(url, params)
  url = Utils.generate_url(
    ::GustoEmbedded::Operations::GetV1EmployeesRequest,
    base_url,
    '/v1/employees/{employee_id}',
    request
  )
  headers = Utils.get_headers(request)
  query_params = Utils.get_query_params(::GustoEmbedded::Operations::GetV1EmployeesRequest, request)
  headers['Accept'] = 'application/json'
  headers['user-agent'] = @sdk_configuration.user_agent

  r = @sdk_configuration.client.get(url) do |req|
    req.headers = headers
    req.params = query_params
    security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
    Utils.configure_request_security(req, security) if !security.nil?
  end

  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')

  res = ::GustoEmbedded::Operations::GetV1EmployeesResponse.new(
    status_code: r.status, content_type: content_type, raw_response: r
  )
  if r.status == 200
    if Utils.match_content_type(content_type, 'application/json')
      out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::GustoEmbedded::Shared::Employee)
      res.employee = out
    end
  elsif r.status == 404
  end

  res
end

#get_custom_fields(employee_id, page = nil, per = nil, x_gusto_api_version = nil) ⇒ Object



351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
# File 'lib/gusto_embedded/employees.rb', line 351

def get_custom_fields(employee_id, page = nil, per = nil, x_gusto_api_version = nil)
  # get_custom_fields - Get an employee's custom fields
  # Returns a list of the employee's custom fields.
  # 
  # scope: `employees:read`
  request = ::GustoEmbedded::Operations::GetV1EmployeesEmployeeIdCustomFieldsRequest.new(
    
    employee_id: employee_id,
    page: page,
    per: per,
    x_gusto_api_version: x_gusto_api_version
  )
  url, params = @sdk_configuration.get_server_details
  base_url = Utils.template_url(url, params)
  url = Utils.generate_url(
    ::GustoEmbedded::Operations::GetV1EmployeesEmployeeIdCustomFieldsRequest,
    base_url,
    '/v1/employees/{employee_id}/custom_fields',
    request
  )
  headers = Utils.get_headers(request)
  query_params = Utils.get_query_params(::GustoEmbedded::Operations::GetV1EmployeesEmployeeIdCustomFieldsRequest, request)
  headers['Accept'] = 'application/json'
  headers['user-agent'] = @sdk_configuration.user_agent

  r = @sdk_configuration.client.get(url) do |req|
    req.headers = headers
    req.params = query_params
    security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
    Utils.configure_request_security(req, security) if !security.nil?
  end

  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')

  res = ::GustoEmbedded::Operations::GetV1EmployeesEmployeeIdCustomFieldsResponse.new(
    status_code: r.status, content_type: content_type, raw_response: r
  )
  if r.status == 200
    if Utils.match_content_type(content_type, 'application/json')
      out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::GustoEmbedded::Operations::GetV1EmployeesEmployeeIdCustomFieldsResponseBody)
      res.object = out
    end
  elsif r.status == 404
  end

  res
end

#get_onboarding_status(employee_id, x_gusto_api_version = nil) ⇒ Object



458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
# File 'lib/gusto_embedded/employees.rb', line 458

def get_onboarding_status(employee_id, x_gusto_api_version = nil)
  # get_onboarding_status - Get the employee's onboarding status
  # # Description
  # Retrieves an employee's onboarding status. The data returned helps inform the required onboarding steps and respective completion status.
  # 
  # scope: `employees:read`
  # 
  # ## onboarding_status
  # 
  # ### Admin-facilitated onboarding
  # | onboarding_status | Description |
  # |:------------------|------------:|
  # | `admin_onboarding_incomplete` | Admin needs to complete the full employee-onboarding. |
  # | `onboarding_completed` | Employee has been fully onboarded and verified. |
  # 
  # ### Employee self-onboarding
  # | onboarding_status | Description |
  # |:------------------|------------:|
  # | `admin_onboarding_incomplete` | Admin needs to enter basic information about the employee. |
  # | `self_onboarding_pending_invite` | Admin has the intention to invite the employee to self-onboard (e.g., marking a checkbox), but the system has not yet sent the invitation. |
  # | `self_onboarding_invited` | Employee has been sent an invitation to self-onboard. |
  # | `self_onboarding_invited_started` | Employee has started the self-onboarding process. |
  # | `self_onboarding_invited_overdue` | Employee's start date has passed, and employee has still not completed self-onboarding. |
  # | `self_onboarding_completed_by_employee` | Employee has completed entering in their information. The status should be updated via API to "self_onboarding_awaiting_admin_review" from here, once the Admin has started reviewing. |
  # | `self_onboarding_awaiting_admin_review` | Admin has started to verify the employee's information. |
  # | `onboarding_completed` | Employee has been fully onboarded and verified. |
  # 
  # ## onboarding_steps
  # 
  # | onboarding_steps | Requirement(s) to be completed |
  # |:-----------------|-------------------------------:|
  # | `personal_details` | Add employee's first name, last name, email, date of birth, social security number |
  # | `compensation_details` | Associate employee to a job & compensation. |
  # | `add_work_address` | Add employee work address. |
  # | `add_home_address` | Add employee home address. |
  # | `federal_tax_setup` | Set up federal tax withholdings. |
  # | `state_tax_setup` | Set up state tax withholdings. |
  # | `direct_deposit_setup` | (optional) Set up employee's direct deposit. |
  # | `employee_form_signing` | Employee forms (e.g., W4, direct deposit authorization) are generated & signed. |
  # | `file_new_hire_report` | File a new hire report for this employee. |
  # | `admin_review` | Admin reviews & confirms employee details (only required for Employee self-onboarding) |
  request = ::GustoEmbedded::Operations::GetV1EmployeesEmployeeIdOnboardingStatusRequest.new(
    
    employee_id: employee_id,
    x_gusto_api_version: x_gusto_api_version
  )
  url, params = @sdk_configuration.get_server_details
  base_url = Utils.template_url(url, params)
  url = Utils.generate_url(
    ::GustoEmbedded::Operations::GetV1EmployeesEmployeeIdOnboardingStatusRequest,
    base_url,
    '/v1/employees/{employee_id}/onboarding_status',
    request
  )
  headers = Utils.get_headers(request)
  headers['Accept'] = 'application/json'
  headers['user-agent'] = @sdk_configuration.user_agent

  r = @sdk_configuration.client.get(url) do |req|
    req.headers = headers
    security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
    Utils.configure_request_security(req, security) if !security.nil?
  end

  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')

  res = ::GustoEmbedded::Operations::GetV1EmployeesEmployeeIdOnboardingStatusResponse.new(
    status_code: r.status, content_type: content_type, raw_response: r
  )
  if r.status == 200
    if Utils.match_content_type(content_type, 'application/json')
      out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::GustoEmbedded::Shared::EmployeeOnboardingStatus)
      res.employee_onboarding_status = out
    end
  elsif r.status == 404
  end

  res
end

#get_time_off_activities(employee_uuid, time_off_type, x_gusto_api_version = nil) ⇒ Object



611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
# File 'lib/gusto_embedded/employees.rb', line 611

def get_time_off_activities(employee_uuid, time_off_type, x_gusto_api_version = nil)
  # get_time_off_activities - Get employee time off activities
  # Get employee time off activities.
  # 
  # scope: `employee_time_off_activities:read`
  request = ::GustoEmbedded::Operations::GetVersionEmployeesTimeOffActivitiesRequest.new(
    
    employee_uuid: employee_uuid,
    time_off_type: time_off_type,
    x_gusto_api_version: x_gusto_api_version
  )
  url, params = @sdk_configuration.get_server_details
  base_url = Utils.template_url(url, params)
  url = Utils.generate_url(
    ::GustoEmbedded::Operations::GetVersionEmployeesTimeOffActivitiesRequest,
    base_url,
    '/v1/employees/{employee_uuid}/time_off_activities',
    request
  )
  headers = Utils.get_headers(request)
  query_params = Utils.get_query_params(::GustoEmbedded::Operations::GetVersionEmployeesTimeOffActivitiesRequest, request)
  headers['Accept'] = 'application/json'
  headers['user-agent'] = @sdk_configuration.user_agent

  r = @sdk_configuration.client.get(url) do |req|
    req.headers = headers
    req.params = query_params
    security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
    Utils.configure_request_security(req, security) if !security.nil?
  end

  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')

  res = ::GustoEmbedded::Operations::GetVersionEmployeesTimeOffActivitiesResponse.new(
    status_code: r.status, content_type: content_type, raw_response: r
  )
  if r.status == 200
    if Utils.match_content_type(content_type, 'application/json')
      out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::GustoEmbedded::Shared::TimeOffActivity)
      res.time_off_activity = out
    end
  elsif r.status == 404
  end

  res
end

#list(request) ⇒ Object



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/gusto_embedded/employees.rb', line 85

def list(request)
  # list - Get employees of a company
  # Get all of the employees, onboarding, active and terminated, for a given company.
  # 
  # scope: `employees:read`
  url, params = @sdk_configuration.get_server_details
  base_url = Utils.template_url(url, params)
  url = Utils.generate_url(
    ::GustoEmbedded::Operations::GetV1CompaniesCompanyIdEmployeesRequest,
    base_url,
    '/v1/companies/{company_id}/employees',
    request
  )
  headers = Utils.get_headers(request)
  query_params = Utils.get_query_params(::GustoEmbedded::Operations::GetV1CompaniesCompanyIdEmployeesRequest, request)
  headers['Accept'] = 'application/json'
  headers['user-agent'] = @sdk_configuration.user_agent

  r = @sdk_configuration.client.get(url) do |req|
    req.headers = headers
    req.params = query_params
    security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
    Utils.configure_request_security(req, security) if !security.nil?
  end

  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')

  res = ::GustoEmbedded::Operations::GetV1CompaniesCompanyIdEmployeesResponse.new(
    status_code: r.status, content_type: content_type, raw_response: r
  )
  if r.status == 200
    if Utils.match_content_type(content_type, 'application/json')
      out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), T::Array[::GustoEmbedded::Shared::Employee])
      res.employee_list = out
    end
  elsif r.status == 404
  end

  res
end

#update(employee_id, request_body, x_gusto_api_version = nil) ⇒ Object

Raises:

  • (StandardError)


240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
# File 'lib/gusto_embedded/employees.rb', line 240

def update(employee_id, request_body, x_gusto_api_version = nil)
  # update - Update an employee
  # Update an employee.
  # 
  # scope: `employees:write`
  request = ::GustoEmbedded::Operations::PutV1EmployeesRequest.new(
    
    employee_id: employee_id,
    request_body: request_body,
    x_gusto_api_version: x_gusto_api_version
  )
  url, params = @sdk_configuration.get_server_details
  base_url = Utils.template_url(url, params)
  url = Utils.generate_url(
    ::GustoEmbedded::Operations::PutV1EmployeesRequest,
    base_url,
    '/v1/employees/{employee_id}',
    request
  )
  headers = Utils.get_headers(request)
  req_content_type, data, form = Utils.serialize_request_body(request, :request_body, :json)
  headers['content-type'] = req_content_type
  raise StandardError, 'request body is required' if data.nil? && form.nil?
  headers['Accept'] = 'application/json'
  headers['user-agent'] = @sdk_configuration.user_agent

  r = @sdk_configuration.client.put(url) do |req|
    req.headers = headers
    security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
    Utils.configure_request_security(req, security) if !security.nil?
    if form
      req.body = Utils.encode_form(form)
    elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
      req.body = URI.encode_www_form(data)
    else
      req.body = data
    end
  end

  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')

  res = ::GustoEmbedded::Operations::PutV1EmployeesResponse.new(
    status_code: r.status, content_type: content_type, raw_response: r
  )
  if r.status == 200
    if Utils.match_content_type(content_type, 'application/json')
      out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::GustoEmbedded::Shared::Employee)
      res.employee = out
    end
  elsif r.status == 404
  elsif r.status == 422
    if Utils.match_content_type(content_type, 'application/json')
      out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::GustoEmbedded::Shared::UnprocessableEntityErrorObject)
      res.unprocessable_entity_error_object = out
    end
  end

  res
end

#update_onboarding_documents_config(employee_id, request_body, x_gusto_api_version = nil) ⇒ Object

Raises:

  • (StandardError)


401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
# File 'lib/gusto_embedded/employees.rb', line 401

def update_onboarding_documents_config(employee_id, request_body, x_gusto_api_version = nil)
  # update_onboarding_documents_config - Update an employee's onboarding documents config
  # Indicate whether to include the Form I-9 for an employee during the onboarding process.
  # 
  # scope: `employees:manage`
  request = ::GustoEmbedded::Operations::PutV1EmployeesEmployeeIdOnboardingDocumentsConfigRequest.new(
    
    employee_id: employee_id,
    request_body: request_body,
    x_gusto_api_version: x_gusto_api_version
  )
  url, params = @sdk_configuration.get_server_details
  base_url = Utils.template_url(url, params)
  url = Utils.generate_url(
    ::GustoEmbedded::Operations::PutV1EmployeesEmployeeIdOnboardingDocumentsConfigRequest,
    base_url,
    '/v1/employees/{employee_id}/onboarding_documents_config',
    request
  )
  headers = Utils.get_headers(request)
  req_content_type, data, form = Utils.serialize_request_body(request, :request_body, :json)
  headers['content-type'] = req_content_type
  raise StandardError, 'request body is required' if data.nil? && form.nil?
  headers['Accept'] = 'application/json'
  headers['user-agent'] = @sdk_configuration.user_agent

  r = @sdk_configuration.client.put(url) do |req|
    req.headers = headers
    security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
    Utils.configure_request_security(req, security) if !security.nil?
    if form
      req.body = Utils.encode_form(form)
    elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
      req.body = URI.encode_www_form(data)
    else
      req.body = data
    end
  end

  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')

  res = ::GustoEmbedded::Operations::PutV1EmployeesEmployeeIdOnboardingDocumentsConfigResponse.new(
    status_code: r.status, content_type: content_type, raw_response: r
  )
  if r.status == 200
    if Utils.match_content_type(content_type, 'application/json')
      out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::GustoEmbedded::Shared::EmployeeOnboardingDocument)
      res.employee_onboarding_document = out
    end
  elsif r.status == 404
  end

  res
end

#update_onboarding_status(employee_id, request_body, x_gusto_api_version = nil) ⇒ Object

Raises:

  • (StandardError)


540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
# File 'lib/gusto_embedded/employees.rb', line 540

def update_onboarding_status(employee_id, request_body, x_gusto_api_version = nil)
  # update_onboarding_status - Update the employee's onboarding status
  # scope: `employees:manage`
  # 
  # Updates an employee's onboarding status.
  # Below is a list of valid onboarding status changes depending on the intended action to be performed on behalf of the employee.
  # 
  # | Action | current onboarding_status | new onboarding_status |
  # |:------------------|:------------:|----------:|
  # | Mark an employee as self-onboarding | `admin_onboarding_incomplete` | `self_onboarding_pending_invite` |
  # | Invite an employee to self-onboard | `admin_onboarding_incomplete` or `self_onboarding_pending_invite` | `self_onboarding_invited` |
  # | Cancel an employee's self-onboarding | `self_onboarding_invited` or `self_onboarding_pending_invite` | `admin_onboarding_incomplete` |
  # | Review an employee's self-onboarded info | `self_onboarding_completed_by_employee` | `self_onboarding_awaiting_admin_review` |
  # | Finish an employee's onboarding | `admin_onboarding_incomplete` or `self_onboarding_awaiting_admin_review` | `onboarding_completed` |
  request = ::GustoEmbedded::Operations::PutV1EmployeesEmployeeIdOnboardingStatusRequest.new(
    
    employee_id: employee_id,
    request_body: request_body,
    x_gusto_api_version: x_gusto_api_version
  )
  url, params = @sdk_configuration.get_server_details
  base_url = Utils.template_url(url, params)
  url = Utils.generate_url(
    ::GustoEmbedded::Operations::PutV1EmployeesEmployeeIdOnboardingStatusRequest,
    base_url,
    '/v1/employees/{employee_id}/onboarding_status',
    request
  )
  headers = Utils.get_headers(request)
  req_content_type, data, form = Utils.serialize_request_body(request, :request_body, :json)
  headers['content-type'] = req_content_type
  raise StandardError, 'request body is required' if data.nil? && form.nil?
  headers['Accept'] = 'application/json'
  headers['user-agent'] = @sdk_configuration.user_agent

  r = @sdk_configuration.client.put(url) do |req|
    req.headers = headers
    security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
    Utils.configure_request_security(req, security) if !security.nil?
    if form
      req.body = Utils.encode_form(form)
    elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
      req.body = URI.encode_www_form(data)
    else
      req.body = data
    end
  end

  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')

  res = ::GustoEmbedded::Operations::PutV1EmployeesEmployeeIdOnboardingStatusResponse.new(
    status_code: r.status, content_type: content_type, raw_response: r
  )
  if r.status == 200
    if Utils.match_content_type(content_type, 'application/json')
      out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::GustoEmbedded::Shared::EmployeeOnboardingStatus)
      res.employee_onboarding_status = out
    end
  elsif r.status == 404
  elsif r.status == 422
    if Utils.match_content_type(content_type, 'application/json')
      out = Crystalline.unmarshal_json(JSON.parse(r.env.response_body), ::GustoEmbedded::Shared::UnprocessableEntityErrorObject)
      res.unprocessable_entity_error_object = out
    end
  end

  res
end