Class: CandidApiClient::PreEncounter::Coverages::V1::Types::MutableCoverage

Inherits:
Object
  • Object
show all
Defined in:
lib/candidhealth/pre_encounter/coverages/v_1/types/mutable_coverage.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status:, subscriber:, relationship:, patient:, insurance_plan:, verified:, eligibility_checks: OMIT, latest_eligibility_check: OMIT, benefits: OMIT, additional_properties: nil) ⇒ CandidApiClient::PreEncounter::Coverages::V1::Types::MutableCoverage

Parameters:



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/mutable_coverage.rb', line 62

def initialize(status:, subscriber:, relationship:, patient:, insurance_plan:, verified:,
               eligibility_checks: OMIT, latest_eligibility_check: OMIT, benefits: OMIT, additional_properties: nil)
  @status = status
  @subscriber = subscriber
  @relationship = relationship
  @patient = patient
  @insurance_plan = insurance_plan
  @verified = verified
  @eligibility_checks = eligibility_checks if eligibility_checks != OMIT
  @latest_eligibility_check = latest_eligibility_check if latest_eligibility_check != OMIT
  @benefits = benefits if benefits != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "status": status,
    "subscriber": subscriber,
    "relationship": relationship,
    "patient": patient,
    "insurance_plan": insurance_plan,
    "verified": verified,
    "eligibility_checks": eligibility_checks,
    "latest_eligibility_check": latest_eligibility_check,
    "benefits": benefits
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



41
42
43
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/mutable_coverage.rb', line 41

def additional_properties
  @additional_properties
end

#benefitsCandidApiClient::PreEncounter::Coverages::V1::Types::CoverageBenefits (readonly)

Returns The eligibility of the patient for the coverage, manually verified by users.

Returns:



39
40
41
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/mutable_coverage.rb', line 39

def benefits
  @benefits
end

#eligibility_checksArray<CandidApiClient::PreEncounter::Coverages::V1::Types::EligibilityCheckMetadata> (readonly)

Returns A list of eligibility check metadata that have been initiated on this coverage.

Returns:



35
36
37
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/mutable_coverage.rb', line 35

def eligibility_checks
  @eligibility_checks
end

#insurance_planCandidApiClient::PreEncounter::Coverages::V1::Types::InsurancePlan (readonly)



31
32
33
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/mutable_coverage.rb', line 31

def insurance_plan
  @insurance_plan
end

#latest_eligibility_checkCandidApiClient::PreEncounter::Coverages::V1::Types::LatestEligibilityCheck (readonly)

Returns The latest eligibility check metadata that has been initiated on this coverage.

Returns:



37
38
39
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/mutable_coverage.rb', line 37

def latest_eligibility_check
  @latest_eligibility_check
end

#patientString (readonly)

Returns The patient who benefits from the insurance coverage.

Returns:

  • (String)

    The patient who benefits from the insurance coverage



29
30
31
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/mutable_coverage.rb', line 29

def patient
  @patient
end

#relationshipCandidApiClient::PreEncounter::Common::Types::Relationship (readonly)

Returns The relationship of beneficiary (patient) to the subscriber. hl7.org/fhir/valueset-relationship.html.

Returns:



27
28
29
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/mutable_coverage.rb', line 27

def relationship
  @relationship
end

#statusCandidApiClient::PreEncounter::Coverages::V1::Types::CoverageStatus (readonly)

Returns The status indiciating if the coverage is active or not.

Returns:



20
21
22
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/mutable_coverage.rb', line 20

def status
  @status
end

#subscriberCandidApiClient::PreEncounter::Coverages::V1::Types::Subscriber (readonly)

Returns The party who has signed-up for or ‘owns’ the contractual relationship to the policy or to whom the benefit of the policy for services rendered to them or their family is due.

Returns:



24
25
26
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/mutable_coverage.rb', line 24

def subscriber
  @subscriber
end

#verifiedBoolean (readonly)

Returns A boolean indicating if the coverage has been verified by a user.

Returns:

  • (Boolean)

    A boolean indicating if the coverage has been verified by a user.



33
34
35
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/mutable_coverage.rb', line 33

def verified
  @verified
end

Class Method Details

.from_json(json_object:) ⇒ CandidApiClient::PreEncounter::Coverages::V1::Types::MutableCoverage

Deserialize a JSON object to an instance of MutableCoverage

Parameters:

  • json_object (String)

Returns:



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/mutable_coverage.rb', line 93

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  status = struct["status"]
  if parsed_json["subscriber"].nil?
    subscriber = nil
  else
    subscriber = parsed_json["subscriber"].to_json
    subscriber = CandidApiClient::PreEncounter::Coverages::V1::Types::Subscriber.from_json(json_object: subscriber)
  end
  relationship = struct["relationship"]
  patient = struct["patient"]
  if parsed_json["insurance_plan"].nil?
    insurance_plan = nil
  else
    insurance_plan = parsed_json["insurance_plan"].to_json
    insurance_plan = CandidApiClient::PreEncounter::Coverages::V1::Types::InsurancePlan.from_json(json_object: insurance_plan)
  end
  verified = struct["verified"]
  eligibility_checks = parsed_json["eligibility_checks"]&.map do |item|
    item = item.to_json
    CandidApiClient::PreEncounter::Coverages::V1::Types::EligibilityCheckMetadata.from_json(json_object: item)
  end
  if parsed_json["latest_eligibility_check"].nil?
    latest_eligibility_check = nil
  else
    latest_eligibility_check = parsed_json["latest_eligibility_check"].to_json
    latest_eligibility_check = CandidApiClient::PreEncounter::Coverages::V1::Types::LatestEligibilityCheck.from_json(json_object: latest_eligibility_check)
  end
  if parsed_json["benefits"].nil?
    benefits = nil
  else
    benefits = parsed_json["benefits"].to_json
    benefits = CandidApiClient::PreEncounter::Coverages::V1::Types::CoverageBenefits.from_json(json_object: benefits)
  end
  new(
    status: status,
    subscriber: subscriber,
    relationship: relationship,
    patient: patient,
    insurance_plan: insurance_plan,
    verified: verified,
    eligibility_checks: eligibility_checks,
    latest_eligibility_check: latest_eligibility_check,
    benefits: benefits,
    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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


155
156
157
158
159
160
161
162
163
164
165
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/mutable_coverage.rb', line 155

def self.validate_raw(obj:)
  obj.status.is_a?(CandidApiClient::PreEncounter::Coverages::V1::Types::CoverageStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
  CandidApiClient::PreEncounter::Coverages::V1::Types::Subscriber.validate_raw(obj: obj.subscriber)
  obj.relationship.is_a?(CandidApiClient::PreEncounter::Common::Types::Relationship) != false || raise("Passed value for field obj.relationship is not the expected type, validation failed.")
  obj.patient.is_a?(String) != false || raise("Passed value for field obj.patient is not the expected type, validation failed.")
  CandidApiClient::PreEncounter::Coverages::V1::Types::InsurancePlan.validate_raw(obj: obj.insurance_plan)
  obj.verified.is_a?(Boolean) != false || raise("Passed value for field obj.verified is not the expected type, validation failed.")
  obj.eligibility_checks&.is_a?(Array) != false || raise("Passed value for field obj.eligibility_checks is not the expected type, validation failed.")
  obj.latest_eligibility_check.nil? || CandidApiClient::PreEncounter::Coverages::V1::Types::LatestEligibilityCheck.validate_raw(obj: obj.latest_eligibility_check)
  obj.benefits.nil? || CandidApiClient::PreEncounter::Coverages::V1::Types::CoverageBenefits.validate_raw(obj: obj.benefits)
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of MutableCoverage to a JSON object

Returns:

  • (String)


145
146
147
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/mutable_coverage.rb', line 145

def to_json(*_args)
  @_field_set&.to_json
end