Class: CandidApiClient::Commons::Types::StreetAddressOptionalBase
- Inherits:
-
Object
- Object
- CandidApiClient::Commons::Types::StreetAddressOptionalBase
- Defined in:
- lib/candidhealth/commons/types/street_address_optional_base.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #address_1 ⇒ String readonly
- #address_2 ⇒ String readonly
- #city ⇒ String readonly
- #state ⇒ CandidApiClient::Commons::Types::State readonly
-
#zip_code ⇒ String
readonly
5-digit zip code.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ CandidApiClient::Commons::Types::StreetAddressOptionalBase
Deserialize a JSON object to an instance of StreetAddressOptionalBase.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(address_1: OMIT, address_2: OMIT, city: OMIT, state: OMIT, zip_code: OMIT, additional_properties: nil) ⇒ CandidApiClient::Commons::Types::StreetAddressOptionalBase constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of StreetAddressOptionalBase to a JSON object.
Constructor Details
#initialize(address_1: OMIT, address_2: OMIT, city: OMIT, state: OMIT, zip_code: OMIT, additional_properties: nil) ⇒ CandidApiClient::Commons::Types::StreetAddressOptionalBase
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/candidhealth/commons/types/street_address_optional_base.rb', line 36 def initialize(address_1: OMIT, address_2: OMIT, city: OMIT, state: OMIT, zip_code: OMIT, additional_properties: nil) @address_1 = address_1 if address_1 != OMIT @address_2 = address_2 if address_2 != OMIT @city = city if city != OMIT @state = state if state != OMIT @zip_code = zip_code if zip_code != OMIT @additional_properties = additional_properties @_field_set = { "address1": address_1, "address2": address_2, "city": city, "state": state, "zip_code": zip_code }.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/candidhealth/commons/types/street_address_optional_base.rb', line 22 def additional_properties @additional_properties end |
#address_1 ⇒ String (readonly)
12 13 14 |
# File 'lib/candidhealth/commons/types/street_address_optional_base.rb', line 12 def address_1 @address_1 end |
#address_2 ⇒ String (readonly)
14 15 16 |
# File 'lib/candidhealth/commons/types/street_address_optional_base.rb', line 14 def address_2 @address_2 end |
#city ⇒ String (readonly)
16 17 18 |
# File 'lib/candidhealth/commons/types/street_address_optional_base.rb', line 16 def city @city end |
#state ⇒ CandidApiClient::Commons::Types::State (readonly)
18 19 20 |
# File 'lib/candidhealth/commons/types/street_address_optional_base.rb', line 18 def state @state end |
#zip_code ⇒ String (readonly)
Returns 5-digit zip code.
20 21 22 |
# File 'lib/candidhealth/commons/types/street_address_optional_base.rb', line 20 def zip_code @zip_code end |
Class Method Details
.from_json(json_object:) ⇒ CandidApiClient::Commons::Types::StreetAddressOptionalBase
Deserialize a JSON object to an instance of StreetAddressOptionalBase
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/candidhealth/commons/types/street_address_optional_base.rb', line 59 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) address_1 = struct["address1"] address_2 = struct["address2"] city = struct["city"] state = struct["state"] zip_code = struct["zip_code"] new( address_1: address_1, address_2: address_2, city: city, state: state, zip_code: zip_code, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given
hash and check each fields type against the current object's property
definitions.
89 90 91 92 93 94 95 |
# File 'lib/candidhealth/commons/types/street_address_optional_base.rb', line 89 def self.validate_raw(obj:) obj.address_1&.is_a?(String) != false || raise("Passed value for field obj.address_1 is not the expected type, validation failed.") obj.address_2&.is_a?(String) != false || raise("Passed value for field obj.address_2 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?(CandidApiClient::Commons::Types::State) != false || raise("Passed value for field obj.state is not the expected type, validation failed.") obj.zip_code&.is_a?(String) != false || raise("Passed value for field obj.zip_code is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of StreetAddressOptionalBase to a JSON object
79 80 81 |
# File 'lib/candidhealth/commons/types/street_address_optional_base.rb', line 79 def to_json(*_args) @_field_set&.to_json end |