Class: CandidApiClient::Commons::Types::StreetAddressLongZip
- Inherits:
-
Object
- Object
- CandidApiClient::Commons::Types::StreetAddressLongZip
- Defined in:
- lib/candidhealth/commons/types/street_address_long_zip.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.
-
#zip_plus_four_code ⇒ String
readonly
4-digit zip add-on code en.wikipedia.org/wiki/ZIP_Code#ZIP+4.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ CandidApiClient::Commons::Types::StreetAddressLongZip
Deserialize a JSON object to an instance of StreetAddressLongZip.
-
.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(zip_plus_four_code:, address_1:, city:, state:, zip_code:, address_2: OMIT, additional_properties: nil) ⇒ CandidApiClient::Commons::Types::StreetAddressLongZip constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of StreetAddressLongZip to a JSON object.
Constructor Details
#initialize(zip_plus_four_code:, address_1:, city:, state:, zip_code:, address_2: OMIT, additional_properties: nil) ⇒ CandidApiClient::Commons::Types::StreetAddressLongZip
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/candidhealth/commons/types/street_address_long_zip.rb', line 39 def initialize(zip_plus_four_code:, address_1:, city:, state:, zip_code:, address_2: OMIT, additional_properties: nil) @zip_plus_four_code = zip_plus_four_code @address_1 = address_1 @address_2 = address_2 if address_2 != OMIT @city = city @state = state @zip_code = zip_code @additional_properties = additional_properties @_field_set = { "zip_plus_four_code": zip_plus_four_code, "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.
24 25 26 |
# File 'lib/candidhealth/commons/types/street_address_long_zip.rb', line 24 def additional_properties @additional_properties end |
#address_1 ⇒ String (readonly)
14 15 16 |
# File 'lib/candidhealth/commons/types/street_address_long_zip.rb', line 14 def address_1 @address_1 end |
#address_2 ⇒ String (readonly)
16 17 18 |
# File 'lib/candidhealth/commons/types/street_address_long_zip.rb', line 16 def address_2 @address_2 end |
#city ⇒ String (readonly)
18 19 20 |
# File 'lib/candidhealth/commons/types/street_address_long_zip.rb', line 18 def city @city end |
#state ⇒ CandidApiClient::Commons::Types::State (readonly)
20 21 22 |
# File 'lib/candidhealth/commons/types/street_address_long_zip.rb', line 20 def state @state end |
#zip_code ⇒ String (readonly)
Returns 5-digit zip code.
22 23 24 |
# File 'lib/candidhealth/commons/types/street_address_long_zip.rb', line 22 def zip_code @zip_code end |
#zip_plus_four_code ⇒ String (readonly)
Returns 4-digit zip add-on code en.wikipedia.org/wiki/ZIP_Code#ZIP+4.
12 13 14 |
# File 'lib/candidhealth/commons/types/street_address_long_zip.rb', line 12 def zip_plus_four_code @zip_plus_four_code end |
Class Method Details
.from_json(json_object:) ⇒ CandidApiClient::Commons::Types::StreetAddressLongZip
Deserialize a JSON object to an instance of StreetAddressLongZip
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/candidhealth/commons/types/street_address_long_zip.rb', line 64 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) zip_plus_four_code = struct["zip_plus_four_code"] address_1 = struct["address1"] address_2 = struct["address2"] city = struct["city"] state = struct["state"] zip_code = struct["zip_code"] new( zip_plus_four_code: zip_plus_four_code, 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.
96 97 98 99 100 101 102 103 |
# File 'lib/candidhealth/commons/types/street_address_long_zip.rb', line 96 def self.validate_raw(obj:) obj.zip_plus_four_code.is_a?(String) != false || raise("Passed value for field obj.zip_plus_four_code is not the expected type, validation failed.") 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 StreetAddressLongZip to a JSON object
86 87 88 |
# File 'lib/candidhealth/commons/types/street_address_long_zip.rb', line 86 def to_json(*_args) @_field_set&.to_json end |