Class: CandidApiClient::PreEncounter::Patients::V1::Types::Referral
- Inherits:
-
Object
- Object
- CandidApiClient::PreEncounter::Patients::V1::Types::Referral
- Defined in:
- lib/candidhealth/pre_encounter/patients/v_1/types/referral.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #notes ⇒ String readonly
- #period ⇒ CandidApiClient::PreEncounter::Common::Types::Period readonly
- #provider ⇒ CandidApiClient::PreEncounter::Common::Types::ExternalProvider readonly
- #referral_number ⇒ String readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ CandidApiClient::PreEncounter::Patients::V1::Types::Referral
Deserialize a JSON object to an instance of Referral.
-
.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(provider:, referral_number:, period: OMIT, notes: OMIT, additional_properties: nil) ⇒ CandidApiClient::PreEncounter::Patients::V1::Types::Referral constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of Referral to a JSON object.
Constructor Details
#initialize(provider:, referral_number:, period: OMIT, notes: OMIT, additional_properties: nil) ⇒ CandidApiClient::PreEncounter::Patients::V1::Types::Referral
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/candidhealth/pre_encounter/patients/v_1/types/referral.rb', line 36 def initialize(provider:, referral_number:, period: OMIT, notes: OMIT, additional_properties: nil) @provider = provider @referral_number = referral_number @period = period if period != OMIT @notes = notes if notes != OMIT @additional_properties = additional_properties @_field_set = { "provider": provider, "referral_number": referral_number, "period": period, "notes": notes }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
23 24 25 |
# File 'lib/candidhealth/pre_encounter/patients/v_1/types/referral.rb', line 23 def additional_properties @additional_properties end |
#notes ⇒ String (readonly)
21 22 23 |
# File 'lib/candidhealth/pre_encounter/patients/v_1/types/referral.rb', line 21 def notes @notes end |
#period ⇒ CandidApiClient::PreEncounter::Common::Types::Period (readonly)
19 20 21 |
# File 'lib/candidhealth/pre_encounter/patients/v_1/types/referral.rb', line 19 def period @period end |
#provider ⇒ CandidApiClient::PreEncounter::Common::Types::ExternalProvider (readonly)
15 16 17 |
# File 'lib/candidhealth/pre_encounter/patients/v_1/types/referral.rb', line 15 def provider @provider end |
#referral_number ⇒ String (readonly)
17 18 19 |
# File 'lib/candidhealth/pre_encounter/patients/v_1/types/referral.rb', line 17 def referral_number @referral_number end |
Class Method Details
.from_json(json_object:) ⇒ CandidApiClient::PreEncounter::Patients::V1::Types::Referral
Deserialize a JSON object to an instance of Referral
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/candidhealth/pre_encounter/patients/v_1/types/referral.rb', line 56 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) if parsed_json["provider"].nil? provider = nil else provider = parsed_json["provider"].to_json provider = CandidApiClient::PreEncounter::Common::Types::ExternalProvider.from_json(json_object: provider) end referral_number = struct["referral_number"] 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 notes = struct["notes"] new( provider: provider, referral_number: referral_number, period: period, notes: notes, 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.
95 96 97 98 99 100 |
# File 'lib/candidhealth/pre_encounter/patients/v_1/types/referral.rb', line 95 def self.validate_raw(obj:) CandidApiClient::PreEncounter::Common::Types::ExternalProvider.validate_raw(obj: obj.provider) obj.referral_number.is_a?(String) != false || raise("Passed value for field obj.referral_number is not the expected type, validation failed.") obj.period.nil? || CandidApiClient::PreEncounter::Common::Types::Period.validate_raw(obj: obj.period) obj.notes&.is_a?(String) != false || raise("Passed value for field obj.notes is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of Referral to a JSON object
85 86 87 |
# File 'lib/candidhealth/pre_encounter/patients/v_1/types/referral.rb', line 85 def to_json(*_args) @_field_set&.to_json end |