Class: Gusto::ContractorBody

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type: OMIT, wage_type: OMIT, start_date: OMIT, hourly_rate: OMIT, self_onboarding: OMIT, email: OMIT, first_name: OMIT, last_name: OMIT, middle_initial: OMIT, file_new_hire_report: OMIT, work_state: OMIT, ssn: OMIT, business_name: OMIT, ein: OMIT, is_active: OMIT, additional_properties: nil) ⇒ Gusto::ContractorBody

Parameters:

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/fern_gusto/types/contractor_body.rb', line 108

def initialize(type: OMIT, wage_type: OMIT, start_date: OMIT, hourly_rate: OMIT, self_onboarding: OMIT, email: OMIT, first_name: OMIT, last_name: OMIT, middle_initial: OMIT, file_new_hire_report: OMIT, work_state: OMIT, ssn: OMIT, business_name: OMIT, ein: OMIT, is_active: OMIT, additional_properties: nil)
  @type = type if type != OMIT
  @wage_type = wage_type if wage_type != OMIT
  @start_date = start_date if start_date != OMIT
  @hourly_rate = hourly_rate if hourly_rate != OMIT
  @self_onboarding = self_onboarding if self_onboarding != OMIT
  @email = email if email != OMIT
  @first_name = first_name if first_name != OMIT
  @last_name = last_name if last_name != OMIT
  @middle_initial = middle_initial if middle_initial != OMIT
  @file_new_hire_report = file_new_hire_report if file_new_hire_report != OMIT
  @work_state = work_state if work_state != OMIT
  @ssn = ssn if ssn != OMIT
  @business_name = business_name if business_name != OMIT
  @ein = ein if ein != OMIT
  @is_active = is_active if is_active != OMIT
  @additional_properties = additional_properties
  @_field_set = { "type": type, "wage_type": wage_type, "start_date": start_date, "hourly_rate": hourly_rate, "self_onboarding": self_onboarding, "email": email, "first_name": first_name, "last_name": last_name, "middle_initial": middle_initial, "file_new_hire_report": file_new_hire_report, "work_state": work_state, "ssn": ssn, "business_name": business_name, "ein": ein, "is_active": is_active }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



62
63
64
# File 'lib/fern_gusto/types/contractor_body.rb', line 62

def additional_properties
  @additional_properties
end

#business_nameObject (readonly)

contractors and will be ignored for ‘Individual` contractors.



53
54
55
# File 'lib/fern_gusto/types/contractor_body.rb', line 53

def business_name
  @business_name
end

#einObject (readonly)

‘Individual` contractors.



57
58
59
# File 'lib/fern_gusto/types/contractor_body.rb', line 57

def ein
  @ein
end

#emailString (readonly)

Returns The contractor’s email address.

Returns:

  • (String)

    The contractor’s email address.



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

def email
  @email
end

#file_new_hire_reportObject (readonly)

‘Business` contractors.



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

def file_new_hire_report
  @file_new_hire_report
end

#first_nameObject (readonly)

‘Business` contractors.



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

def first_name
  @first_name
end

#hourly_rateObject (readonly)

‘Hourly`.



17
18
19
# File 'lib/fern_gusto/types/contractor_body.rb', line 17

def hourly_rate
  @hourly_rate
end

#is_activeObject (readonly)

updating this field to true means we are setting the start date to today.



60
61
62
# File 'lib/fern_gusto/types/contractor_body.rb', line 60

def is_active
  @is_active
end

#last_nameObject (readonly)

‘Business` contractors.



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

def last_name
  @last_name
end

#middle_initialObject (readonly)

‘Business` contractors.



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

def middle_initial
  @middle_initial
end

#self_onboardingObject (readonly)

If self_onboarding is true, then email is required.



21
22
23
# File 'lib/fern_gusto/types/contractor_body.rb', line 21

def self_onboarding
  @self_onboarding
end

#ssnObject (readonly)

Social security number is needed to file the annual 1099 tax form.



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

def ssn
  @ssn
end

#start_dateString (readonly)

Returns The day when the contractor will start working for the company.

Returns:

  • (String)

    The day when the contractor will start working for the company.



14
15
16
# File 'lib/fern_gusto/types/contractor_body.rb', line 14

def start_date
  @start_date
end

#typeGusto::ContractorBodyType (readonly)

Returns The contractor type.

Returns:



10
11
12
# File 'lib/fern_gusto/types/contractor_body.rb', line 10

def type
  @type
end

#wage_typeGusto::ContractorBodyWageType (readonly)

Returns The contractor’s wage type.

Returns:



12
13
14
# File 'lib/fern_gusto/types/contractor_body.rb', line 12

def wage_type
  @wage_type
end

#work_stateObject (readonly)

‘file_new_hire_report` is true and will be ignored for `Business` contractors.



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

def work_state
  @work_state
end

Class Method Details

.from_json(json_object:) ⇒ Gusto::ContractorBody

Parameters:

  • json_object (String)

Returns:



133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/fern_gusto/types/contractor_body.rb', line 133

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  type = parsed_json["type"]
  wage_type = parsed_json["wage_type"]
  start_date = parsed_json["start_date"]
  hourly_rate = parsed_json["hourly_rate"]
  self_onboarding = parsed_json["self_onboarding"]
  email = parsed_json["email"]
  first_name = parsed_json["first_name"]
  last_name = parsed_json["last_name"]
  middle_initial = parsed_json["middle_initial"]
  file_new_hire_report = parsed_json["file_new_hire_report"]
  work_state = parsed_json["work_state"]
  ssn = parsed_json["ssn"]
  business_name = parsed_json["business_name"]
  ein = parsed_json["ein"]
  is_active = parsed_json["is_active"]
  new(
    type: type,
    wage_type: wage_type,
    start_date: start_date,
    hourly_rate: hourly_rate,
    self_onboarding: self_onboarding,
    email: email,
    first_name: first_name,
    last_name: last_name,
    middle_initial: middle_initial,
    file_new_hire_report: file_new_hire_report,
    work_state: work_state,
    ssn: ssn,
    business_name: business_name,
    ein: ein,
    is_active: is_active,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/fern_gusto/types/contractor_body.rb', line 182

def self.validate_raw(obj:)
  obj.type&.is_a?(Gusto::ContractorBodyType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
  obj.wage_type&.is_a?(Gusto::ContractorBodyWageType) != false || raise("Passed value for field obj.wage_type is not the expected type, validation failed.")
  obj.start_date&.is_a?(String) != false || raise("Passed value for field obj.start_date is not the expected type, validation failed.")
  obj.hourly_rate&.is_a?(String) != false || raise("Passed value for field obj.hourly_rate is not the expected type, validation failed.")
  obj.self_onboarding&.is_a?(Boolean) != false || raise("Passed value for field obj.self_onboarding is not the expected type, validation failed.")
  obj.email&.is_a?(String) != false || raise("Passed value for field obj.email is not the expected type, validation failed.")
  obj.first_name&.is_a?(String) != false || raise("Passed value for field obj.first_name is not the expected type, validation failed.")
  obj.last_name&.is_a?(String) != false || raise("Passed value for field obj.last_name is not the expected type, validation failed.")
  obj.middle_initial&.is_a?(String) != false || raise("Passed value for field obj.middle_initial is not the expected type, validation failed.")
  obj.file_new_hire_report&.is_a?(Boolean) != false || raise("Passed value for field obj.file_new_hire_report is not the expected type, validation failed.")
  obj.work_state&.is_a?(String) != false || raise("Passed value for field obj.work_state is not the expected type, validation failed.")
  obj.ssn&.is_a?(String) != false || raise("Passed value for field obj.ssn is not the expected type, validation failed.")
  obj.business_name&.is_a?(String) != false || raise("Passed value for field obj.business_name is not the expected type, validation failed.")
  obj.ein&.is_a?(String) != false || raise("Passed value for field obj.ein is not the expected type, validation failed.")
  obj.is_active&.is_a?(Boolean) != false || raise("Passed value for field obj.is_active is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


173
174
175
# File 'lib/fern_gusto/types/contractor_body.rb', line 173

def to_json
  @_field_set&.to_json
end