Class: Gusto::Payrolls::PayPeriod
- Inherits:
-
Object
- Object
- Gusto::Payrolls::PayPeriod
- Defined in:
- lib/fern_gusto/payrolls/types/pay_period.rb
Overview
The representation of a pay period.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#end_date ⇒ String
readonly
The end date, inclusive, of the pay period.
-
#pay_schedule_uuid ⇒ String
readonly
A unique identifier of the pay schedule to which the pay period belongs.
-
#payroll ⇒ Gusto::Payrolls::PayPeriodPayroll
readonly
Information about the payroll for the pay period.
-
#start_date ⇒ String
readonly
The start date, inclusive, of the pay period.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(start_date: OMIT, end_date: OMIT, pay_schedule_uuid: OMIT, payroll: OMIT, additional_properties: nil) ⇒ Gusto::Payrolls::PayPeriod constructor
- #to_json ⇒ String
Constructor Details
#initialize(start_date: OMIT, end_date: OMIT, pay_schedule_uuid: OMIT, payroll: OMIT, additional_properties: nil) ⇒ Gusto::Payrolls::PayPeriod
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/fern_gusto/payrolls/types/pay_period.rb', line 32 def initialize(start_date: OMIT, end_date: OMIT, pay_schedule_uuid: OMIT, payroll: OMIT, additional_properties: nil) @start_date = start_date if start_date != OMIT @end_date = end_date if end_date != OMIT @pay_schedule_uuid = pay_schedule_uuid if pay_schedule_uuid != OMIT @payroll = payroll if payroll != OMIT @additional_properties = additional_properties @_field_set = { "start_date": start_date, "end_date": end_date, "pay_schedule_uuid": pay_schedule_uuid, "payroll": payroll }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
19 20 21 |
# File 'lib/fern_gusto/payrolls/types/pay_period.rb', line 19 def additional_properties @additional_properties end |
#end_date ⇒ String (readonly)
Returns The end date, inclusive, of the pay period.
13 14 15 |
# File 'lib/fern_gusto/payrolls/types/pay_period.rb', line 13 def end_date @end_date end |
#pay_schedule_uuid ⇒ String (readonly)
Returns A unique identifier of the pay schedule to which the pay period belongs.
15 16 17 |
# File 'lib/fern_gusto/payrolls/types/pay_period.rb', line 15 def pay_schedule_uuid @pay_schedule_uuid end |
#payroll ⇒ Gusto::Payrolls::PayPeriodPayroll (readonly)
Returns Information about the payroll for the pay period.
17 18 19 |
# File 'lib/fern_gusto/payrolls/types/pay_period.rb', line 17 def payroll @payroll end |
#start_date ⇒ String (readonly)
Returns The start date, inclusive, of the pay period.
11 12 13 |
# File 'lib/fern_gusto/payrolls/types/pay_period.rb', line 11 def start_date @start_date end |
Class Method Details
.from_json(json_object:) ⇒ Gusto::Payrolls::PayPeriod
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/fern_gusto/payrolls/types/pay_period.rb', line 46 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) start_date = parsed_json["start_date"] end_date = parsed_json["end_date"] pay_schedule_uuid = parsed_json["pay_schedule_uuid"] unless parsed_json["payroll"].nil? payroll = parsed_json["payroll"].to_json payroll = Gusto::Payrolls::PayPeriodPayroll.from_json(json_object: payroll) else payroll = nil end new( start_date: start_date, end_date: end_date, pay_schedule_uuid: pay_schedule_uuid, payroll: payroll, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
78 79 80 81 82 83 |
# File 'lib/fern_gusto/payrolls/types/pay_period.rb', line 78 def self.validate_raw(obj:) obj.start_date&.is_a?(String) != false || raise("Passed value for field obj.start_date is not the expected type, validation failed.") obj.end_date&.is_a?(String) != false || raise("Passed value for field obj.end_date is not the expected type, validation failed.") obj.pay_schedule_uuid&.is_a?(String) != false || raise("Passed value for field obj.pay_schedule_uuid is not the expected type, validation failed.") obj.payroll.nil? || Gusto::Payrolls::PayPeriodPayroll.validate_raw(obj: obj.payroll) end |
Instance Method Details
#to_json ⇒ String
69 70 71 |
# File 'lib/fern_gusto/payrolls/types/pay_period.rb', line 69 def to_json @_field_set&.to_json end |