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 ⇒ Merge::Hris::TimesheetEntryRequestEmployee
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
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/merge_ruby_client/hris/types/timesheet_entry_request.rb', line 45 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.
30 31 32 |
# File 'lib/merge_ruby_client/hris/types/timesheet_entry_request.rb', line 30 def additional_properties @additional_properties end |
#employee ⇒ Merge::Hris::TimesheetEntryRequestEmployee (readonly)
Returns The employee the timesheet entry is for.
18 19 20 |
# File 'lib/merge_ruby_client/hris/types/timesheet_entry_request.rb', line 18 def employee @employee end |
#end_time ⇒ DateTime (readonly)
Returns The time at which the employee ended work.
24 25 26 |
# File 'lib/merge_ruby_client/hris/types/timesheet_entry_request.rb', line 24 def end_time @end_time end |
#hours_worked ⇒ Float (readonly)
Returns The number of hours logged by the employee.
20 21 22 |
# File 'lib/merge_ruby_client/hris/types/timesheet_entry_request.rb', line 20 def hours_worked @hours_worked end |
#integration_params ⇒ Hash{String => Object} (readonly)
26 27 28 |
# File 'lib/merge_ruby_client/hris/types/timesheet_entry_request.rb', line 26 def integration_params @integration_params end |
#linked_account_params ⇒ Hash{String => Object} (readonly)
28 29 30 |
# File 'lib/merge_ruby_client/hris/types/timesheet_entry_request.rb', line 28 def linked_account_params @linked_account_params end |
#start_time ⇒ DateTime (readonly)
Returns The time at which the employee started work.
22 23 24 |
# File 'lib/merge_ruby_client/hris/types/timesheet_entry_request.rb', line 22 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
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/merge_ruby_client/hris/types/timesheet_entry_request.rb', line 70 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) if parsed_json["employee"].nil? employee = nil else employee = parsed_json["employee"].to_json employee = Merge::Hris::TimesheetEntryRequestEmployee.from_json(json_object: employee) end 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.
108 109 110 111 112 113 114 115 |
# File 'lib/merge_ruby_client/hris/types/timesheet_entry_request.rb', line 108 def self.validate_raw(obj:) obj.employee.nil? || Merge::Hris::TimesheetEntryRequestEmployee.validate_raw(obj: obj.employee) 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
98 99 100 |
# File 'lib/merge_ruby_client/hris/types/timesheet_entry_request.rb', line 98 def to_json(*_args) @_field_set&.to_json end |