Class: CandidApiClient::PreEncounter::Common::Types::ExternalProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/candidhealth/pre_encounter/common/types/external_provider.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, telecoms:, type: OMIT, npi: OMIT, addresses: OMIT, period: OMIT, canonical_id: OMIT, fax: OMIT, additional_properties: nil) ⇒ CandidApiClient::PreEncounter::Common::Types::ExternalProvider

Parameters:



50
51
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/pre_encounter/common/types/external_provider.rb', line 50

def initialize(name:, telecoms:, type: OMIT, npi: OMIT, addresses: OMIT, period: OMIT, canonical_id: OMIT,
               fax: OMIT, additional_properties: nil)
  @name = name
  @type = type if type != OMIT
  @npi = npi if npi != OMIT
  @telecoms = telecoms
  @addresses = addresses if addresses != OMIT
  @period = period if period != OMIT
  @canonical_id = canonical_id if canonical_id != OMIT
  @fax = fax if fax != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "name": name,
    "type": type,
    "npi": npi,
    "telecoms": telecoms,
    "addresses": addresses,
    "period": period,
    "canonical_id": canonical_id,
    "fax": fax
  }.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



33
34
35
# File 'lib/candidhealth/pre_encounter/common/types/external_provider.rb', line 33

def additional_properties
  @additional_properties
end

#addressesArray<CandidApiClient::PreEncounter::Common::Types::Address> (readonly)



25
26
27
# File 'lib/candidhealth/pre_encounter/common/types/external_provider.rb', line 25

def addresses
  @addresses
end

#canonical_idString (readonly)

Returns:

  • (String)


29
30
31
# File 'lib/candidhealth/pre_encounter/common/types/external_provider.rb', line 29

def canonical_id
  @canonical_id
end

#faxString (readonly)

Returns:

  • (String)


31
32
33
# File 'lib/candidhealth/pre_encounter/common/types/external_provider.rb', line 31

def fax
  @fax
end

#nameCandidApiClient::PreEncounter::Common::Types::HumanName (readonly)



17
18
19
# File 'lib/candidhealth/pre_encounter/common/types/external_provider.rb', line 17

def name
  @name
end

#npiString (readonly)

Returns:

  • (String)


21
22
23
# File 'lib/candidhealth/pre_encounter/common/types/external_provider.rb', line 21

def npi
  @npi
end

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



27
28
29
# File 'lib/candidhealth/pre_encounter/common/types/external_provider.rb', line 27

def period
  @period
end

#telecomsArray<CandidApiClient::PreEncounter::Common::Types::ContactPoint> (readonly)



23
24
25
# File 'lib/candidhealth/pre_encounter/common/types/external_provider.rb', line 23

def telecoms
  @telecoms
end

#typeCandidApiClient::PreEncounter::Common::Types::ExternalProviderType (readonly)

Returns Defaults to ATTENDING.



19
20
21
# File 'lib/candidhealth/pre_encounter/common/types/external_provider.rb', line 19

def type
  @type
end

Class Method Details

.from_json(json_object:) ⇒ CandidApiClient::PreEncounter::Common::Types::ExternalProvider

Deserialize a JSON object to an instance of ExternalProvider

Parameters:

  • json_object (String)

Returns:



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
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/candidhealth/pre_encounter/common/types/external_provider.rb', line 79

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  if parsed_json["name"].nil?
    name = nil
  else
    name = parsed_json["name"].to_json
    name = CandidApiClient::PreEncounter::Common::Types::HumanName.from_json(json_object: name)
  end
  type = struct["type"]
  npi = struct["npi"]
  telecoms = parsed_json["telecoms"]&.map do |item|
    item = item.to_json
    CandidApiClient::PreEncounter::Common::Types::ContactPoint.from_json(json_object: item)
  end
  addresses = parsed_json["addresses"]&.map do |item|
    item = item.to_json
    CandidApiClient::PreEncounter::Common::Types::Address.from_json(json_object: item)
  end
  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
  canonical_id = struct["canonical_id"]
  fax = struct["fax"]
  new(
    name: name,
    type: type,
    npi: npi,
    telecoms: telecoms,
    addresses: addresses,
    period: period,
    canonical_id: canonical_id,
    fax: fax,
    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)


132
133
134
135
136
137
138
139
140
141
# File 'lib/candidhealth/pre_encounter/common/types/external_provider.rb', line 132

def self.validate_raw(obj:)
  CandidApiClient::PreEncounter::Common::Types::HumanName.validate_raw(obj: obj.name)
  obj.type&.is_a?(CandidApiClient::PreEncounter::Common::Types::ExternalProviderType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
  obj.npi&.is_a?(String) != false || raise("Passed value for field obj.npi is not the expected type, validation failed.")
  obj.telecoms.is_a?(Array) != false || raise("Passed value for field obj.telecoms is not the expected type, validation failed.")
  obj.addresses&.is_a?(Array) != false || raise("Passed value for field obj.addresses is not the expected type, validation failed.")
  obj.period.nil? || CandidApiClient::PreEncounter::Common::Types::Period.validate_raw(obj: obj.period)
  obj.canonical_id&.is_a?(String) != false || raise("Passed value for field obj.canonical_id is not the expected type, validation failed.")
  obj.fax&.is_a?(String) != false || raise("Passed value for field obj.fax is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of ExternalProvider to a JSON object

Returns:

  • (String)


122
123
124
# File 'lib/candidhealth/pre_encounter/common/types/external_provider.rb', line 122

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