Class: CandidApiClient::PreEncounter::Coverages::V1::Types::ServiceCoverage

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

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/service_coverage.rb', line 40

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



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

def additional_properties
  @additional_properties
end

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



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

def in_network
  @in_network
end

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



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

def in_network_flat
  @in_network_flat
end

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



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

def out_of_network
  @out_of_network
end

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



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

def out_of_network_flat
  @out_of_network_flat
end

#service_codeCandidApiClient::PreEncounter::Coverages::V1::Types::ServiceTypeCode (readonly)



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

def service_code
  @service_code
end

Class Method Details

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

Deserialize a JSON object to an instance of ServiceCoverage

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
90
91
92
93
94
95
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/service_coverage.rb', line 63

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


110
111
112
113
114
115
116
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/service_coverage.rb', line 110

def self.validate_raw(obj:)
  obj.service_code.is_a?(CandidApiClient::PreEncounter::Coverages::V1::Types::ServiceTypeCode) != false || raise("Passed value for field obj.service_code is not the expected type, validation failed.")
  obj.in_network.nil? || CandidApiClient::PreEncounter::Coverages::V1::Types::ServiceCoverageDetails.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::ServiceCoverageDetails.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 ServiceCoverage to a JSON object

Returns:

  • (String)


100
101
102
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/service_coverage.rb', line 100

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