Class: Gusto::Garnishment

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

Overview

that are repaid via garnishments.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uuid:, version: OMIT, employee_uuid: OMIT, active: OMIT, amount: OMIT, description: OMIT, court_ordered: OMIT, times: OMIT, recurring: OMIT, annual_maximum: OMIT, pay_period_maximum: OMIT, deduct_as_percentage: OMIT, garnishment_type: OMIT, child_support: OMIT, additional_properties: nil) ⇒ Gusto::Garnishment

Parameters:

  • garnishment_type (Gusto::GarnishmentGarnishmentType) (defaults to: OMIT)

    The specific type of garnishment for court ordered garnishments.

  • child_support (Gusto::GarnishmentChildSupport) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/fern_gusto/types/garnishment.rb', line 79

def initialize(uuid:, version: OMIT, employee_uuid: OMIT, active: OMIT, amount: OMIT, description: OMIT, court_ordered: OMIT, times: OMIT, recurring: OMIT, annual_maximum: OMIT, pay_period_maximum: OMIT, deduct_as_percentage: OMIT, garnishment_type: OMIT, child_support: OMIT, additional_properties: nil)
  @uuid = uuid
  @version = version if version != OMIT
  @employee_uuid = employee_uuid if employee_uuid != OMIT
  @active = active if active != OMIT
  @amount = amount if amount != OMIT
  @description = description if description != OMIT
  @court_ordered = court_ordered if court_ordered != OMIT
  @times = times if times != OMIT
  @recurring = recurring if recurring != OMIT
  @annual_maximum = annual_maximum if annual_maximum != OMIT
  @pay_period_maximum = pay_period_maximum if pay_period_maximum != OMIT
  @deduct_as_percentage = deduct_as_percentage if deduct_as_percentage != OMIT
  @garnishment_type = garnishment_type if garnishment_type != OMIT
  @child_support = child_support if child_support != OMIT
  @additional_properties = additional_properties
  @_field_set = { "uuid": uuid, "version": version, "employee_uuid": employee_uuid, "active": active, "amount": amount, "description": description, "court_ordered": court_ordered, "times": times, "recurring": recurring, "annual_maximum": annual_maximum, "pay_period_maximum": pay_period_maximum, "deduct_as_percentage": deduct_as_percentage, "garnishment_type": garnishment_type, "child_support": child_support }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#activeBoolean (readonly)

Returns Whether or not this garnishment is currently active.

Returns:

  • (Boolean)

    Whether or not this garnishment is currently active.



24
25
26
# File 'lib/fern_gusto/types/garnishment.rb', line 24

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



50
51
52
# File 'lib/fern_gusto/types/garnishment.rb', line 50

def additional_properties
  @additional_properties
end

#amountObject (readonly)

Represented as a float, e.g. “8.00”.



27
28
29
# File 'lib/fern_gusto/types/garnishment.rb', line 27

def amount
  @amount
end

#annual_maximumObject (readonly)

as a float, e.g. “200.00”.



38
39
40
# File 'lib/fern_gusto/types/garnishment.rb', line 38

def annual_maximum
  @annual_maximum
end

#child_supportGusto::GarnishmentChildSupport (readonly)



48
49
50
# File 'lib/fern_gusto/types/garnishment.rb', line 48

def child_support
  @child_support
end

#court_orderedBoolean (readonly)

Returns Whether the garnishment is court ordered.

Returns:

  • (Boolean)

    Whether the garnishment is court ordered.



31
32
33
# File 'lib/fern_gusto/types/garnishment.rb', line 31

def court_ordered
  @court_ordered
end

#deduct_as_percentageObject (readonly)

period.



44
45
46
# File 'lib/fern_gusto/types/garnishment.rb', line 44

def deduct_as_percentage
  @deduct_as_percentage
end

#descriptionString (readonly)

Returns The description of the garnishment.

Returns:

  • (String)

    The description of the garnishment.



29
30
31
# File 'lib/fern_gusto/types/garnishment.rb', line 29

def description
  @description
end

#employee_uuidString (readonly)

Returns The UUID of the employee to which this garnishment belongs.

Returns:

  • (String)

    The UUID of the employee to which this garnishment belongs.



22
23
24
# File 'lib/fern_gusto/types/garnishment.rb', line 22

def employee_uuid
  @employee_uuid
end

#garnishment_typeGusto::GarnishmentGarnishmentType (readonly)

Returns The specific type of garnishment for court ordered garnishments.

Returns:



46
47
48
# File 'lib/fern_gusto/types/garnishment.rb', line 46

def garnishment_type
  @garnishment_type
end

#pay_period_maximumObject (readonly)

Represented as a float, e.g. “16.00”.



41
42
43
# File 'lib/fern_gusto/types/garnishment.rb', line 41

def pay_period_maximum
  @pay_period_maximum
end

#recurringBoolean (readonly)

Returns Whether the garnishment should recur indefinitely.

Returns:

  • (Boolean)

    Whether the garnishment should recur indefinitely.



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

def recurring
  @recurring
end

#timesInteger (readonly)

Returns The number of times to apply the garnishment. Ignored if recurring is true.

Returns:

  • (Integer)

    The number of times to apply the garnishment. Ignored if recurring is true.



33
34
35
# File 'lib/fern_gusto/types/garnishment.rb', line 33

def times
  @times
end

#uuidString (readonly)

Returns The UUID of the garnishment in Gusto.

Returns:

  • (String)

    The UUID of the garnishment in Gusto.



16
17
18
# File 'lib/fern_gusto/types/garnishment.rb', line 16

def uuid
  @uuid
end

#versionObject (readonly)

on how to use this field.



20
21
22
# File 'lib/fern_gusto/types/garnishment.rb', line 20

def version
  @version
end

Class Method Details

.from_json(json_object:) ⇒ Gusto::Garnishment

Parameters:

  • json_object (String)

Returns:



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/fern_gusto/types/garnishment.rb', line 103

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  uuid = parsed_json["uuid"]
  version = parsed_json["version"]
  employee_uuid = parsed_json["employee_uuid"]
  active = parsed_json["active"]
  amount = parsed_json["amount"]
  description = parsed_json["description"]
  court_ordered = parsed_json["court_ordered"]
  times = parsed_json["times"]
  recurring = parsed_json["recurring"]
  annual_maximum = parsed_json["annual_maximum"]
  pay_period_maximum = parsed_json["pay_period_maximum"]
  deduct_as_percentage = parsed_json["deduct_as_percentage"]
  garnishment_type = parsed_json["garnishment_type"]
  unless parsed_json["child_support"].nil?
    child_support = parsed_json["child_support"].to_json
    child_support = Gusto::GarnishmentChildSupport.from_json(json_object: child_support)
  else
    child_support = nil
  end
  new(
    uuid: uuid,
    version: version,
    employee_uuid: employee_uuid,
    active: active,
    amount: amount,
    description: description,
    court_ordered: court_ordered,
    times: times,
    recurring: recurring,
    annual_maximum: annual_maximum,
    pay_period_maximum: pay_period_maximum,
    deduct_as_percentage: deduct_as_percentage,
    garnishment_type: garnishment_type,
    child_support: child_support,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/fern_gusto/types/garnishment.rb', line 155

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.version&.is_a?(String) != false || raise("Passed value for field obj.version is not the expected type, validation failed.")
  obj.employee_uuid&.is_a?(String) != false || raise("Passed value for field obj.employee_uuid 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.")
  obj.amount&.is_a?(String) != false || raise("Passed value for field obj.amount is not the expected type, validation failed.")
  obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
  obj.court_ordered&.is_a?(Boolean) != false || raise("Passed value for field obj.court_ordered is not the expected type, validation failed.")
  obj.times&.is_a?(Integer) != false || raise("Passed value for field obj.times is not the expected type, validation failed.")
  obj.recurring&.is_a?(Boolean) != false || raise("Passed value for field obj.recurring is not the expected type, validation failed.")
  obj.annual_maximum&.is_a?(String) != false || raise("Passed value for field obj.annual_maximum is not the expected type, validation failed.")
  obj.pay_period_maximum&.is_a?(String) != false || raise("Passed value for field obj.pay_period_maximum is not the expected type, validation failed.")
  obj.deduct_as_percentage&.is_a?(Boolean) != false || raise("Passed value for field obj.deduct_as_percentage is not the expected type, validation failed.")
  obj.garnishment_type&.is_a?(Gusto::GarnishmentGarnishmentType) != false || raise("Passed value for field obj.garnishment_type is not the expected type, validation failed.")
  obj.child_support.nil? || Gusto::GarnishmentChildSupport.validate_raw(obj: obj.child_support)
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


146
147
148
# File 'lib/fern_gusto/types/garnishment.rb', line 146

def to_json
  @_field_set&.to_json
end