Class: Gusto::Companies::Company

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

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

Parameters:

  • uuid (String)

    A unique identifier of the company in Gusto.

  • name (String) (defaults to: OMIT)

    The name of the company.

  • slug (String) (defaults to: OMIT)

    The slug of the name of the company.

  • trade_name (String) (defaults to: OMIT)

    The trade name of the company.

  • is_partner_managed (Boolean) (defaults to: OMIT)

    Whether the company is fully managed by a partner via the API

  • pay_schedule_type (Gusto::Companies::CompanyPayScheduleType) (defaults to: OMIT)

    The pay schedule assignment type.

  • join_date (String) (defaults to: OMIT)

    Company’s first invoiceable event date

  • funding_type (Gusto::Companies::CompanyFundingType) (defaults to: OMIT)

    Company’s default funding type

  • locations (Array<Gusto::Locations::CompanyAddress>) (defaults to: OMIT)

    The locations of the company.

  • compensations (Gusto::Companies::CompanyCompensations) (defaults to: OMIT)

    The available company-wide compensation rates for the company.

  • primary_signatory (Gusto::Companies::CompanyPrimarySignatory) (defaults to: OMIT)

    The primary signatory of the company.

  • primary_payroll_admin (Gusto::Companies::CompanyPrimaryPayrollAdmin) (defaults to: OMIT)

    The primary payroll admin of the company.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    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_statusObject (readonly)

must contact support.



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

def company_status
  @company_status
end

#compensationsGusto::Companies::CompanyCompensations (readonly)

Returns The available company-wide compensation rates for the company.

Returns:



58
59
60
# File 'lib/fern_gusto/companies/types/company.rb', line 58

def compensations
  @compensations
end

#contractor_onlyBoolean (readonly)

Returns Whether the company only supports contractors.

Returns:

  • (Boolean)

    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

#einString (readonly)

Returns The Federal Employer Identification Number of the company.

Returns:

  • (String)

    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_typeGusto::Companies::CompanyEntityType (readonly)

Returns The tax payer type of the company.

Returns:



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

def entity_type
  @entity_type
end

#funding_typeGusto::Companies::CompanyFundingType (readonly)

Returns Company’s default funding type.

Returns:



54
55
56
# File 'lib/fern_gusto/companies/types/company.rb', line 54

def funding_type
  @funding_type
end

#is_partner_managedBoolean (readonly)

Returns Whether the company is fully managed by a partner via the API.

Returns:

  • (Boolean)

    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_suspendedObject (readonly)

run payroll.



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

def is_suspended
  @is_suspended
end

#join_dateString (readonly)

Returns Company’s first invoiceable event date.

Returns:

  • (String)

    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

#locationsArray<Gusto::Locations::CompanyAddress> (readonly)

Returns The locations of the company.

Returns:



56
57
58
# File 'lib/fern_gusto/companies/types/company.rb', line 56

def locations
  @locations
end

#nameString (readonly)

Returns The name of the company.

Returns:

  • (String)

    The name of the company.



42
43
44
# File 'lib/fern_gusto/companies/types/company.rb', line 42

def name
  @name
end

#pay_schedule_typeGusto::Companies::CompanyPayScheduleType (readonly)

Returns The pay schedule assignment type.

Returns:



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

def pay_schedule_type
  @pay_schedule_type
end

#primary_payroll_adminGusto::Companies::CompanyPrimaryPayrollAdmin (readonly)

Returns The primary payroll admin of the company.

Returns:



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

def primary_payroll_admin
  @primary_payroll_admin
end

#primary_signatoryGusto::Companies::CompanyPrimarySignatory (readonly)

Returns The primary signatory of the company.

Returns:



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

def primary_signatory
  @primary_signatory
end

#slugString (readonly)

Returns The slug of the name of the company.

Returns:

  • (String)

    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

#tierObject (readonly)

managed companies).



26
27
28
# File 'lib/fern_gusto/companies/types/company.rb', line 26

def tier
  @tier
end

#trade_nameString (readonly)

Returns The trade name of the company.

Returns:

  • (String)

    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

#uuidString (readonly)

Returns A unique identifier of the company in Gusto.

Returns:

  • (String)

    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

Parameters:

  • json_object (String)

Returns:



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

Parameters:

  • obj (Object)

Returns:

  • (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_jsonString

Returns:

  • (String)


192
193
194
# File 'lib/fern_gusto/companies/types/company.rb', line 192

def to_json
  @_field_set&.to_json
end