Class: Merge::Hris::TimesheetEntryRequest
- Inherits:
-
Object
- Object
- Merge::Hris::TimesheetEntryRequest
- Defined in:
- lib/merge_ruby_client/hris/types/timesheet_entry_request.rb
Overview
# The Timesheet Entry Object
### Description
The `Timesheet Entry` object is used to track coverage for hours worked by an
'Employee'.
### Usage Example
GET and POST Timesheet Entries
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#employee ⇒ String
readonly
The employee the timesheet entry is for.
-
#end_time ⇒ DateTime
readonly
The time at which the employee ended work.
-
#hours_worked ⇒ Float
readonly
The number of hours logged by the employee.
- #integration_params ⇒ Hash{String => Object} readonly
- #linked_account_params ⇒ Hash{String => Object} readonly
-
#start_time ⇒ DateTime
readonly
The time at which the employee started work.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Hris::TimesheetEntryRequest
Deserialize a JSON object to an instance of TimesheetEntryRequest.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(employee: OMIT, hours_worked: OMIT, start_time: OMIT, end_time: OMIT, integration_params: OMIT, linked_account_params: OMIT, additional_properties: nil) ⇒ Merge::Hris::TimesheetEntryRequest constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of TimesheetEntryRequest to a JSON object.
Constructor Details
#initialize(employee: OMIT, hours_worked: OMIT, start_time: OMIT, end_time: OMIT, integration_params: OMIT, linked_account_params: OMIT, additional_properties: nil) ⇒ Merge::Hris::TimesheetEntryRequest
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/merge_ruby_client/hris/types/timesheet_entry_request.rb', line 44 def initialize(employee: OMIT, hours_worked: OMIT, start_time: OMIT, end_time: OMIT, integration_params: OMIT, linked_account_params: OMIT, additional_properties: nil) @employee = employee if employee != OMIT @hours_worked = hours_worked if hours_worked != OMIT @start_time = start_time if start_time != OMIT @end_time = end_time if end_time != OMIT @integration_params = integration_params if integration_params != OMIT @linked_account_params = linked_account_params if linked_account_params != OMIT @additional_properties = additional_properties @_field_set = { "employee": employee, "hours_worked": hours_worked, "start_time": start_time, "end_time": end_time, "integration_params": integration_params, "linked_account_params": linked_account_params }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
29 30 31 |
# File 'lib/merge_ruby_client/hris/types/timesheet_entry_request.rb', line 29 def additional_properties @additional_properties end |
#employee ⇒ String (readonly)
Returns The employee the timesheet entry is for.
17 18 19 |
# File 'lib/merge_ruby_client/hris/types/timesheet_entry_request.rb', line 17 def employee @employee end |
#end_time ⇒ DateTime (readonly)
Returns The time at which the employee ended work.
23 24 25 |
# File 'lib/merge_ruby_client/hris/types/timesheet_entry_request.rb', line 23 def end_time @end_time end |
#hours_worked ⇒ Float (readonly)
Returns The number of hours logged by the employee.
19 20 21 |
# File 'lib/merge_ruby_client/hris/types/timesheet_entry_request.rb', line 19 def hours_worked @hours_worked end |
#integration_params ⇒ Hash{String => Object} (readonly)
25 26 27 |
# File 'lib/merge_ruby_client/hris/types/timesheet_entry_request.rb', line 25 def integration_params @integration_params end |
#linked_account_params ⇒ Hash{String => Object} (readonly)
27 28 29 |
# File 'lib/merge_ruby_client/hris/types/timesheet_entry_request.rb', line 27 def linked_account_params @linked_account_params end |
#start_time ⇒ DateTime (readonly)
Returns The time at which the employee started work.
21 22 23 |
# File 'lib/merge_ruby_client/hris/types/timesheet_entry_request.rb', line 21 def start_time @start_time end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Hris::TimesheetEntryRequest
Deserialize a JSON object to an instance of TimesheetEntryRequest
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/merge_ruby_client/hris/types/timesheet_entry_request.rb', line 69 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) employee = parsed_json["employee"] hours_worked = parsed_json["hours_worked"] start_time = (DateTime.parse(parsed_json["start_time"]) unless parsed_json["start_time"].nil?) end_time = (DateTime.parse(parsed_json["end_time"]) unless parsed_json["end_time"].nil?) integration_params = parsed_json["integration_params"] linked_account_params = parsed_json["linked_account_params"] new( employee: employee, hours_worked: hours_worked, start_time: start_time, end_time: end_time, integration_params: integration_params, linked_account_params: linked_account_params, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given
hash and check each fields type against the current object's property
definitions.
102 103 104 105 106 107 108 109 |
# File 'lib/merge_ruby_client/hris/types/timesheet_entry_request.rb', line 102 def self.validate_raw(obj:) obj.employee&.is_a?(String) != false || raise("Passed value for field obj.employee is not the expected type, validation failed.") obj.hours_worked&.is_a?(Float) != false || raise("Passed value for field obj.hours_worked is not the expected type, validation failed.") obj.start_time&.is_a?(DateTime) != false || raise("Passed value for field obj.start_time is not the expected type, validation failed.") obj.end_time&.is_a?(DateTime) != false || raise("Passed value for field obj.end_time is not the expected type, validation failed.") obj.integration_params&.is_a?(Hash) != false || raise("Passed value for field obj.integration_params is not the expected type, validation failed.") obj.linked_account_params&.is_a?(Hash) != false || raise("Passed value for field obj.linked_account_params is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of TimesheetEntryRequest to a JSON object
92 93 94 |
# File 'lib/merge_ruby_client/hris/types/timesheet_entry_request.rb', line 92 def to_json(*_args) @_field_set&.to_json end |