Class: Gusto::Contractors::Contractor
- Inherits:
-
Object
- Object
- Gusto::Contractors::Contractor
- 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
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#address ⇒ Gusto::Contractors::ContractorAddress
readonly
The contractor’s home address.
-
#business_name ⇒ Object
readonly
contractors and will be ignored for “Individual” contractors.
-
#company_uuid ⇒ String
readonly
The UUID of the company the contractor is employed by.
-
#ein ⇒ Object
readonly
“Individual” contractors.
-
#email ⇒ Object
readonly
contractors and will be ignored for “Business” contractors.
-
#file_new_hire_report ⇒ Object
readonly
contractor.
-
#first_name ⇒ Object
readonly
contractors and will be ignored for “Business” contractors.
-
#has_ein ⇒ Boolean
readonly
Whether company’s Employer Identification Number (EIN) is present.
-
#hourly_rate ⇒ Object
readonly
“Hourly”.
-
#is_active ⇒ Boolean
readonly
The status of the contractor with the company.
-
#last_name ⇒ Object
readonly
contractors and will be ignored for “Business” contractors.
-
#middle_initial ⇒ Object
readonly
contractors and will be ignored for “Business” contractors.
-
#onboarded ⇒ Boolean
readonly
The updated onboarding status for the contractor.
-
#onboarding_status ⇒ Gusto::Contractors::ContractorOnboardingStatus
readonly
One of the “onboarding_status” enum values.
-
#start_date ⇒ String
readonly
The contractor’s start date.
-
#type ⇒ Gusto::Contractors::ContractorType
readonly
The contractor’s type, either “Individual” or “Business”.
-
#uuid ⇒ String
readonly
The UUID of the contractor in Gusto.
-
#version ⇒ Object
readonly
on how to use this field.
-
#wage_type ⇒ Gusto::Contractors::ContractorWageType
readonly
The contractor’s wage type, either “Fixed” or “Hourly”.
-
#work_state ⇒ Object
readonly
This value is used when generating the new hire report.
Class Method Summary collapse
Instance Method Summary collapse
- #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 constructor
- #to_json ⇒ String
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
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_properties ⇒ OpenStruct (readonly)
Returns 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 |
#address ⇒ Gusto::Contractors::ContractorAddress (readonly)
Returns The contractor’s home address.
51 52 53 |
# File 'lib/fern_gusto/contractors/types/contractor.rb', line 51 def address @address end |
#business_name ⇒ Object (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_uuid ⇒ String (readonly)
Returns 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 |
#ein ⇒ Object (readonly)
“Individual” contractors.
42 43 44 |
# File 'lib/fern_gusto/contractors/types/contractor.rb', line 42 def ein @ein end |
#email ⇒ Object (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_report ⇒ Object (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_name ⇒ Object (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_ein ⇒ Boolean (readonly)
Returns 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_rate ⇒ Object (readonly)
“Hourly”.
54 55 56 |
# File 'lib/fern_gusto/contractors/types/contractor.rb', line 54 def hourly_rate @hourly_rate end |
#is_active ⇒ Boolean (readonly)
Returns 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_name ⇒ Object (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_initial ⇒ Object (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 |
#onboarded ⇒ Boolean (readonly)
Returns 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_status ⇒ Gusto::Contractors::ContractorOnboardingStatus (readonly)
Returns One of the “onboarding_status” enum values.
65 66 67 |
# File 'lib/fern_gusto/contractors/types/contractor.rb', line 65 def onboarding_status @onboarding_status end |
#start_date ⇒ String (readonly)
Returns The contractor’s start date.
49 50 51 |
# File 'lib/fern_gusto/contractors/types/contractor.rb', line 49 def start_date @start_date end |
#type ⇒ Gusto::Contractors::ContractorType (readonly)
Returns The contractor’s type, either “Individual” or “Business”.
26 27 28 |
# File 'lib/fern_gusto/contractors/types/contractor.rb', line 26 def type @type end |
#uuid ⇒ String (readonly)
Returns The UUID of the contractor in Gusto.
14 15 16 |
# File 'lib/fern_gusto/contractors/types/contractor.rb', line 14 def uuid @uuid end |
#version ⇒ Object (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_type ⇒ Gusto::Contractors::ContractorWageType (readonly)
Returns The contractor’s wage type, either “Fixed” or “Hourly”.
18 19 20 |
# File 'lib/fern_gusto/contractors/types/contractor.rb', line 18 def wage_type @wage_type end |
#work_state ⇒ Object (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
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
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_json ⇒ String
194 195 196 |
# File 'lib/fern_gusto/contractors/types/contractor.rb', line 194 def to_json @_field_set&.to_json end |