Class: Gusto::Companies::Company
- Inherits:
-
Object
- Object
- Gusto::Companies::Company
- Defined in:
- lib/fern_gusto/companies/types/company.rb
Overview
The representation of a company in Gusto.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#company_status ⇒ Object
readonly
must contact support.
-
#compensations ⇒ Gusto::Companies::CompanyCompensations
readonly
The available company-wide compensation rates for the company.
-
#contractor_only ⇒ Boolean
readonly
Whether the company only supports contractors.
-
#ein ⇒ String
readonly
The Federal Employer Identification Number of the company.
-
#entity_type ⇒ Gusto::Companies::CompanyEntityType
readonly
The tax payer type of the company.
-
#funding_type ⇒ Gusto::Companies::CompanyFundingType
readonly
Company’s default funding type.
-
#is_partner_managed ⇒ Boolean
readonly
Whether the company is fully managed by a partner via the API.
-
#is_suspended ⇒ Object
readonly
run payroll.
-
#join_date ⇒ String
readonly
Company’s first invoiceable event date.
-
#locations ⇒ Array<Gusto::Locations::CompanyAddress>
readonly
The locations of the company.
-
#name ⇒ String
readonly
The name of the company.
-
#pay_schedule_type ⇒ Gusto::Companies::CompanyPayScheduleType
readonly
The pay schedule assignment type.
-
#primary_payroll_admin ⇒ Gusto::Companies::CompanyPrimaryPayrollAdmin
readonly
The primary payroll admin of the company.
-
#primary_signatory ⇒ Gusto::Companies::CompanyPrimarySignatory
readonly
The primary signatory of the company.
-
#slug ⇒ String
readonly
The slug of the name of the company.
-
#tier ⇒ Object
readonly
managed companies).
-
#trade_name ⇒ String
readonly
The trade name of the company.
-
#uuid ⇒ String
readonly
A unique identifier of the company in Gusto.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(ein: OMIT, entity_type: OMIT, contractor_only: OMIT, tier: OMIT, is_suspended: OMIT, company_status: OMIT, uuid:, name: OMIT, slug: OMIT, trade_name: OMIT, is_partner_managed: OMIT, pay_schedule_type: OMIT, join_date: OMIT, funding_type: OMIT, locations: OMIT, compensations: OMIT, primary_signatory: OMIT, primary_payroll_admin: OMIT, additional_properties: nil) ⇒ Gusto::Companies::Company constructor
- #to_json ⇒ String
Constructor Details
#initialize(ein: OMIT, entity_type: OMIT, contractor_only: OMIT, tier: OMIT, is_suspended: OMIT, company_status: OMIT, uuid:, name: OMIT, slug: OMIT, trade_name: OMIT, is_partner_managed: OMIT, pay_schedule_type: OMIT, join_date: OMIT, funding_type: OMIT, locations: OMIT, compensations: OMIT, primary_signatory: OMIT, primary_payroll_admin: OMIT, additional_properties: nil) ⇒ Gusto::Companies::Company
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/fern_gusto/companies/types/company.rb', line 100 def initialize(ein: OMIT, entity_type: OMIT, contractor_only: OMIT, tier: OMIT, is_suspended: OMIT, company_status: OMIT, uuid:, name: OMIT, slug: OMIT, trade_name: OMIT, is_partner_managed: OMIT, pay_schedule_type: OMIT, join_date: OMIT, funding_type: OMIT, locations: OMIT, compensations: OMIT, primary_signatory: OMIT, primary_payroll_admin: OMIT, additional_properties: nil) @ein = ein if ein != OMIT @entity_type = entity_type if entity_type != OMIT @contractor_only = contractor_only if contractor_only != OMIT @tier = tier if tier != OMIT @is_suspended = is_suspended if is_suspended != OMIT @company_status = company_status if company_status != OMIT @uuid = uuid @name = name if name != OMIT @slug = slug if slug != OMIT @trade_name = trade_name if trade_name != OMIT @is_partner_managed = is_partner_managed if is_partner_managed != OMIT @pay_schedule_type = pay_schedule_type if pay_schedule_type != OMIT @join_date = join_date if join_date != OMIT @funding_type = funding_type if funding_type != OMIT @locations = locations if locations != OMIT @compensations = compensations if compensations != OMIT @primary_signatory = primary_signatory if primary_signatory != OMIT @primary_payroll_admin = primary_payroll_admin if primary_payroll_admin != OMIT @additional_properties = additional_properties @_field_set = { "ein": ein, "entity_type": entity_type, "contractor_only": contractor_only, "tier": tier, "is_suspended": is_suspended, "company_status": company_status, "uuid": uuid, "name": name, "slug": slug, "trade_name": trade_name, "is_partner_managed": is_partner_managed, "pay_schedule_type": pay_schedule_type, "join_date": join_date, "funding_type": funding_type, "locations": locations, "compensations": compensations, "primary_signatory": primary_signatory, "primary_payroll_admin": primary_payroll_admin }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
64 65 66 |
# File 'lib/fern_gusto/companies/types/company.rb', line 64 def additional_properties @additional_properties end |
#company_status ⇒ Object (readonly)
must contact support.
38 39 40 |
# File 'lib/fern_gusto/companies/types/company.rb', line 38 def company_status @company_status end |
#compensations ⇒ Gusto::Companies::CompanyCompensations (readonly)
Returns The available company-wide compensation rates for the company.
58 59 60 |
# File 'lib/fern_gusto/companies/types/company.rb', line 58 def compensations @compensations end |
#contractor_only ⇒ Boolean (readonly)
Returns Whether the company only supports contractors.
23 24 25 |
# File 'lib/fern_gusto/companies/types/company.rb', line 23 def contractor_only @contractor_only end |
#ein ⇒ String (readonly)
Returns The Federal Employer Identification Number of the company.
19 20 21 |
# File 'lib/fern_gusto/companies/types/company.rb', line 19 def ein @ein end |
#entity_type ⇒ Gusto::Companies::CompanyEntityType (readonly)
Returns The tax payer type of the company.
21 22 23 |
# File 'lib/fern_gusto/companies/types/company.rb', line 21 def entity_type @entity_type end |
#funding_type ⇒ Gusto::Companies::CompanyFundingType (readonly)
Returns Company’s default funding type.
54 55 56 |
# File 'lib/fern_gusto/companies/types/company.rb', line 54 def funding_type @funding_type end |
#is_partner_managed ⇒ Boolean (readonly)
Returns Whether the company is fully managed by a partner via the API.
48 49 50 |
# File 'lib/fern_gusto/companies/types/company.rb', line 48 def is_partner_managed @is_partner_managed end |
#is_suspended ⇒ Object (readonly)
run payroll.
29 30 31 |
# File 'lib/fern_gusto/companies/types/company.rb', line 29 def is_suspended @is_suspended end |
#join_date ⇒ String (readonly)
Returns Company’s first invoiceable event date.
52 53 54 |
# File 'lib/fern_gusto/companies/types/company.rb', line 52 def join_date @join_date end |
#locations ⇒ Array<Gusto::Locations::CompanyAddress> (readonly)
Returns The locations of the company.
56 57 58 |
# File 'lib/fern_gusto/companies/types/company.rb', line 56 def locations @locations end |
#name ⇒ String (readonly)
Returns The name of the company.
42 43 44 |
# File 'lib/fern_gusto/companies/types/company.rb', line 42 def name @name end |
#pay_schedule_type ⇒ Gusto::Companies::CompanyPayScheduleType (readonly)
Returns The pay schedule assignment type.
50 51 52 |
# File 'lib/fern_gusto/companies/types/company.rb', line 50 def pay_schedule_type @pay_schedule_type end |
#primary_payroll_admin ⇒ Gusto::Companies::CompanyPrimaryPayrollAdmin (readonly)
Returns The primary payroll admin of the company.
62 63 64 |
# File 'lib/fern_gusto/companies/types/company.rb', line 62 def primary_payroll_admin @primary_payroll_admin end |
#primary_signatory ⇒ Gusto::Companies::CompanyPrimarySignatory (readonly)
Returns The primary signatory of the company.
60 61 62 |
# File 'lib/fern_gusto/companies/types/company.rb', line 60 def primary_signatory @primary_signatory end |
#slug ⇒ String (readonly)
Returns The slug of the name of the company.
44 45 46 |
# File 'lib/fern_gusto/companies/types/company.rb', line 44 def slug @slug end |
#tier ⇒ Object (readonly)
managed companies).
26 27 28 |
# File 'lib/fern_gusto/companies/types/company.rb', line 26 def tier @tier end |
#trade_name ⇒ String (readonly)
Returns The trade name of the company.
46 47 48 |
# File 'lib/fern_gusto/companies/types/company.rb', line 46 def trade_name @trade_name end |
#uuid ⇒ String (readonly)
Returns A unique identifier of the company in Gusto.
40 41 42 |
# File 'lib/fern_gusto/companies/types/company.rb', line 40 def uuid @uuid end |
Class Method Details
.from_json(json_object:) ⇒ Gusto::Companies::Company
128 129 130 131 132 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 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/fern_gusto/companies/types/company.rb', line 128 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) ein = parsed_json["ein"] entity_type = parsed_json["entity_type"] contractor_only = parsed_json["contractor_only"] tier = parsed_json["tier"] is_suspended = parsed_json["is_suspended"] company_status = parsed_json["company_status"] uuid = parsed_json["uuid"] name = parsed_json["name"] slug = parsed_json["slug"] trade_name = parsed_json["trade_name"] is_partner_managed = parsed_json["is_partner_managed"] pay_schedule_type = parsed_json["pay_schedule_type"] join_date = parsed_json["join_date"] funding_type = parsed_json["funding_type"] locations = parsed_json["locations"]&.map do | item | item = item.to_json Gusto::Locations::CompanyAddress.from_json(json_object: item) end unless parsed_json["compensations"].nil? compensations = parsed_json["compensations"].to_json compensations = Gusto::Companies::CompanyCompensations.from_json(json_object: compensations) else compensations = nil end unless parsed_json["primary_signatory"].nil? primary_signatory = parsed_json["primary_signatory"].to_json primary_signatory = Gusto::Companies::CompanyPrimarySignatory.from_json(json_object: primary_signatory) else primary_signatory = nil end unless parsed_json["primary_payroll_admin"].nil? primary_payroll_admin = parsed_json["primary_payroll_admin"].to_json primary_payroll_admin = Gusto::Companies::CompanyPrimaryPayrollAdmin.from_json(json_object: primary_payroll_admin) else primary_payroll_admin = nil end new( ein: ein, entity_type: entity_type, contractor_only: contractor_only, tier: tier, is_suspended: is_suspended, company_status: company_status, uuid: uuid, name: name, slug: slug, trade_name: trade_name, is_partner_managed: is_partner_managed, pay_schedule_type: pay_schedule_type, join_date: join_date, funding_type: funding_type, locations: locations, compensations: compensations, primary_signatory: primary_signatory, primary_payroll_admin: primary_payroll_admin, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/fern_gusto/companies/types/company.rb', line 201 def self.validate_raw(obj:) obj.ein&.is_a?(String) != false || raise("Passed value for field obj.ein is not the expected type, validation failed.") obj.entity_type&.is_a?(Gusto::Companies::CompanyEntityType) != false || raise("Passed value for field obj.entity_type is not the expected type, validation failed.") obj.contractor_only&.is_a?(Boolean) != false || raise("Passed value for field obj.contractor_only is not the expected type, validation failed.") obj.tier&.is_a?(Gusto::Companies::CompanyTier) != false || raise("Passed value for field obj.tier is not the expected type, validation failed.") obj.is_suspended&.is_a?(Boolean) != false || raise("Passed value for field obj.is_suspended is not the expected type, validation failed.") obj.company_status&.is_a?(Gusto::Companies::CompanyCompanyStatus) != false || raise("Passed value for field obj.company_status is not the expected type, validation failed.") obj.uuid.is_a?(String) != false || raise("Passed value for field obj.uuid 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.slug&.is_a?(String) != false || raise("Passed value for field obj.slug is not the expected type, validation failed.") obj.trade_name&.is_a?(String) != false || raise("Passed value for field obj.trade_name is not the expected type, validation failed.") obj.is_partner_managed&.is_a?(Boolean) != false || raise("Passed value for field obj.is_partner_managed is not the expected type, validation failed.") obj.pay_schedule_type&.is_a?(Gusto::Companies::CompanyPayScheduleType) != false || raise("Passed value for field obj.pay_schedule_type is not the expected type, validation failed.") obj.join_date&.is_a?(String) != false || raise("Passed value for field obj.join_date is not the expected type, validation failed.") obj.funding_type&.is_a?(Gusto::Companies::CompanyFundingType) != false || raise("Passed value for field obj.funding_type is not the expected type, validation failed.") obj.locations&.is_a?(Array) != false || raise("Passed value for field obj.locations is not the expected type, validation failed.") obj.compensations.nil? || Gusto::Companies::CompanyCompensations.validate_raw(obj: obj.compensations) obj.primary_signatory.nil? || Gusto::Companies::CompanyPrimarySignatory.validate_raw(obj: obj.primary_signatory) obj.primary_payroll_admin.nil? || Gusto::Companies::CompanyPrimaryPayrollAdmin.validate_raw(obj: obj.primary_payroll_admin) end |
Instance Method Details
#to_json ⇒ String
192 193 194 |
# File 'lib/fern_gusto/companies/types/company.rb', line 192 def to_json @_field_set&.to_json end |