Class: CandidApiClient::PreEncounter::Coverages::V1::Types::CoverageDetails

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, coverage_level:, unit:, value:, additional_notes: OMIT, additional_properties: nil) ⇒ CandidApiClient::PreEncounter::Coverages::V1::Types::CoverageDetails

Parameters:



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

def initialize(type:, coverage_level:, unit:, value:, additional_notes: OMIT, additional_properties: nil)
  @type = type
  @coverage_level = coverage_level
  @unit = unit
  @value = value
  @additional_notes = additional_notes if additional_notes != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "type": type,
    "coverageLevel": coverage_level,
    "unit": unit,
    "value": value,
    "additional_notes": additional_notes
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_notesString (readonly)

Returns:

  • (String)


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

def additional_notes
  @additional_notes
end

#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/coverage_details.rb', line 26

def additional_properties
  @additional_properties
end

#coverage_levelCandidApiClient::PreEncounter::Coverages::V1::Types::CoverageLevel (readonly)



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

def coverage_level
  @coverage_level
end

#typeCandidApiClient::PreEncounter::Coverages::V1::Types::BenefitType (readonly)



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

def type
  @type
end

#unitCandidApiClient::PreEncounter::Coverages::V1::Types::CoverageValueUnit (readonly)



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

def unit
  @unit
end

#valueFloat (readonly)

Returns:

  • (Float)


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

def value
  @value
end

Class Method Details

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

Deserialize a JSON object to an instance of CoverageDetails

Parameters:

  • json_object (String)

Returns:



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/coverage_details.rb', line 62

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  type = struct["type"]
  coverage_level = struct["coverageLevel"]
  unit = struct["unit"]
  value = struct["value"]
  additional_notes = struct["additional_notes"]
  new(
    type: type,
    coverage_level: coverage_level,
    unit: unit,
    value: value,
    additional_notes: additional_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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


92
93
94
95
96
97
98
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/coverage_details.rb', line 92

def self.validate_raw(obj:)
  obj.type.is_a?(CandidApiClient::PreEncounter::Coverages::V1::Types::BenefitType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
  obj.coverage_level.is_a?(CandidApiClient::PreEncounter::Coverages::V1::Types::CoverageLevel) != false || raise("Passed value for field obj.coverage_level is not the expected type, validation failed.")
  obj.unit.is_a?(CandidApiClient::PreEncounter::Coverages::V1::Types::CoverageValueUnit) != false || raise("Passed value for field obj.unit is not the expected type, validation failed.")
  obj.value.is_a?(Float) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
  obj.additional_notes&.is_a?(String) != false || raise("Passed value for field obj.additional_notes is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of CoverageDetails to a JSON object

Returns:

  • (String)


82
83
84
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/coverage_details.rb', line 82

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