Class: CandidApiClient::EncounterProviders::V2::Types::InitialReferringProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/candidhealth/encounter_providers/v_2/types/initial_referring_provider.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(npi:, taxonomy_code: OMIT, address: OMIT, qualifier: OMIT, first_name: OMIT, last_name: OMIT, organization_name: OMIT, additional_properties: nil) ⇒ CandidApiClient::EncounterProviders::V2::Types::InitialReferringProvider

Parameters:

  • npi (String)

    A National Provider Identifier is a unique 10-digit identification number issued to health care providers in the United States

  • taxonomy_code (String) (defaults to: OMIT)
  • address (CandidApiClient::Commons::Types::StreetAddressLongZip) (defaults to: OMIT)
  • qualifier (CandidApiClient::Commons::Types::QualifierCode) (defaults to: OMIT)
  • first_name (String) (defaults to: OMIT)

    If the provider is an individual, this should be set instead of organization name

  • last_name (String) (defaults to: OMIT)

    If the provider is an individual, this should be set instead of organization name

  • organization_name (String) (defaults to: OMIT)

    If the provider is an organization, this should be set instead of first + last name

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/candidhealth/encounter_providers/v_2/types/initial_referring_provider.rb', line 52

def initialize(npi:, taxonomy_code: OMIT, address: OMIT, qualifier: OMIT, first_name: OMIT, last_name: OMIT,
               organization_name: OMIT, additional_properties: nil)
  @npi = npi
  @taxonomy_code = taxonomy_code if taxonomy_code != OMIT
  @address = address if address != OMIT
  @qualifier = qualifier if qualifier != OMIT
  @first_name = first_name if first_name != OMIT
  @last_name = last_name if last_name != OMIT
  @organization_name = organization_name if organization_name != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "npi": npi,
    "taxonomy_code": taxonomy_code,
    "address": address,
    "qualifier": qualifier,
    "first_name": first_name,
    "last_name": last_name,
    "organization_name": organization_name
  }.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



32
33
34
# File 'lib/candidhealth/encounter_providers/v_2/types/initial_referring_provider.rb', line 32

def additional_properties
  @additional_properties
end

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



19
20
21
# File 'lib/candidhealth/encounter_providers/v_2/types/initial_referring_provider.rb', line 19

def address
  @address
end

#first_nameString (readonly)

Returns If the provider is an individual, this should be set instead of organization name.

Returns:

  • (String)

    If the provider is an individual, this should be set instead of organization name



24
25
26
# File 'lib/candidhealth/encounter_providers/v_2/types/initial_referring_provider.rb', line 24

def first_name
  @first_name
end

#last_nameString (readonly)

Returns If the provider is an individual, this should be set instead of organization name.

Returns:

  • (String)

    If the provider is an individual, this should be set instead of organization name



27
28
29
# File 'lib/candidhealth/encounter_providers/v_2/types/initial_referring_provider.rb', line 27

def last_name
  @last_name
end

#npiString (readonly)

Returns A National Provider Identifier is a unique 10-digit identification number issued to health care providers in the United States.

Returns:

  • (String)

    A National Provider Identifier is a unique 10-digit identification number issued to health care providers in the United States



15
16
17
# File 'lib/candidhealth/encounter_providers/v_2/types/initial_referring_provider.rb', line 15

def npi
  @npi
end

#organization_nameString (readonly)

Returns If the provider is an organization, this should be set instead of first + last name.

Returns:

  • (String)

    If the provider is an organization, this should be set instead of first + last name



30
31
32
# File 'lib/candidhealth/encounter_providers/v_2/types/initial_referring_provider.rb', line 30

def organization_name
  @organization_name
end

#qualifierCandidApiClient::Commons::Types::QualifierCode (readonly)



21
22
23
# File 'lib/candidhealth/encounter_providers/v_2/types/initial_referring_provider.rb', line 21

def qualifier
  @qualifier
end

#taxonomy_codeString (readonly)

Returns:

  • (String)


17
18
19
# File 'lib/candidhealth/encounter_providers/v_2/types/initial_referring_provider.rb', line 17

def taxonomy_code
  @taxonomy_code
end

Class Method Details

.from_json(json_object:) ⇒ CandidApiClient::EncounterProviders::V2::Types::InitialReferringProvider

Deserialize a JSON object to an instance of InitialReferringProvider



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/candidhealth/encounter_providers/v_2/types/initial_referring_provider.rb', line 79

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  npi = struct["npi"]
  taxonomy_code = struct["taxonomy_code"]
  if parsed_json["address"].nil?
    address = nil
  else
    address = parsed_json["address"].to_json
    address = CandidApiClient::Commons::Types::StreetAddressLongZip.from_json(json_object: address)
  end
  qualifier = struct["qualifier"]
  first_name = struct["first_name"]
  last_name = struct["last_name"]
  organization_name = struct["organization_name"]
  new(
    npi: npi,
    taxonomy_code: taxonomy_code,
    address: address,
    qualifier: qualifier,
    first_name: first_name,
    last_name: last_name,
    organization_name: organization_name,
    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)


119
120
121
122
123
124
125
126
127
# File 'lib/candidhealth/encounter_providers/v_2/types/initial_referring_provider.rb', line 119

def self.validate_raw(obj:)
  obj.npi.is_a?(String) != false || raise("Passed value for field obj.npi is not the expected type, validation failed.")
  obj.taxonomy_code&.is_a?(String) != false || raise("Passed value for field obj.taxonomy_code is not the expected type, validation failed.")
  obj.address.nil? || CandidApiClient::Commons::Types::StreetAddressLongZip.validate_raw(obj: obj.address)
  obj.qualifier&.is_a?(CandidApiClient::Commons::Types::QualifierCode) != false || raise("Passed value for field obj.qualifier is not the expected type, validation failed.")
  obj.first_name&.is_a?(String) != false || raise("Passed value for field obj.first_name is not the expected type, validation failed.")
  obj.last_name&.is_a?(String) != false || raise("Passed value for field obj.last_name is not the expected type, validation failed.")
  obj.organization_name&.is_a?(String) != false || raise("Passed value for field obj.organization_name is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of InitialReferringProvider to a JSON object

Returns:

  • (String)


109
110
111
# File 'lib/candidhealth/encounter_providers/v_2/types/initial_referring_provider.rb', line 109

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