Class: Gusto::Companies::CompaniesCreateRequestCompany

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, trade_name: OMIT, ein: OMIT, contractor_only: OMIT, additional_properties: nil) ⇒ Gusto::Companies::CompaniesCreateRequestCompany

Parameters:

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



34
35
36
37
38
39
40
41
42
43
# File 'lib/fern_gusto/companies/types/companies_create_request_company.rb', line 34

def initialize(name:, trade_name: OMIT, ein: OMIT, contractor_only: OMIT, additional_properties: nil)
  @name = name
  @trade_name = trade_name if trade_name != OMIT
  @ein = ein if ein != OMIT
  @contractor_only = contractor_only if contractor_only != OMIT
  @additional_properties = additional_properties
  @_field_set = { "name": name, "trade_name": trade_name, "ein": ein, "contractor_only": contractor_only }.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



19
20
21
# File 'lib/fern_gusto/companies/types/companies_create_request_company.rb', line 19

def additional_properties
  @additional_properties
end

#contractor_onlyObject (readonly)

company will support both contractors and employees).



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

def contractor_only
  @contractor_only
end

#einString (readonly)

Returns The employer identification number (EIN) of the company.

Returns:

  • (String)

    The employer identification number (EIN) of the company.



13
14
15
# File 'lib/fern_gusto/companies/types/companies_create_request_company.rb', line 13

def ein
  @ein
end

#nameString (readonly)

Returns The legal name of the company.

Returns:

  • (String)

    The legal name of the company.



9
10
11
# File 'lib/fern_gusto/companies/types/companies_create_request_company.rb', line 9

def name
  @name
end

#trade_nameString (readonly)

Returns The name of the company.

Returns:

  • (String)

    The name of the company.



11
12
13
# File 'lib/fern_gusto/companies/types/companies_create_request_company.rb', line 11

def trade_name
  @trade_name
end

Class Method Details

.from_json(json_object:) ⇒ Gusto::Companies::CompaniesCreateRequestCompany

Parameters:

  • json_object (String)

Returns:



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/fern_gusto/companies/types/companies_create_request_company.rb', line 48

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  name = parsed_json["name"]
  trade_name = parsed_json["trade_name"]
  ein = parsed_json["ein"]
  contractor_only = parsed_json["contractor_only"]
  new(
    name: name,
    trade_name: trade_name,
    ein: ein,
    contractor_only: contractor_only,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


75
76
77
78
79
80
# File 'lib/fern_gusto/companies/types/companies_create_request_company.rb', line 75

def self.validate_raw(obj:)
  obj.name.is_a?(String) != false || raise("Passed value for field obj.name 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.ein&.is_a?(String) != false || raise("Passed value for field obj.ein 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.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


66
67
68
# File 'lib/fern_gusto/companies/types/companies_create_request_company.rb', line 66

def to_json
  @_field_set&.to_json
end