Class: Gusto::Companies::CompanyPrimarySignatory

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

Overview

The primary signatory of the company.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(first_name: OMIT, middle_initial: OMIT, last_name: OMIT, phone: OMIT, email: OMIT, home_address: OMIT, additional_properties: nil) ⇒ Gusto::Companies::CompanyPrimarySignatory

Parameters:

  • first_name (String) (defaults to: OMIT)
  • middle_initial (String) (defaults to: OMIT)
  • last_name (String) (defaults to: OMIT)
  • phone (String) (defaults to: OMIT)
  • email (String) (defaults to: OMIT)
  • home_address (Gusto::Companies::CompanyPrimarySignatoryHomeAddress) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/fern_gusto/companies/types/company_primary_signatory.rb', line 38

def initialize(first_name: OMIT, middle_initial: OMIT, last_name: OMIT, phone: OMIT, email: OMIT, home_address: OMIT, additional_properties: nil)
  @first_name = first_name if first_name != OMIT
  @middle_initial = middle_initial if middle_initial != OMIT
  @last_name = last_name if last_name != OMIT
  @phone = phone if phone != OMIT
  @email = email if email != OMIT
  @home_address = home_address if home_address != OMIT
  @additional_properties = additional_properties
  @_field_set = { "first_name": first_name, "middle_initial": middle_initial, "last_name": last_name, "phone": phone, "email": email, "home_address": home_address }.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



23
24
25
# File 'lib/fern_gusto/companies/types/company_primary_signatory.rb', line 23

def additional_properties
  @additional_properties
end

#emailString (readonly)

Returns:

  • (String)


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

def email
  @email
end

#first_nameString (readonly)

Returns:

  • (String)


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

def first_name
  @first_name
end

#home_addressGusto::Companies::CompanyPrimarySignatoryHomeAddress (readonly)



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

def home_address
  @home_address
end

#last_nameString (readonly)

Returns:

  • (String)


15
16
17
# File 'lib/fern_gusto/companies/types/company_primary_signatory.rb', line 15

def last_name
  @last_name
end

#middle_initialString (readonly)

Returns:

  • (String)


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

def middle_initial
  @middle_initial
end

#phoneString (readonly)

Returns:

  • (String)


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

def phone
  @phone
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/fern_gusto/companies/types/company_primary_signatory.rb', line 54

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  first_name = parsed_json["first_name"]
  middle_initial = parsed_json["middle_initial"]
  last_name = parsed_json["last_name"]
  phone = parsed_json["phone"]
  email = parsed_json["email"]
  unless parsed_json["home_address"].nil?
    home_address = parsed_json["home_address"].to_json
    home_address = Gusto::Companies::CompanyPrimarySignatoryHomeAddress.from_json(json_object: home_address)
  else
    home_address = nil
  end
  new(
    first_name: first_name,
    middle_initial: middle_initial,
    last_name: last_name,
    phone: phone,
    email: email,
    home_address: home_address,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


90
91
92
93
94
95
96
97
# File 'lib/fern_gusto/companies/types/company_primary_signatory.rb', line 90

def self.validate_raw(obj:)
  obj.first_name&.is_a?(String) != false || raise("Passed value for field obj.first_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.last_name&.is_a?(String) != false || raise("Passed value for field obj.last_name is not the expected type, validation failed.")
  obj.phone&.is_a?(String) != false || raise("Passed value for field obj.phone 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.home_address.nil? || Gusto::Companies::CompanyPrimarySignatoryHomeAddress.validate_raw(obj: obj.home_address)
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


81
82
83
# File 'lib/fern_gusto/companies/types/company_primary_signatory.rb', line 81

def to_json
  @_field_set&.to_json
end