Class: Gusto::TimeOffRequests::TimeOffRequest
- Inherits:
-
Object
- Object
- Gusto::TimeOffRequests::TimeOffRequest
- Defined in:
- lib/fern_gusto/time_off_requests/types/time_off_request.rb
Overview
The representation of a time off request.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#approver ⇒ Gusto::TimeOffRequests::TimeOffRequestApprover
readonly
This value will be null if the request has not been approved.
-
#days ⇒ Object
readonly
representation of a numeric decimal to the thousands place.
- #employee ⇒ Gusto::TimeOffRequests::TimeOffRequestEmployee readonly
-
#employee_note ⇒ String
readonly
A note about the time off request, from the employee to the employer.
-
#employer_note ⇒ String
readonly
A note about the time off request, from the employer to the employee.
-
#id ⇒ Integer
readonly
The ID of the time off request.
- #initiator ⇒ Gusto::TimeOffRequests::TimeOffRequestInitiator readonly
-
#request_type ⇒ Gusto::TimeOffRequests::TimeOffRequestRequestType
readonly
The type of time off request.
-
#status ⇒ Gusto::TimeOffRequests::TimeOffRequestStatus
readonly
The status of the time off request.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(id: OMIT, status: OMIT, employee_note: OMIT, employer_note: OMIT, request_type: OMIT, days: OMIT, employee: OMIT, initiator: OMIT, approver: OMIT, additional_properties: nil) ⇒ Gusto::TimeOffRequests::TimeOffRequest constructor
- #to_json ⇒ String
Constructor Details
#initialize(id: OMIT, status: OMIT, employee_note: OMIT, employer_note: OMIT, request_type: OMIT, days: OMIT, employee: OMIT, initiator: OMIT, approver: OMIT, additional_properties: nil) ⇒ Gusto::TimeOffRequests::TimeOffRequest
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/fern_gusto/time_off_requests/types/time_off_request.rb', line 57 def initialize(id: OMIT, status: OMIT, employee_note: OMIT, employer_note: OMIT, request_type: OMIT, days: OMIT, employee: OMIT, initiator: OMIT, approver: OMIT, additional_properties: nil) @id = id if id != OMIT @status = status if status != OMIT @employee_note = employee_note if employee_note != OMIT @employer_note = employer_note if employer_note != OMIT @request_type = request_type if request_type != OMIT @days = days if days != OMIT @employee = employee if employee != OMIT @initiator = initiator if initiator != OMIT @approver = approver if approver != OMIT @additional_properties = additional_properties @_field_set = { "id": id, "status": status, "employee_note": employee_note, "employer_note": employer_note, "request_type": request_type, "days": days, "employee": employee, "initiator": initiator, "approver": approver }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
36 37 38 |
# File 'lib/fern_gusto/time_off_requests/types/time_off_request.rb', line 36 def additional_properties @additional_properties end |
#approver ⇒ Gusto::TimeOffRequests::TimeOffRequestApprover (readonly)
Returns This value will be null if the request has not been approved.
34 35 36 |
# File 'lib/fern_gusto/time_off_requests/types/time_off_request.rb', line 34 def approver @approver end |
#days ⇒ Object (readonly)
representation of a numeric decimal to the thousands place.
28 29 30 |
# File 'lib/fern_gusto/time_off_requests/types/time_off_request.rb', line 28 def days @days end |
#employee ⇒ Gusto::TimeOffRequests::TimeOffRequestEmployee (readonly)
30 31 32 |
# File 'lib/fern_gusto/time_off_requests/types/time_off_request.rb', line 30 def employee @employee end |
#employee_note ⇒ String (readonly)
Returns A note about the time off request, from the employee to the employer.
19 20 21 |
# File 'lib/fern_gusto/time_off_requests/types/time_off_request.rb', line 19 def employee_note @employee_note end |
#employer_note ⇒ String (readonly)
Returns A note about the time off request, from the employer to the employee.
21 22 23 |
# File 'lib/fern_gusto/time_off_requests/types/time_off_request.rb', line 21 def employer_note @employer_note end |
#id ⇒ Integer (readonly)
Returns The ID of the time off request.
15 16 17 |
# File 'lib/fern_gusto/time_off_requests/types/time_off_request.rb', line 15 def id @id end |
#initiator ⇒ Gusto::TimeOffRequests::TimeOffRequestInitiator (readonly)
32 33 34 |
# File 'lib/fern_gusto/time_off_requests/types/time_off_request.rb', line 32 def initiator @initiator end |
#request_type ⇒ Gusto::TimeOffRequests::TimeOffRequestRequestType (readonly)
Returns The type of time off request.
23 24 25 |
# File 'lib/fern_gusto/time_off_requests/types/time_off_request.rb', line 23 def request_type @request_type end |
#status ⇒ Gusto::TimeOffRequests::TimeOffRequestStatus (readonly)
Returns The status of the time off request.
17 18 19 |
# File 'lib/fern_gusto/time_off_requests/types/time_off_request.rb', line 17 def status @status end |
Class Method Details
.from_json(json_object:) ⇒ Gusto::TimeOffRequests::TimeOffRequest
76 77 78 79 80 81 82 83 84 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 |
# File 'lib/fern_gusto/time_off_requests/types/time_off_request.rb', line 76 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = parsed_json["id"] status = parsed_json["status"] employee_note = parsed_json["employee_note"] employer_note = parsed_json["employer_note"] request_type = parsed_json["request_type"] days = parsed_json["days"] unless parsed_json["employee"].nil? employee = parsed_json["employee"].to_json employee = Gusto::TimeOffRequests::TimeOffRequestEmployee.from_json(json_object: employee) else employee = nil end unless parsed_json["initiator"].nil? initiator = parsed_json["initiator"].to_json initiator = Gusto::TimeOffRequests::TimeOffRequestInitiator.from_json(json_object: initiator) else initiator = nil end unless parsed_json["approver"].nil? approver = parsed_json["approver"].to_json approver = Gusto::TimeOffRequests::TimeOffRequestApprover.from_json(json_object: approver) else approver = nil end new( id: id, status: status, employee_note: employee_note, employer_note: employer_note, request_type: request_type, days: days, employee: employee, initiator: initiator, approver: approver, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/fern_gusto/time_off_requests/types/time_off_request.rb', line 128 def self.validate_raw(obj:) obj.id&.is_a?(Integer) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.status&.is_a?(Gusto::TimeOffRequests::TimeOffRequestStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.") obj.employee_note&.is_a?(String) != false || raise("Passed value for field obj.employee_note is not the expected type, validation failed.") obj.employer_note&.is_a?(String) != false || raise("Passed value for field obj.employer_note is not the expected type, validation failed.") obj.request_type&.is_a?(Gusto::TimeOffRequests::TimeOffRequestRequestType) != false || raise("Passed value for field obj.request_type is not the expected type, validation failed.") obj.days&.is_a?(Hash) != false || raise("Passed value for field obj.days is not the expected type, validation failed.") obj.employee.nil? || Gusto::TimeOffRequests::TimeOffRequestEmployee.validate_raw(obj: obj.employee) obj.initiator.nil? || Gusto::TimeOffRequests::TimeOffRequestInitiator.validate_raw(obj: obj.initiator) obj.approver.nil? || Gusto::TimeOffRequests::TimeOffRequestApprover.validate_raw(obj: obj.approver) end |
Instance Method Details
#to_json ⇒ String
119 120 121 |
# File 'lib/fern_gusto/time_off_requests/types/time_off_request.rb', line 119 def to_json @_field_set&.to_json end |