Class: CandidApiClient::ServiceLines::V2::Types::DrugIdentification

Inherits:
Object
  • Object
show all
Defined in:
lib/candidhealth/service_lines/v_2/types/drug_identification.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(service_id_qualifier:, national_drug_code:, national_drug_unit_count:, measurement_unit_code:, link_sequence_number: OMIT, pharmacy_prescription_number: OMIT, conversion_formula: OMIT, drug_description: OMIT, additional_properties: nil) ⇒ CandidApiClient::ServiceLines::V2::Types::DrugIdentification

Parameters:



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/candidhealth/service_lines/v_2/types/drug_identification.rb', line 47

def initialize(service_id_qualifier:, national_drug_code:, national_drug_unit_count:, measurement_unit_code:,
               link_sequence_number: OMIT, pharmacy_prescription_number: OMIT, conversion_formula: OMIT, drug_description: OMIT, additional_properties: nil)
  @service_id_qualifier = service_id_qualifier
  @national_drug_code = national_drug_code
  @national_drug_unit_count = national_drug_unit_count
  @measurement_unit_code = measurement_unit_code
  @link_sequence_number = link_sequence_number if link_sequence_number != OMIT
  @pharmacy_prescription_number = pharmacy_prescription_number if pharmacy_prescription_number != OMIT
  @conversion_formula = conversion_formula if conversion_formula != OMIT
  @drug_description = drug_description if drug_description != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "service_id_qualifier": service_id_qualifier,
    "national_drug_code": national_drug_code,
    "national_drug_unit_count": national_drug_unit_count,
    "measurement_unit_code": measurement_unit_code,
    "link_sequence_number": link_sequence_number,
    "pharmacy_prescription_number": pharmacy_prescription_number,
    "conversion_formula": conversion_formula,
    "drug_description": drug_description
  }.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



30
31
32
# File 'lib/candidhealth/service_lines/v_2/types/drug_identification.rb', line 30

def additional_properties
  @additional_properties
end

#conversion_formulaString (readonly)

Returns:

  • (String)


26
27
28
# File 'lib/candidhealth/service_lines/v_2/types/drug_identification.rb', line 26

def conversion_formula
  @conversion_formula
end

#drug_descriptionString (readonly)

Returns:

  • (String)


28
29
30
# File 'lib/candidhealth/service_lines/v_2/types/drug_identification.rb', line 28

def drug_description
  @drug_description
end

Returns:

  • (String)


22
23
24
# File 'lib/candidhealth/service_lines/v_2/types/drug_identification.rb', line 22

def link_sequence_number
  @link_sequence_number
end

#measurement_unit_codeCandidApiClient::ServiceLines::V2::Types::MeasurementUnitCode (readonly)



20
21
22
# File 'lib/candidhealth/service_lines/v_2/types/drug_identification.rb', line 20

def measurement_unit_code
  @measurement_unit_code
end

#national_drug_codeString (readonly)

Returns:

  • (String)


16
17
18
# File 'lib/candidhealth/service_lines/v_2/types/drug_identification.rb', line 16

def national_drug_code
  @national_drug_code
end

#national_drug_unit_countString (readonly)

Returns:

  • (String)


18
19
20
# File 'lib/candidhealth/service_lines/v_2/types/drug_identification.rb', line 18

def national_drug_unit_count
  @national_drug_unit_count
end

#pharmacy_prescription_numberString (readonly)

Returns:

  • (String)


24
25
26
# File 'lib/candidhealth/service_lines/v_2/types/drug_identification.rb', line 24

def pharmacy_prescription_number
  @pharmacy_prescription_number
end

#service_id_qualifierCandidApiClient::ServiceLines::V2::Types::ServiceIdQualifier (readonly)



14
15
16
# File 'lib/candidhealth/service_lines/v_2/types/drug_identification.rb', line 14

def service_id_qualifier
  @service_id_qualifier
end

Class Method Details

.from_json(json_object:) ⇒ CandidApiClient::ServiceLines::V2::Types::DrugIdentification

Deserialize a JSON object to an instance of DrugIdentification

Parameters:

  • json_object (String)

Returns:



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/candidhealth/service_lines/v_2/types/drug_identification.rb', line 76

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  service_id_qualifier = struct["service_id_qualifier"]
  national_drug_code = struct["national_drug_code"]
  national_drug_unit_count = struct["national_drug_unit_count"]
  measurement_unit_code = struct["measurement_unit_code"]
  link_sequence_number = struct["link_sequence_number"]
  pharmacy_prescription_number = struct["pharmacy_prescription_number"]
  conversion_formula = struct["conversion_formula"]
  drug_description = struct["drug_description"]
  new(
    service_id_qualifier: service_id_qualifier,
    national_drug_code: national_drug_code,
    national_drug_unit_count: national_drug_unit_count,
    measurement_unit_code: measurement_unit_code,
    link_sequence_number: link_sequence_number,
    pharmacy_prescription_number: pharmacy_prescription_number,
    conversion_formula: conversion_formula,
    drug_description: drug_description,
    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)


112
113
114
115
116
117
118
119
120
121
# File 'lib/candidhealth/service_lines/v_2/types/drug_identification.rb', line 112

def self.validate_raw(obj:)
  obj.service_id_qualifier.is_a?(CandidApiClient::ServiceLines::V2::Types::ServiceIdQualifier) != false || raise("Passed value for field obj.service_id_qualifier is not the expected type, validation failed.")
  obj.national_drug_code.is_a?(String) != false || raise("Passed value for field obj.national_drug_code is not the expected type, validation failed.")
  obj.national_drug_unit_count.is_a?(String) != false || raise("Passed value for field obj.national_drug_unit_count is not the expected type, validation failed.")
  obj.measurement_unit_code.is_a?(CandidApiClient::ServiceLines::V2::Types::MeasurementUnitCode) != false || raise("Passed value for field obj.measurement_unit_code is not the expected type, validation failed.")
  obj.link_sequence_number&.is_a?(String) != false || raise("Passed value for field obj.link_sequence_number is not the expected type, validation failed.")
  obj.pharmacy_prescription_number&.is_a?(String) != false || raise("Passed value for field obj.pharmacy_prescription_number is not the expected type, validation failed.")
  obj.conversion_formula&.is_a?(String) != false || raise("Passed value for field obj.conversion_formula is not the expected type, validation failed.")
  obj.drug_description&.is_a?(String) != false || raise("Passed value for field obj.drug_description is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of DrugIdentification to a JSON object

Returns:

  • (String)


102
103
104
# File 'lib/candidhealth/service_lines/v_2/types/drug_identification.rb', line 102

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