Class: CandidApiClient::PreEncounter::Coverages::V1::Types::EligibilityCheck

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_json:, eligibility_status:, errors: OMIT, plan_metadata: OMIT, benefits: OMIT, additional_properties: nil) ⇒ CandidApiClient::PreEncounter::Coverages::V1::Types::EligibilityCheck

Parameters:



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/eligibility_check.rb', line 40

def initialize(raw_json:, eligibility_status:, errors: OMIT, plan_metadata: OMIT, benefits: OMIT,
               additional_properties: nil)
  @raw_json = raw_json
  @errors = errors if errors != OMIT
  @eligibility_status = eligibility_status
  @plan_metadata =  if  != OMIT
  @benefits = benefits if benefits != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "raw_json": raw_json,
    "errors": errors,
    "eligibility_status": eligibility_status,
    "plan_metadata": ,
    "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



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

def additional_properties
  @additional_properties
end

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



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

def benefits
  @benefits
end

#eligibility_statusCandidApiClient::PreEncounter::Coverages::V1::Types::EligibilityStatus (readonly)



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

def eligibility_status
  @eligibility_status
end

#errorsObject (readonly)

Returns:

  • (Object)


18
19
20
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/eligibility_check.rb', line 18

def errors
  @errors
end

#plan_metadataCandidApiClient::PreEncounter::Coverages::V1::Types::PlanMetadata (readonly)



22
23
24
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/eligibility_check.rb', line 22

def 
  @plan_metadata
end

#raw_jsonObject (readonly)

Returns:

  • (Object)


16
17
18
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/eligibility_check.rb', line 16

def raw_json
  @raw_json
end

Class Method Details

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

Deserialize a JSON object to an instance of EligibilityCheck

Parameters:

  • json_object (String)

Returns:



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
88
89
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/eligibility_check.rb', line 63

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  raw_json = struct["raw_json"]
  errors = struct["errors"]
  eligibility_status = struct["eligibility_status"]
  if parsed_json["plan_metadata"].nil?
     = nil
  else
     = parsed_json["plan_metadata"].to_json
     = CandidApiClient::PreEncounter::Coverages::V1::Types::PlanMetadata.from_json(json_object: )
  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(
    raw_json: raw_json,
    errors: errors,
    eligibility_status: eligibility_status,
    plan_metadata: ,
    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)


104
105
106
107
108
109
110
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/eligibility_check.rb', line 104

def self.validate_raw(obj:)
  obj.raw_json.is_a?(Object) != false || raise("Passed value for field obj.raw_json is not the expected type, validation failed.")
  obj.errors&.is_a?(Object) != false || raise("Passed value for field obj.errors is not the expected type, validation failed.")
  obj.eligibility_status.is_a?(CandidApiClient::PreEncounter::Coverages::V1::Types::EligibilityStatus) != false || raise("Passed value for field obj.eligibility_status is not the expected type, validation failed.")
  obj..nil? || CandidApiClient::PreEncounter::Coverages::V1::Types::PlanMetadata.validate_raw(obj: obj.)
  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 EligibilityCheck to a JSON object

Returns:

  • (String)


94
95
96
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/eligibility_check.rb', line 94

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