Class: CandidApiClient::PreEncounter::Coverages::V1::Types::InsurancePlan

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(member_id:, payer_id:, payer_name:, additional_payer_information: OMIT, group_number: OMIT, name: OMIT, plan_type: OMIT, type: OMIT, period: OMIT, insurance_card_image_locator: OMIT, additional_properties: nil) ⇒ CandidApiClient::PreEncounter::Coverages::V1::Types::InsurancePlan

Parameters:



56
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
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/insurance_plan.rb', line 56

def initialize(member_id:, payer_id:, payer_name:, additional_payer_information: OMIT, group_number: OMIT,
               name: OMIT, plan_type: OMIT, type: OMIT, period: OMIT, insurance_card_image_locator: OMIT, additional_properties: nil)
  @member_id = member_id
  @payer_id = payer_id
  @payer_name = payer_name
  @additional_payer_information = additional_payer_information if additional_payer_information != OMIT
  @group_number = group_number if group_number != OMIT
  @name = name if name != OMIT
  @plan_type = plan_type if plan_type != OMIT
  @type = type if type != OMIT
  @period = period if period != OMIT
  @insurance_card_image_locator = insurance_card_image_locator if insurance_card_image_locator != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "member_id": member_id,
    "payer_id": payer_id,
    "payer_name": payer_name,
    "additional_payer_information": additional_payer_information,
    "group_number": group_number,
    "name": name,
    "plan_type": plan_type,
    "type": type,
    "period": period,
    "insurance_card_image_locator": insurance_card_image_locator
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_payer_informationCandidApiClient::PreEncounter::Common::Types::AdditionalPayerInformation (readonly)



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

def additional_payer_information
  @additional_payer_information
end

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



37
38
39
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/insurance_plan.rb', line 37

def additional_properties
  @additional_properties
end

#group_numberString (readonly)

Returns:

  • (String)


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

def group_number
  @group_number
end

#insurance_card_image_locatorString (readonly)

Returns:

  • (String)


35
36
37
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/insurance_plan.rb', line 35

def insurance_card_image_locator
  @insurance_card_image_locator
end

#member_idString (readonly)

Returns:

  • (String)


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

def member_id
  @member_id
end

#nameString (readonly)

Returns:

  • (String)


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

def name
  @name
end

#payer_idString (readonly)

Returns:

  • (String)


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

def payer_id
  @payer_id
end

#payer_nameString (readonly)

Returns:

  • (String)


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

def payer_name
  @payer_name
end

#periodCandidApiClient::PreEncounter::Common::Types::Period (readonly)



33
34
35
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/insurance_plan.rb', line 33

def period
  @period
end

#plan_typeCandidApiClient::PreEncounter::Coverages::V1::Types::NetworkType (readonly)



29
30
31
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/insurance_plan.rb', line 29

def plan_type
  @plan_type
end

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



31
32
33
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/insurance_plan.rb', line 31

def type
  @type
end

Class Method Details

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

Deserialize a JSON object to an instance of InsurancePlan

Parameters:

  • json_object (String)

Returns:



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/insurance_plan.rb', line 89

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  member_id = struct["member_id"]
  payer_id = struct["payer_id"]
  payer_name = struct["payer_name"]
  if parsed_json["additional_payer_information"].nil?
    additional_payer_information = nil
  else
    additional_payer_information = parsed_json["additional_payer_information"].to_json
    additional_payer_information = CandidApiClient::PreEncounter::Common::Types::AdditionalPayerInformation.from_json(json_object: additional_payer_information)
  end
  group_number = struct["group_number"]
  name = struct["name"]
  plan_type = struct["plan_type"]
  type = struct["type"]
  if parsed_json["period"].nil?
    period = nil
  else
    period = parsed_json["period"].to_json
    period = CandidApiClient::PreEncounter::Common::Types::Period.from_json(json_object: period)
  end
  insurance_card_image_locator = struct["insurance_card_image_locator"]
  new(
    member_id: member_id,
    payer_id: payer_id,
    payer_name: payer_name,
    additional_payer_information: additional_payer_information,
    group_number: group_number,
    name: name,
    plan_type: plan_type,
    type: type,
    period: period,
    insurance_card_image_locator: insurance_card_image_locator,
    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)


140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/insurance_plan.rb', line 140

def self.validate_raw(obj:)
  obj.member_id.is_a?(String) != false || raise("Passed value for field obj.member_id is not the expected type, validation failed.")
  obj.payer_id.is_a?(String) != false || raise("Passed value for field obj.payer_id is not the expected type, validation failed.")
  obj.payer_name.is_a?(String) != false || raise("Passed value for field obj.payer_name is not the expected type, validation failed.")
  obj.additional_payer_information.nil? || CandidApiClient::PreEncounter::Common::Types::AdditionalPayerInformation.validate_raw(obj: obj.additional_payer_information)
  obj.group_number&.is_a?(String) != false || raise("Passed value for field obj.group_number is not the expected type, validation failed.")
  obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
  obj.plan_type&.is_a?(CandidApiClient::PreEncounter::Coverages::V1::Types::NetworkType) != false || raise("Passed value for field obj.plan_type is not the expected type, validation failed.")
  obj.type&.is_a?(CandidApiClient::PreEncounter::Coverages::V1::Types::InsuranceTypeCode) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
  obj.period.nil? || CandidApiClient::PreEncounter::Common::Types::Period.validate_raw(obj: obj.period)
  obj.insurance_card_image_locator&.is_a?(String) != false || raise("Passed value for field obj.insurance_card_image_locator is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of InsurancePlan to a JSON object

Returns:

  • (String)


130
131
132
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/insurance_plan.rb', line 130

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