Class: CandidApiClient::PreEncounter::Coverages::V1::Types::Subscriber
- Inherits:
-
Object
- Object
- CandidApiClient::PreEncounter::Coverages::V1::Types::Subscriber
- Defined in:
- lib/candidhealth/pre_encounter/coverages/v_1/types/subscriber.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #address ⇒ CandidApiClient::PreEncounter::Common::Types::Address readonly
- #biological_sex ⇒ CandidApiClient::PreEncounter::Common::Types::Sex readonly
- #date_of_birth ⇒ Date readonly
- #name ⇒ CandidApiClient::PreEncounter::Common::Types::HumanName readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ CandidApiClient::PreEncounter::Coverages::V1::Types::Subscriber
Deserialize a JSON object to an instance of Subscriber.
-
.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(name:, date_of_birth:, biological_sex:, address: OMIT, additional_properties: nil) ⇒ CandidApiClient::PreEncounter::Coverages::V1::Types::Subscriber constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of Subscriber to a JSON object.
Constructor Details
#initialize(name:, date_of_birth:, biological_sex:, address: OMIT, additional_properties: nil) ⇒ CandidApiClient::PreEncounter::Coverages::V1::Types::Subscriber
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/subscriber.rb', line 38 def initialize(name:, date_of_birth:, biological_sex:, address: OMIT, additional_properties: nil) @name = name @date_of_birth = date_of_birth @biological_sex = biological_sex @address = address if address != OMIT @additional_properties = additional_properties @_field_set = { "name": name, "date_of_birth": date_of_birth, "biological_sex": biological_sex, "address": address }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
25 26 27 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/subscriber.rb', line 25 def additional_properties @additional_properties end |
#address ⇒ CandidApiClient::PreEncounter::Common::Types::Address (readonly)
23 24 25 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/subscriber.rb', line 23 def address @address end |
#biological_sex ⇒ CandidApiClient::PreEncounter::Common::Types::Sex (readonly)
21 22 23 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/subscriber.rb', line 21 def biological_sex @biological_sex end |
#date_of_birth ⇒ Date (readonly)
19 20 21 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/subscriber.rb', line 19 def date_of_birth @date_of_birth end |
#name ⇒ CandidApiClient::PreEncounter::Common::Types::HumanName (readonly)
17 18 19 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/subscriber.rb', line 17 def name @name end |
Class Method Details
.from_json(json_object:) ⇒ CandidApiClient::PreEncounter::Coverages::V1::Types::Subscriber
Deserialize a JSON object to an instance of Subscriber
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/subscriber.rb', line 58 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) if parsed_json["name"].nil? name = nil else name = parsed_json["name"].to_json name = CandidApiClient::PreEncounter::Common::Types::HumanName.from_json(json_object: name) end date_of_birth = (Date.parse(parsed_json["date_of_birth"]) unless parsed_json["date_of_birth"].nil?) biological_sex = struct["biological_sex"] if parsed_json["address"].nil? address = nil else address = parsed_json["address"].to_json address = CandidApiClient::PreEncounter::Common::Types::Address.from_json(json_object: address) end new( name: name, date_of_birth: date_of_birth, biological_sex: biological_sex, address: address, 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.
97 98 99 100 101 102 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/subscriber.rb', line 97 def self.validate_raw(obj:) CandidApiClient::PreEncounter::Common::Types::HumanName.validate_raw(obj: obj.name) obj.date_of_birth.is_a?(Date) != false || raise("Passed value for field obj.date_of_birth is not the expected type, validation failed.") obj.biological_sex.is_a?(CandidApiClient::PreEncounter::Common::Types::Sex) != false || raise("Passed value for field obj.biological_sex is not the expected type, validation failed.") obj.address.nil? || CandidApiClient::PreEncounter::Common::Types::Address.validate_raw(obj: obj.address) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of Subscriber to a JSON object
87 88 89 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/subscriber.rb', line 87 def to_json(*_args) @_field_set&.to_json end |