Class: Gusto::Contractors::ContractorAddress
- Inherits:
-
Object
- Object
- Gusto::Contractors::ContractorAddress
- Defined in:
- lib/fern_gusto/contractors/types/contractor_address.rb
Overview
The contractor’s home address.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #city ⇒ String readonly
- #country ⇒ String readonly
- #state ⇒ String readonly
- #street1 ⇒ String readonly
- #street2 ⇒ String readonly
- #zip ⇒ String readonly
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(street1: OMIT, street2: OMIT, city: OMIT, state: OMIT, zip: OMIT, country: OMIT, additional_properties: nil) ⇒ Gusto::Contractors::ContractorAddress constructor
- #to_json ⇒ String
Constructor Details
#initialize(street1: OMIT, street2: OMIT, city: OMIT, state: OMIT, zip: OMIT, country: OMIT, additional_properties: nil) ⇒ Gusto::Contractors::ContractorAddress
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/fern_gusto/contractors/types/contractor_address.rb', line 37 def initialize(street1: OMIT, street2: OMIT, city: OMIT, state: OMIT, zip: OMIT, country: OMIT, additional_properties: nil) @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 @additional_properties = additional_properties @_field_set = { "street_1": street1, "street_2": street2, "city": city, "state": state, "zip": zip, "country": country }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
22 23 24 |
# File 'lib/fern_gusto/contractors/types/contractor_address.rb', line 22 def additional_properties @additional_properties end |
#city ⇒ String (readonly)
14 15 16 |
# File 'lib/fern_gusto/contractors/types/contractor_address.rb', line 14 def city @city end |
#country ⇒ String (readonly)
20 21 22 |
# File 'lib/fern_gusto/contractors/types/contractor_address.rb', line 20 def country @country end |
#state ⇒ String (readonly)
16 17 18 |
# File 'lib/fern_gusto/contractors/types/contractor_address.rb', line 16 def state @state end |
#street1 ⇒ String (readonly)
10 11 12 |
# File 'lib/fern_gusto/contractors/types/contractor_address.rb', line 10 def street1 @street1 end |
#street2 ⇒ String (readonly)
12 13 14 |
# File 'lib/fern_gusto/contractors/types/contractor_address.rb', line 12 def street2 @street2 end |
#zip ⇒ String (readonly)
18 19 20 |
# File 'lib/fern_gusto/contractors/types/contractor_address.rb', line 18 def zip @zip end |
Class Method Details
.from_json(json_object:) ⇒ Gusto::Contractors::ContractorAddress
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/fern_gusto/contractors/types/contractor_address.rb', line 53 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) 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"] new( street1: street1, street2: street2, city: city, state: state, zip: zip, country: country, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
84 85 86 87 88 89 90 91 |
# File 'lib/fern_gusto/contractors/types/contractor_address.rb', line 84 def self.validate_raw(obj:) 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.") end |
Instance Method Details
#to_json ⇒ String
75 76 77 |
# File 'lib/fern_gusto/contractors/types/contractor_address.rb', line 75 def to_json @_field_set&.to_json end |