Class: Gusto::Contractors::Contractor

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

Overview

The representation of a contractor (individual or business) in Gusto.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uuid:, company_uuid: OMIT, wage_type: OMIT, is_active: OMIT, version: OMIT, type: OMIT, first_name: OMIT, last_name: OMIT, middle_initial: OMIT, business_name: OMIT, ein: OMIT, has_ein: OMIT, email: OMIT, start_date: OMIT, address: OMIT, hourly_rate: OMIT, file_new_hire_report: OMIT, work_state: OMIT, onboarded: OMIT, onboarding_status: OMIT, additional_properties: nil) ⇒ Gusto::Contractors::Contractor

Parameters:

  • onboarded (Boolean) (defaults to: OMIT)

    The updated onboarding status for the contractor

  • onboarding_status (Gusto::Contractors::ContractorOnboardingStatus) (defaults to: OMIT)

    One of the “onboarding_status” enum values.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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
# File 'lib/fern_gusto/contractors/types/contractor.rb', line 109

def initialize(uuid:, company_uuid: OMIT, wage_type: OMIT, is_active: OMIT, version: OMIT, type: OMIT, first_name: OMIT, last_name: OMIT, middle_initial: OMIT, business_name: OMIT, ein: OMIT, has_ein: OMIT, email: OMIT, start_date: OMIT, address: OMIT, hourly_rate: OMIT, file_new_hire_report: OMIT, work_state: OMIT, onboarded: OMIT, onboarding_status: OMIT, additional_properties: nil)
  @uuid = uuid
  @company_uuid = company_uuid if company_uuid != OMIT
  @wage_type = wage_type if wage_type != OMIT
  @is_active = is_active if is_active != OMIT
  @version = version if version != OMIT
  @type = type if type != 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
  @business_name = business_name if business_name != OMIT
  @ein = ein if ein != OMIT
  @has_ein = has_ein if has_ein != OMIT
  @email = email if email != OMIT
  @start_date = start_date if start_date != OMIT
  @address = address if address != OMIT
  @hourly_rate = hourly_rate if hourly_rate != OMIT
  @file_new_hire_report = file_new_hire_report if file_new_hire_report != OMIT
  @work_state = work_state if work_state != OMIT
  @onboarded = onboarded if onboarded != OMIT
  @onboarding_status = onboarding_status if onboarding_status != OMIT
  @additional_properties = additional_properties
  @_field_set = { "uuid": uuid, "company_uuid": company_uuid, "wage_type": wage_type, "is_active": is_active, "version": version, "type": type, "first_name": first_name, "last_name": last_name, "middle_initial": middle_initial, "business_name": business_name, "ein": ein, "has_ein": has_ein, "email": email, "start_date": start_date, "address": address, "hourly_rate": hourly_rate, "file_new_hire_report": file_new_hire_report, "work_state": work_state, "onboarded": onboarded, "onboarding_status": onboarding_status }.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



67
68
69
# File 'lib/fern_gusto/contractors/types/contractor.rb', line 67

def additional_properties
  @additional_properties
end

#addressGusto::Contractors::ContractorAddress (readonly)

Returns The contractor’s home address.

Returns:



51
52
53
# File 'lib/fern_gusto/contractors/types/contractor.rb', line 51

def address
  @address
end

#business_nameObject (readonly)

contractors and will be ignored for “Individual” contractors.



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

def business_name
  @business_name
end

#company_uuidString (readonly)

Returns The UUID of the company the contractor is employed by.

Returns:

  • (String)

    The UUID of the company the contractor is employed by.



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

def company_uuid
  @company_uuid
end

#einObject (readonly)

“Individual” contractors.



42
43
44
# File 'lib/fern_gusto/contractors/types/contractor.rb', line 42

def ein
  @ein
end

#emailObject (readonly)

contractors and will be ignored for “Business” contractors.



47
48
49
# File 'lib/fern_gusto/contractors/types/contractor.rb', line 47

def email
  @email
end

#file_new_hire_reportObject (readonly)

contractor



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

def file_new_hire_report
  @file_new_hire_report
end

#first_nameObject (readonly)

contractors and will be ignored for “Business” contractors.



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

def first_name
  @first_name
end

#has_einBoolean (readonly)

Returns Whether company’s Employer Identification Number (EIN) is present.

Returns:

  • (Boolean)

    Whether company’s Employer Identification Number (EIN) is present



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

def has_ein
  @has_ein
end

#hourly_rateObject (readonly)

“Hourly”.



54
55
56
# File 'lib/fern_gusto/contractors/types/contractor.rb', line 54

def hourly_rate
  @hourly_rate
end

#is_activeBoolean (readonly)

Returns The status of the contractor with the company.

Returns:

  • (Boolean)

    The status of the contractor with the company.



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

def is_active
  @is_active
end

#last_nameObject (readonly)

contractors and will be ignored for “Business” contractors.



32
33
34
# File 'lib/fern_gusto/contractors/types/contractor.rb', line 32

def last_name
  @last_name
end

#middle_initialObject (readonly)

contractors and will be ignored for “Business” contractors.



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

def middle_initial
  @middle_initial
end

#onboardedBoolean (readonly)

Returns The updated onboarding status for the contractor.

Returns:

  • (Boolean)

    The updated onboarding status for the contractor



63
64
65
# File 'lib/fern_gusto/contractors/types/contractor.rb', line 63

def onboarded
  @onboarded
end

#onboarding_statusGusto::Contractors::ContractorOnboardingStatus (readonly)

Returns One of the “onboarding_status” enum values.

Returns:



65
66
67
# File 'lib/fern_gusto/contractors/types/contractor.rb', line 65

def onboarding_status
  @onboarding_status
end

#start_dateString (readonly)

Returns The contractor’s start date.

Returns:

  • (String)

    The contractor’s start date.



49
50
51
# File 'lib/fern_gusto/contractors/types/contractor.rb', line 49

def start_date
  @start_date
end

#typeGusto::Contractors::ContractorType (readonly)

Returns The contractor’s type, either “Individual” or “Business”.

Returns:



26
27
28
# File 'lib/fern_gusto/contractors/types/contractor.rb', line 26

def type
  @type
end

#uuidString (readonly)

Returns The UUID of the contractor in Gusto.

Returns:

  • (String)

    The UUID of the contractor in Gusto.



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

def uuid
  @uuid
end

#versionObject (readonly)

on how to use this field.



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

def version
  @version
end

#wage_typeGusto::Contractors::ContractorWageType (readonly)

Returns The contractor’s wage type, either “Fixed” or “Hourly”.

Returns:



18
19
20
# File 'lib/fern_gusto/contractors/types/contractor.rb', line 18

def wage_type
  @wage_type
end

#work_stateObject (readonly)

This value is used when generating the new hire report.



61
62
63
# File 'lib/fern_gusto/contractors/types/contractor.rb', line 61

def work_state
  @work_state
end

Class Method Details

.from_json(json_object:) ⇒ Gusto::Contractors::Contractor

Parameters:

  • json_object (String)

Returns:



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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/fern_gusto/contractors/types/contractor.rb', line 139

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  uuid = parsed_json["uuid"]
  company_uuid = parsed_json["company_uuid"]
  wage_type = parsed_json["wage_type"]
  is_active = parsed_json["is_active"]
  version = parsed_json["version"]
  type = parsed_json["type"]
  first_name = parsed_json["first_name"]
  last_name = parsed_json["last_name"]
  middle_initial = parsed_json["middle_initial"]
  business_name = parsed_json["business_name"]
  ein = parsed_json["ein"]
  has_ein = parsed_json["has_ein"]
  email = parsed_json["email"]
  start_date = parsed_json["start_date"]
  unless parsed_json["address"].nil?
    address = parsed_json["address"].to_json
    address = Gusto::Contractors::ContractorAddress.from_json(json_object: address)
  else
    address = nil
  end
  hourly_rate = parsed_json["hourly_rate"]
  file_new_hire_report = parsed_json["file_new_hire_report"]
  work_state = parsed_json["work_state"]
  onboarded = parsed_json["onboarded"]
  onboarding_status = parsed_json["onboarding_status"]
  new(
    uuid: uuid,
    company_uuid: company_uuid,
    wage_type: wage_type,
    is_active: is_active,
    version: version,
    type: type,
    first_name: first_name,
    last_name: last_name,
    middle_initial: middle_initial,
    business_name: business_name,
    ein: ein,
    has_ein: has_ein,
    email: email,
    start_date: start_date,
    address: address,
    hourly_rate: hourly_rate,
    file_new_hire_report: file_new_hire_report,
    work_state: work_state,
    onboarded: onboarded,
    onboarding_status: onboarding_status,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/fern_gusto/contractors/types/contractor.rb', line 203

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.company_uuid&.is_a?(String) != false || raise("Passed value for field obj.company_uuid is not the expected type, validation failed.")
  obj.wage_type&.is_a?(Gusto::Contractors::ContractorWageType) != false || raise("Passed value for field obj.wage_type 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.")
  obj.version&.is_a?(String) != false || raise("Passed value for field obj.version is not the expected type, validation failed.")
  obj.type&.is_a?(Gusto::Contractors::ContractorType) != false || raise("Passed value for field obj.type 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.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.has_ein&.is_a?(Boolean) != false || raise("Passed value for field obj.has_ein 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.start_date&.is_a?(String) != false || raise("Passed value for field obj.start_date is not the expected type, validation failed.")
  obj.address.nil? || Gusto::Contractors::ContractorAddress.validate_raw(obj: obj.address)
  obj.hourly_rate&.is_a?(String) != false || raise("Passed value for field obj.hourly_rate 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.onboarded&.is_a?(Boolean) != false || raise("Passed value for field obj.onboarded is not the expected type, validation failed.")
  obj.onboarding_status&.is_a?(Gusto::Contractors::ContractorOnboardingStatus) != false || raise("Passed value for field obj.onboarding_status is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


194
195
196
# File 'lib/fern_gusto/contractors/types/contractor.rb', line 194

def to_json
  @_field_set&.to_json
end