Class: CandidApiClient::PreEncounter::Coverages::V1::Types::PlanMetadata

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(insurance_type: OMIT, insurance_type_code: OMIT, plan_name: OMIT, member_id: OMIT, group_number: OMIT, start_date: OMIT, end_date: OMIT, plan_dates: OMIT, additional_properties: nil) ⇒ CandidApiClient::PreEncounter::Coverages::V1::Types::PlanMetadata

Parameters:

  • insurance_type (String) (defaults to: OMIT)
  • insurance_type_code (String) (defaults to: OMIT)
  • plan_name (String) (defaults to: OMIT)
  • member_id (String) (defaults to: OMIT)
  • group_number (String) (defaults to: OMIT)
  • start_date (Date) (defaults to: OMIT)
  • end_date (Date) (defaults to: OMIT)
  • plan_dates (Array<CandidApiClient::PreEncounter::Coverages::V1::Types::PlanDate>) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/plan_metadata.rb', line 48

def initialize(insurance_type: OMIT, insurance_type_code: OMIT, plan_name: OMIT, member_id: OMIT,
               group_number: OMIT, start_date: OMIT, end_date: OMIT, plan_dates: OMIT, additional_properties: nil)
  @insurance_type = insurance_type if insurance_type != OMIT
  @insurance_type_code = insurance_type_code if insurance_type_code != OMIT
  @plan_name = plan_name if plan_name != OMIT
  @member_id = member_id if member_id != OMIT
  @group_number = group_number if group_number != OMIT
  @start_date = start_date if start_date != OMIT
  @end_date = end_date if end_date != OMIT
  @plan_dates = plan_dates if plan_dates != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "insurance_type": insurance_type,
    "insurance_type_code": insurance_type_code,
    "plan_name": plan_name,
    "member_id": member_id,
    "group_number": group_number,
    "start_date": start_date,
    "end_date": end_date,
    "plan_dates": plan_dates
  }.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



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

def additional_properties
  @additional_properties
end

#end_dateDate (readonly)

Returns:

  • (Date)


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

def end_date
  @end_date
end

#group_numberString (readonly)

Returns:

  • (String)


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

def group_number
  @group_number
end

#insurance_typeString (readonly)

Returns:

  • (String)


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

def insurance_type
  @insurance_type
end

#insurance_type_codeString (readonly)

Returns:

  • (String)


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

def insurance_type_code
  @insurance_type_code
end

#member_idString (readonly)

Returns:

  • (String)


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

def member_id
  @member_id
end

#plan_datesArray<CandidApiClient::PreEncounter::Coverages::V1::Types::PlanDate> (readonly)



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

def plan_dates
  @plan_dates
end

#plan_nameString (readonly)

Returns:

  • (String)


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

def plan_name
  @plan_name
end

#start_dateDate (readonly)

Returns:

  • (Date)


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

def start_date
  @start_date
end

Class Method Details

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

Deserialize a JSON object to an instance of PlanMetadata

Parameters:

  • json_object (String)

Returns:



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/plan_metadata.rb', line 77

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  insurance_type = struct["insurance_type"]
  insurance_type_code = struct["insurance_type_code"]
  plan_name = struct["plan_name"]
  member_id = struct["member_id"]
  group_number = struct["group_number"]
  start_date = (Date.parse(parsed_json["start_date"]) unless parsed_json["start_date"].nil?)
  end_date = (Date.parse(parsed_json["end_date"]) unless parsed_json["end_date"].nil?)
  plan_dates = parsed_json["plan_dates"]&.map do |item|
    item = item.to_json
    CandidApiClient::PreEncounter::Coverages::V1::Types::PlanDate.from_json(json_object: item)
  end
  new(
    insurance_type: insurance_type,
    insurance_type_code: insurance_type_code,
    plan_name: plan_name,
    member_id: member_id,
    group_number: group_number,
    start_date: start_date,
    end_date: end_date,
    plan_dates: plan_dates,
    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)


117
118
119
120
121
122
123
124
125
126
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/plan_metadata.rb', line 117

def self.validate_raw(obj:)
  obj.insurance_type&.is_a?(String) != false || raise("Passed value for field obj.insurance_type is not the expected type, validation failed.")
  obj.insurance_type_code&.is_a?(String) != false || raise("Passed value for field obj.insurance_type_code is not the expected type, validation failed.")
  obj.plan_name&.is_a?(String) != false || raise("Passed value for field obj.plan_name is not the expected type, validation failed.")
  obj.member_id&.is_a?(String) != false || raise("Passed value for field obj.member_id is not the expected type, validation failed.")
  obj.group_number&.is_a?(String) != false || raise("Passed value for field obj.group_number is not the expected type, validation failed.")
  obj.start_date&.is_a?(Date) != false || raise("Passed value for field obj.start_date is not the expected type, validation failed.")
  obj.end_date&.is_a?(Date) != false || raise("Passed value for field obj.end_date is not the expected type, validation failed.")
  obj.plan_dates&.is_a?(Array) != false || raise("Passed value for field obj.plan_dates is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of PlanMetadata to a JSON object

Returns:

  • (String)


107
108
109
# File 'lib/candidhealth/pre_encounter/coverages/v_1/types/plan_metadata.rb', line 107

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