Class: Gusto::Locations::Location

Inherits:
Object
  • Object
show all
Defined in:
lib/fern_gusto/locations/types/location.rb

Overview

The representation of an address in Gusto.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uuid:, version: OMIT, company_uuid: OMIT, phone_number: OMIT, street1: OMIT, street2: OMIT, city: OMIT, state: OMIT, zip: OMIT, country: OMIT, active: OMIT, mailing_address: OMIT, filing_address: OMIT, created_at: OMIT, updated_at: OMIT, additional_properties: nil) ⇒ Gusto::Locations::Location

Parameters:

  • created_at (String) (defaults to: OMIT)

    Datetime for when location is created

  • updated_at (String) (defaults to: OMIT)

    Datetime for when location is updated

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/fern_gusto/locations/types/location.rb', line 78

def initialize(uuid:, version: OMIT, company_uuid: OMIT, phone_number: OMIT, street1: OMIT, street2: OMIT, city: OMIT, state: OMIT, zip: OMIT, country: OMIT, active: OMIT, mailing_address: OMIT, filing_address: OMIT, created_at: OMIT, updated_at: OMIT, additional_properties: nil)
  @uuid = uuid
  @version = version if version != OMIT
  @company_uuid = company_uuid if company_uuid != OMIT
  @phone_number = phone_number if phone_number != OMIT
  @street1 = street1 if street1 != OMIT
  @street2 = street2 if street2 != OMIT
  @city = city if city != OMIT
  @state = state if state != OMIT
  @zip = zip if zip != OMIT
  @country = country if country != OMIT
  @active = active if active != OMIT
  @mailing_address = mailing_address if mailing_address != OMIT
  @filing_address = filing_address if filing_address != OMIT
  @created_at = created_at if created_at != OMIT
  @updated_at = updated_at if updated_at != OMIT
  @additional_properties = additional_properties
  @_field_set = { "uuid": uuid, "version": version, "company_uuid": company_uuid, "phone_number": phone_number, "street_1": street1, "street_2": street2, "city": city, "state": state, "zip": zip, "country": country, "active": active, "mailing_address": mailing_address, "filing_address": filing_address, "created_at": created_at, "updated_at": updated_at }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#activeObject (readonly)

have historical data associated with them.



35
36
37
# File 'lib/fern_gusto/locations/types/location.rb', line 35

def active
  @active
end

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



47
48
49
# File 'lib/fern_gusto/locations/types/location.rb', line 47

def additional_properties
  @additional_properties
end

#cityString (readonly)

Returns:

  • (String)


26
27
28
# File 'lib/fern_gusto/locations/types/location.rb', line 26

def city
  @city
end

#company_uuidObject (readonly)

location belongs to a company.



17
18
19
# File 'lib/fern_gusto/locations/types/location.rb', line 17

def company_uuid
  @company_uuid
end

#countryString (readonly)

Returns:

  • (String)


32
33
34
# File 'lib/fern_gusto/locations/types/location.rb', line 32

def country
  @country
end

#created_atString (readonly)

Returns Datetime for when location is created.

Returns:

  • (String)

    Datetime for when location is created



43
44
45
# File 'lib/fern_gusto/locations/types/location.rb', line 43

def created_at
  @created_at
end

#filing_addressObject (readonly)

location belongs to a company.



41
42
43
# File 'lib/fern_gusto/locations/types/location.rb', line 41

def filing_address
  @filing_address
end

#mailing_addressObject (readonly)

location belongs to a company.



38
39
40
# File 'lib/fern_gusto/locations/types/location.rb', line 38

def mailing_address
  @mailing_address
end

#phone_numberObject (readonly)

employee locations.



20
21
22
# File 'lib/fern_gusto/locations/types/location.rb', line 20

def phone_number
  @phone_number
end

#stateString (readonly)

Returns:

  • (String)


28
29
30
# File 'lib/fern_gusto/locations/types/location.rb', line 28

def state
  @state
end

#street1String (readonly)

Returns:

  • (String)


22
23
24
# File 'lib/fern_gusto/locations/types/location.rb', line 22

def street1
  @street1
end

#street2String (readonly)

Returns:

  • (String)


24
25
26
# File 'lib/fern_gusto/locations/types/location.rb', line 24

def street2
  @street2
end

#updated_atString (readonly)

Returns Datetime for when location is updated.

Returns:

  • (String)

    Datetime for when location is updated



45
46
47
# File 'lib/fern_gusto/locations/types/location.rb', line 45

def updated_at
  @updated_at
end

#uuidString (readonly)

Returns The UUID of the location object.

Returns:

  • (String)

    The UUID of the location object.



10
11
12
# File 'lib/fern_gusto/locations/types/location.rb', line 10

def uuid
  @uuid
end

#versionObject (readonly)

on how to use this field.



14
15
16
# File 'lib/fern_gusto/locations/types/location.rb', line 14

def version
  @version
end

#zipString (readonly)

Returns:

  • (String)


30
31
32
# File 'lib/fern_gusto/locations/types/location.rb', line 30

def zip
  @zip
end

Class Method Details

.from_json(json_object:) ⇒ Gusto::Locations::Location

Parameters:

  • json_object (String)

Returns:



103
104
105
106
107
108
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
135
136
137
138
139
# File 'lib/fern_gusto/locations/types/location.rb', line 103

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  uuid = parsed_json["uuid"]
  version = parsed_json["version"]
  company_uuid = parsed_json["company_uuid"]
  phone_number = parsed_json["phone_number"]
  street1 = parsed_json["street_1"]
  street2 = parsed_json["street_2"]
  city = parsed_json["city"]
  state = parsed_json["state"]
  zip = parsed_json["zip"]
  country = parsed_json["country"]
  active = parsed_json["active"]
  mailing_address = parsed_json["mailing_address"]
  filing_address = parsed_json["filing_address"]
  created_at = parsed_json["created_at"]
  updated_at = parsed_json["updated_at"]
  new(
    uuid: uuid,
    version: version,
    company_uuid: company_uuid,
    phone_number: phone_number,
    street1: street1,
    street2: street2,
    city: city,
    state: state,
    zip: zip,
    country: country,
    active: active,
    mailing_address: mailing_address,
    filing_address: filing_address,
    created_at: created_at,
    updated_at: updated_at,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/fern_gusto/locations/types/location.rb', line 152

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.version&.is_a?(String) != false || raise("Passed value for field obj.version 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.phone_number&.is_a?(String) != false || raise("Passed value for field obj.phone_number is not the expected type, validation failed.")
  obj.street1&.is_a?(String) != false || raise("Passed value for field obj.street1 is not the expected type, validation failed.")
  obj.street2&.is_a?(String) != false || raise("Passed value for field obj.street2 is not the expected type, validation failed.")
  obj.city&.is_a?(String) != false || raise("Passed value for field obj.city is not the expected type, validation failed.")
  obj.state&.is_a?(String) != false || raise("Passed value for field obj.state is not the expected type, validation failed.")
  obj.zip&.is_a?(String) != false || raise("Passed value for field obj.zip is not the expected type, validation failed.")
  obj.country&.is_a?(String) != false || raise("Passed value for field obj.country is not the expected type, validation failed.")
  obj.active&.is_a?(Boolean) != false || raise("Passed value for field obj.active is not the expected type, validation failed.")
  obj.mailing_address&.is_a?(Boolean) != false || raise("Passed value for field obj.mailing_address is not the expected type, validation failed.")
  obj.filing_address&.is_a?(Boolean) != false || raise("Passed value for field obj.filing_address is not the expected type, validation failed.")
  obj.created_at&.is_a?(String) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.")
  obj.updated_at&.is_a?(String) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


143
144
145
# File 'lib/fern_gusto/locations/types/location.rb', line 143

def to_json
  @_field_set&.to_json
end