Class: CandidApiClient::PreEncounter::Coverages::V1::Types::CoverageValue

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(family: OMIT, individual: OMIT, additional_properties: nil) ⇒ CandidApiClient::PreEncounter::Coverages::V1::Types::CoverageValue

Parameters:

  • family (Float) (defaults to: OMIT)
  • individual (Float) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



28
29
30
31
32
33
34
35
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/coverage_value.rb', line 28

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



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

def additional_properties
  @additional_properties
end

#familyFloat (readonly)

Returns:

  • (Float)


13
14
15
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/coverage_value.rb', line 13

def family
  @family
end

#individualFloat (readonly)

Returns:

  • (Float)


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

def individual
  @individual
end

Class Method Details

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

Deserialize a JSON object to an instance of CoverageValue

Parameters:

  • json_object (String)

Returns:



41
42
43
44
45
46
47
48
49
50
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/coverage_value.rb', line 41

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  family = struct["family"]
  individual = struct["individual"]
  new(
    family: family,
    individual: individual,
    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)


65
66
67
68
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/coverage_value.rb', line 65

def self.validate_raw(obj:)
  obj.family&.is_a?(Float) != false || raise("Passed value for field obj.family is not the expected type, validation failed.")
  obj.individual&.is_a?(Float) != false || raise("Passed value for field obj.individual is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of CoverageValue to a JSON object

Returns:

  • (String)


55
56
57
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/coverage_value.rb', line 55

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