Class: CandidApiClient::PreEncounter::Common::Types::Address
- Inherits:
-
Object
- Object
- CandidApiClient::PreEncounter::Common::Types::Address
- Defined in:
- lib/candidhealth/pre_encounter/common/types/address.rb
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
- #line ⇒ Array<String> readonly
- #period ⇒ CandidApiClient::PreEncounter::Common::Types::Period readonly
- #postal_code ⇒ String readonly
- #state ⇒ String readonly
- #use ⇒ CandidApiClient::PreEncounter::Common::Types::AddressUse readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ CandidApiClient::PreEncounter::Common::Types::Address
Deserialize a JSON object to an instance of Address.
-
.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(use:, line:, city:, state:, postal_code:, country:, period: OMIT, additional_properties: nil) ⇒ CandidApiClient::PreEncounter::Common::Types::Address constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of Address to a JSON object.
Constructor Details
#initialize(use:, line:, city:, state:, postal_code:, country:, period: OMIT, additional_properties: nil) ⇒ CandidApiClient::PreEncounter::Common::Types::Address
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/candidhealth/pre_encounter/common/types/address.rb', line 44 def initialize(use:, line:, city:, state:, postal_code:, country:, period: OMIT, additional_properties: nil) @use = use @line = line @city = city @state = state @postal_code = postal_code @country = country @period = period if period != OMIT @additional_properties = additional_properties @_field_set = { "use": use, "line": line, "city": city, "state": state, "postal_code": postal_code, "country": country, "period": period }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
28 29 30 |
# File 'lib/candidhealth/pre_encounter/common/types/address.rb', line 28 def additional_properties @additional_properties end |
#city ⇒ String (readonly)
18 19 20 |
# File 'lib/candidhealth/pre_encounter/common/types/address.rb', line 18 def city @city end |
#country ⇒ String (readonly)
24 25 26 |
# File 'lib/candidhealth/pre_encounter/common/types/address.rb', line 24 def country @country end |
#line ⇒ Array<String> (readonly)
16 17 18 |
# File 'lib/candidhealth/pre_encounter/common/types/address.rb', line 16 def line @line end |
#period ⇒ CandidApiClient::PreEncounter::Common::Types::Period (readonly)
26 27 28 |
# File 'lib/candidhealth/pre_encounter/common/types/address.rb', line 26 def period @period end |
#postal_code ⇒ String (readonly)
22 23 24 |
# File 'lib/candidhealth/pre_encounter/common/types/address.rb', line 22 def postal_code @postal_code end |
#state ⇒ String (readonly)
20 21 22 |
# File 'lib/candidhealth/pre_encounter/common/types/address.rb', line 20 def state @state end |
#use ⇒ CandidApiClient::PreEncounter::Common::Types::AddressUse (readonly)
14 15 16 |
# File 'lib/candidhealth/pre_encounter/common/types/address.rb', line 14 def use @use end |
Class Method Details
.from_json(json_object:) ⇒ CandidApiClient::PreEncounter::Common::Types::Address
Deserialize a JSON object to an instance of Address
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/candidhealth/pre_encounter/common/types/address.rb', line 70 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) use = struct["use"] line = struct["line"] city = struct["city"] state = struct["state"] postal_code = struct["postal_code"] country = struct["country"] if parsed_json["period"].nil? period = nil else period = parsed_json["period"].to_json period = CandidApiClient::PreEncounter::Common::Types::Period.from_json(json_object: period) end new( use: use, line: line, city: city, state: state, postal_code: postal_code, country: country, period: period, 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.
110 111 112 113 114 115 116 117 118 |
# File 'lib/candidhealth/pre_encounter/common/types/address.rb', line 110 def self.validate_raw(obj:) obj.use.is_a?(CandidApiClient::PreEncounter::Common::Types::AddressUse) != false || raise("Passed value for field obj.use is not the expected type, validation failed.") obj.line.is_a?(Array) != false || raise("Passed value for field obj.line 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.postal_code.is_a?(String) != false || raise("Passed value for field obj.postal_code 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.period.nil? || CandidApiClient::PreEncounter::Common::Types::Period.validate_raw(obj: obj.period) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of Address to a JSON object
100 101 102 |
# File 'lib/candidhealth/pre_encounter/common/types/address.rb', line 100 def to_json(*_args) @_field_set&.to_json end |