Class: CandidApiClient::PreEncounter::Coverages::V1::Types::PlanCoverage

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(in_network: OMIT, in_network_flat: OMIT, out_of_network: OMIT, out_of_network_flat: OMIT, additional_properties: nil) ⇒ CandidApiClient::PreEncounter::Coverages::V1::Types::PlanCoverage

Parameters:



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/plan_coverage.rb', line 36

def initialize(in_network: OMIT, in_network_flat: OMIT, out_of_network: OMIT, out_of_network_flat: OMIT,
               additional_properties: nil)
  @in_network = in_network if in_network != OMIT
  @in_network_flat = in_network_flat if in_network_flat != OMIT
  @out_of_network = out_of_network if out_of_network != OMIT
  @out_of_network_flat = out_of_network_flat if out_of_network_flat != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "in_network": in_network,
    "in_network_flat": in_network_flat,
    "out_of_network": out_of_network,
    "out_of_network_flat": out_of_network_flat
  }.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



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

def additional_properties
  @additional_properties
end

#in_networkCandidApiClient::PreEncounter::Coverages::V1::Types::PlanCoverageDetails (readonly)



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

def in_network
  @in_network
end

#in_network_flatArray<CandidApiClient::PreEncounter::Coverages::V1::Types::CoverageDetails> (readonly)



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

def in_network_flat
  @in_network_flat
end

#out_of_networkCandidApiClient::PreEncounter::Coverages::V1::Types::PlanCoverageDetails (readonly)



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

def out_of_network
  @out_of_network
end

#out_of_network_flatArray<CandidApiClient::PreEncounter::Coverages::V1::Types::CoverageDetails> (readonly)



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

def out_of_network_flat
  @out_of_network_flat
end

Class Method Details

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

Deserialize a JSON object to an instance of PlanCoverage

Parameters:

  • json_object (String)

Returns:



57
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
83
84
85
86
87
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/plan_coverage.rb', line 57

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  if parsed_json["in_network"].nil?
    in_network = nil
  else
    in_network = parsed_json["in_network"].to_json
    in_network = CandidApiClient::PreEncounter::Coverages::V1::Types::PlanCoverageDetails.from_json(json_object: in_network)
  end
  in_network_flat = parsed_json["in_network_flat"]&.map do |item|
    item = item.to_json
    CandidApiClient::PreEncounter::Coverages::V1::Types::CoverageDetails.from_json(json_object: item)
  end
  if parsed_json["out_of_network"].nil?
    out_of_network = nil
  else
    out_of_network = parsed_json["out_of_network"].to_json
    out_of_network = CandidApiClient::PreEncounter::Coverages::V1::Types::PlanCoverageDetails.from_json(json_object: out_of_network)
  end
  out_of_network_flat = parsed_json["out_of_network_flat"]&.map do |item|
    item = item.to_json
    CandidApiClient::PreEncounter::Coverages::V1::Types::CoverageDetails.from_json(json_object: item)
  end
  new(
    in_network: in_network,
    in_network_flat: in_network_flat,
    out_of_network: out_of_network,
    out_of_network_flat: out_of_network_flat,
    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)


102
103
104
105
106
107
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/plan_coverage.rb', line 102

def self.validate_raw(obj:)
  obj.in_network.nil? || CandidApiClient::PreEncounter::Coverages::V1::Types::PlanCoverageDetails.validate_raw(obj: obj.in_network)
  obj.in_network_flat&.is_a?(Array) != false || raise("Passed value for field obj.in_network_flat is not the expected type, validation failed.")
  obj.out_of_network.nil? || CandidApiClient::PreEncounter::Coverages::V1::Types::PlanCoverageDetails.validate_raw(obj: obj.out_of_network)
  obj.out_of_network_flat&.is_a?(Array) != false || raise("Passed value for field obj.out_of_network_flat is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of PlanCoverage to a JSON object

Returns:

  • (String)


92
93
94
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/plan_coverage.rb', line 92

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