Class: CandidApiClient::NonInsurancePayers::V1::Types::NonInsurancePayer

Inherits:
Object
  • Object
show all
Defined in:
lib/candidhealth/non_insurance_payers/v_1/types/non_insurance_payer.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(non_insurance_payer_id:, name:, enabled:, clinical_trials:, description: OMIT, category: OMIT, address: OMIT, additional_properties: nil) ⇒ CandidApiClient::NonInsurancePayers::V1::Types::NonInsurancePayer

Parameters:



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/candidhealth/non_insurance_payers/v_1/types/non_insurance_payer.rb', line 44

def initialize(non_insurance_payer_id:, name:, enabled:, clinical_trials:, description: OMIT, category: OMIT,
               address: OMIT, additional_properties: nil)
  @non_insurance_payer_id = non_insurance_payer_id
  @name = name
  @description = description if description != OMIT
  @category = category if category != OMIT
  @enabled = enabled
  @address = address if address != OMIT
  @clinical_trials = clinical_trials
  @additional_properties = additional_properties
  @_field_set = {
    "non_insurance_payer_id": non_insurance_payer_id,
    "name": name,
    "description": description,
    "category": category,
    "enabled": enabled,
    "address": address,
    "clinical_trials": clinical_trials
  }.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



28
29
30
# File 'lib/candidhealth/non_insurance_payers/v_1/types/non_insurance_payer.rb', line 28

def additional_properties
  @additional_properties
end

#addressCandidApiClient::Commons::Types::StreetAddressShortZip (readonly)



24
25
26
# File 'lib/candidhealth/non_insurance_payers/v_1/types/non_insurance_payer.rb', line 24

def address
  @address
end

#categoryString (readonly)

Returns:

  • (String)


20
21
22
# File 'lib/candidhealth/non_insurance_payers/v_1/types/non_insurance_payer.rb', line 20

def category
  @category
end

#clinical_trialsArray<CandidApiClient::ClinicalTrials::V1::Types::ClinicalTrial> (readonly)



26
27
28
# File 'lib/candidhealth/non_insurance_payers/v_1/types/non_insurance_payer.rb', line 26

def clinical_trials
  @clinical_trials
end

#descriptionString (readonly)

Returns:

  • (String)


18
19
20
# File 'lib/candidhealth/non_insurance_payers/v_1/types/non_insurance_payer.rb', line 18

def description
  @description
end

#enabledBoolean (readonly)

Returns:

  • (Boolean)


22
23
24
# File 'lib/candidhealth/non_insurance_payers/v_1/types/non_insurance_payer.rb', line 22

def enabled
  @enabled
end

#nameString (readonly)

Returns:

  • (String)


16
17
18
# File 'lib/candidhealth/non_insurance_payers/v_1/types/non_insurance_payer.rb', line 16

def name
  @name
end

#non_insurance_payer_idString (readonly)

Returns:

  • (String)


14
15
16
# File 'lib/candidhealth/non_insurance_payers/v_1/types/non_insurance_payer.rb', line 14

def non_insurance_payer_id
  @non_insurance_payer_id
end

Class Method Details

.from_json(json_object:) ⇒ CandidApiClient::NonInsurancePayers::V1::Types::NonInsurancePayer

Deserialize a JSON object to an instance of NonInsurancePayer

Parameters:

  • json_object (String)

Returns:



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
96
97
98
99
# File 'lib/candidhealth/non_insurance_payers/v_1/types/non_insurance_payer.rb', line 71

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  non_insurance_payer_id = struct["non_insurance_payer_id"]
  name = struct["name"]
  description = struct["description"]
  category = struct["category"]
  enabled = struct["enabled"]
  if parsed_json["address"].nil?
    address = nil
  else
    address = parsed_json["address"].to_json
    address = CandidApiClient::Commons::Types::StreetAddressShortZip.from_json(json_object: address)
  end
  clinical_trials = parsed_json["clinical_trials"]&.map do |item|
    item = item.to_json
    CandidApiClient::ClinicalTrials::V1::Types::ClinicalTrial.from_json(json_object: item)
  end
  new(
    non_insurance_payer_id: non_insurance_payer_id,
    name: name,
    description: description,
    category: category,
    enabled: enabled,
    address: address,
    clinical_trials: clinical_trials,
    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)


114
115
116
117
118
119
120
121
122
# File 'lib/candidhealth/non_insurance_payers/v_1/types/non_insurance_payer.rb', line 114

def self.validate_raw(obj:)
  obj.non_insurance_payer_id.is_a?(String) != false || raise("Passed value for field obj.non_insurance_payer_id 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.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
  obj.category&.is_a?(String) != false || raise("Passed value for field obj.category is not the expected type, validation failed.")
  obj.enabled.is_a?(Boolean) != false || raise("Passed value for field obj.enabled is not the expected type, validation failed.")
  obj.address.nil? || CandidApiClient::Commons::Types::StreetAddressShortZip.validate_raw(obj: obj.address)
  obj.clinical_trials.is_a?(Array) != false || raise("Passed value for field obj.clinical_trials is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of NonInsurancePayer to a JSON object

Returns:

  • (String)


104
105
106
# File 'lib/candidhealth/non_insurance_payers/v_1/types/non_insurance_payer.rb', line 104

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