Class: Gusto::PaySchedules::PaySchedule

Inherits:
Object
  • Object
show all
Defined in:
lib/fern_gusto/pay_schedules/types/pay_schedule.rb

Overview

The representation of a pay schedule.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uuid:, frequency: OMIT, anchor_pay_date: OMIT, anchor_end_of_pay_period: OMIT, day1: OMIT, day2: OMIT, name: OMIT, custom_name: OMIT, auto_pilot: OMIT, active: OMIT, additional_properties: nil) ⇒ Gusto::PaySchedules::PaySchedule

Parameters:

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/fern_gusto/pay_schedules/types/pay_schedule.rb', line 78

def initialize(uuid:, frequency: OMIT, anchor_pay_date: OMIT, anchor_end_of_pay_period: OMIT, day1: OMIT, day2: OMIT, name: OMIT, custom_name: OMIT, auto_pilot: OMIT, active: OMIT, additional_properties: nil)
  @uuid = uuid
  @frequency = frequency if frequency != OMIT
  @anchor_pay_date = anchor_pay_date if anchor_pay_date != OMIT
  @anchor_end_of_pay_period = anchor_end_of_pay_period if anchor_end_of_pay_period != OMIT
  @day1 = day1 if day1 != OMIT
  @day2 = day2 if day2 != OMIT
  @name = name if name != OMIT
  @custom_name = custom_name if custom_name != OMIT
  @auto_pilot = auto_pilot if auto_pilot != OMIT
  @active = active if active != OMIT
  @additional_properties = additional_properties
  @_field_set = { "uuid": uuid, "frequency": frequency, "anchor_pay_date": anchor_pay_date, "anchor_end_of_pay_period": anchor_end_of_pay_period, "day_1": day1, "day_2": day2, "name": name, "custom_name": custom_name, "auto_pilot": auto_pilot, "active": active }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#activeObject (readonly)

inactive when it’s unassigned.



43
44
45
# File 'lib/fern_gusto/pay_schedules/types/pay_schedule.rb', line 43

def active
  @active
end

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



45
46
47
# File 'lib/fern_gusto/pay_schedules/types/pay_schedule.rb', line 45

def additional_properties
  @additional_properties
end

#anchor_end_of_pay_periodObject (readonly)

pay date.



18
19
20
# File 'lib/fern_gusto/pay_schedules/types/pay_schedule.rb', line 18

def anchor_end_of_pay_period
  @anchor_end_of_pay_period
end

#anchor_pay_dateString (readonly)

Returns The first date that employees on this pay schedule are paid with Gusto.

Returns:

  • (String)

    The first date that employees on this pay schedule are paid with Gusto.



15
16
17
# File 'lib/fern_gusto/pay_schedules/types/pay_schedule.rb', line 15

def anchor_pay_date
  @anchor_pay_date
end

#auto_pilotObject (readonly)

payroll deadlines.



40
41
42
# File 'lib/fern_gusto/pay_schedules/types/pay_schedule.rb', line 40

def auto_pilot
  @auto_pilot
end

#custom_nameString (readonly)

Returns A custom name for a pay schedule, defaults to the pay frequency description.

Returns:

  • (String)

    A custom name for a pay schedule, defaults to the pay frequency description.



37
38
39
# File 'lib/fern_gusto/pay_schedules/types/pay_schedule.rb', line 37

def custom_name
  @custom_name
end

#day1Object (readonly)

frequencies.



23
24
25
# File 'lib/fern_gusto/pay_schedules/types/pay_schedule.rb', line 23

def day1
  @day1
end

#day2Object (readonly)

frequencies.



30
31
32
# File 'lib/fern_gusto/pay_schedules/types/pay_schedule.rb', line 30

def day2
  @day2
end

#frequencyGusto::PaySchedules::PayScheduleFrequency (readonly)

Returns The frequency that employees on this pay schedule are paid with Gusto.

Returns:



13
14
15
# File 'lib/fern_gusto/pay_schedules/types/pay_schedule.rb', line 13

def frequency
  @frequency
end

#nameObject (readonly)

employees.



35
36
37
# File 'lib/fern_gusto/pay_schedules/types/pay_schedule.rb', line 35

def name
  @name
end

#uuidString (readonly)

Returns The unique identifier of the pay schedule in Gusto.

Returns:

  • (String)

    The unique identifier of the pay schedule in Gusto.



11
12
13
# File 'lib/fern_gusto/pay_schedules/types/pay_schedule.rb', line 11

def uuid
  @uuid
end

Class Method Details

.from_json(json_object:) ⇒ Gusto::PaySchedules::PaySchedule

Parameters:

  • json_object (String)

Returns:



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/fern_gusto/pay_schedules/types/pay_schedule.rb', line 98

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  uuid = parsed_json["uuid"]
  frequency = parsed_json["frequency"]
  anchor_pay_date = parsed_json["anchor_pay_date"]
  anchor_end_of_pay_period = parsed_json["anchor_end_of_pay_period"]
  day1 = parsed_json["day_1"]
  day2 = parsed_json["day_2"]
  name = parsed_json["name"]
  custom_name = parsed_json["custom_name"]
  auto_pilot = parsed_json["auto_pilot"]
  active = parsed_json["active"]
  new(
    uuid: uuid,
    frequency: frequency,
    anchor_pay_date: anchor_pay_date,
    anchor_end_of_pay_period: anchor_end_of_pay_period,
    day1: day1,
    day2: day2,
    name: name,
    custom_name: custom_name,
    auto_pilot: auto_pilot,
    active: active,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/fern_gusto/pay_schedules/types/pay_schedule.rb', line 137

def self.validate_raw(obj:)
  obj.uuid.is_a?(String) != false || raise("Passed value for field obj.uuid is not the expected type, validation failed.")
  obj.frequency&.is_a?(Gusto::PaySchedules::PayScheduleFrequency) != false || raise("Passed value for field obj.frequency is not the expected type, validation failed.")
  obj.anchor_pay_date&.is_a?(String) != false || raise("Passed value for field obj.anchor_pay_date is not the expected type, validation failed.")
  obj.anchor_end_of_pay_period&.is_a?(String) != false || raise("Passed value for field obj.anchor_end_of_pay_period is not the expected type, validation failed.")
  obj.day1&.is_a?(Integer) != false || raise("Passed value for field obj.day1 is not the expected type, validation failed.")
  obj.day2&.is_a?(Integer) != false || raise("Passed value for field obj.day2 is not the expected type, validation failed.")
  obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
  obj.custom_name&.is_a?(String) != false || raise("Passed value for field obj.custom_name is not the expected type, validation failed.")
  obj.auto_pilot&.is_a?(Boolean) != false || raise("Passed value for field obj.auto_pilot is not the expected type, validation failed.")
  obj.active&.is_a?(Boolean) != false || raise("Passed value for field obj.active is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


128
129
130
# File 'lib/fern_gusto/pay_schedules/types/pay_schedule.rb', line 128

def to_json
  @_field_set&.to_json
end