Class: CandidApiClient::OrganizationProviders::V3::Types::OrganizationProviderCreateV2

Inherits:
Object
  • Object
show all
Defined in:
lib/candidhealth/organization_providers/v_3/types/organization_provider_create_v_2.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(npi:, is_rendering:, is_billing:, provider_type:, license_type:, qualifications:, first_name: OMIT, last_name: OMIT, organization_name: OMIT, tax_id: OMIT, taxonomy_code: OMIT, addresses: OMIT, employment_start_date: OMIT, employment_termination_date: OMIT, additional_properties: nil) ⇒ CandidApiClient::OrganizationProviders::V3::Types::OrganizationProviderCreateV2



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
100
101
102
103
104
105
106
107
108
109
# File 'lib/candidhealth/organization_providers/v_3/types/organization_provider_create_v_2.rb', line 74

def initialize(npi:, is_rendering:, is_billing:, provider_type:, license_type:, qualifications:,
               first_name: OMIT, last_name: OMIT, organization_name: OMIT, tax_id: OMIT, taxonomy_code: OMIT, addresses: OMIT, employment_start_date: OMIT, employment_termination_date: OMIT, additional_properties: nil)
  @npi = npi
  @is_rendering = is_rendering
  @is_billing = is_billing
  @first_name = first_name if first_name != OMIT
  @last_name = last_name if last_name != OMIT
  @organization_name = organization_name if organization_name != OMIT
  @provider_type = provider_type
  @tax_id = tax_id if tax_id != OMIT
  @taxonomy_code = taxonomy_code if taxonomy_code != OMIT
  @license_type = license_type
  @addresses = addresses if addresses != OMIT
  @employment_start_date = employment_start_date if employment_start_date != OMIT
  @employment_termination_date = employment_termination_date if employment_termination_date != OMIT
  @qualifications = qualifications
  @additional_properties = additional_properties
  @_field_set = {
    "npi": npi,
    "is_rendering": is_rendering,
    "is_billing": is_billing,
    "first_name": first_name,
    "last_name": last_name,
    "organization_name": organization_name,
    "provider_type": provider_type,
    "tax_id": tax_id,
    "taxonomy_code": taxonomy_code,
    "license_type": license_type,
    "addresses": addresses,
    "employment_start_date": employment_start_date,
    "employment_termination_date": employment_termination_date,
    "qualifications": qualifications
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)



48
49
50
# File 'lib/candidhealth/organization_providers/v_3/types/organization_provider_create_v_2.rb', line 48

def additional_properties
  @additional_properties
end

#addressesArray<CandidApiClient::OrganizationProviders::V2::Types::OrganizationProviderAddress> (readonly)



40
41
42
# File 'lib/candidhealth/organization_providers/v_3/types/organization_provider_create_v_2.rb', line 40

def addresses
  @addresses
end

#employment_start_dateDate (readonly)



42
43
44
# File 'lib/candidhealth/organization_providers/v_3/types/organization_provider_create_v_2.rb', line 42

def employment_start_date
  @employment_start_date
end

#employment_termination_dateDate (readonly)



44
45
46
# File 'lib/candidhealth/organization_providers/v_3/types/organization_provider_create_v_2.rb', line 44

def employment_termination_date
  @employment_termination_date
end

#first_nameString (readonly)



24
25
26
# File 'lib/candidhealth/organization_providers/v_3/types/organization_provider_create_v_2.rb', line 24

def first_name
  @first_name
end

#is_billingBoolean (readonly)



22
23
24
# File 'lib/candidhealth/organization_providers/v_3/types/organization_provider_create_v_2.rb', line 22

def is_billing
  @is_billing
end

#is_renderingBoolean (readonly)



20
21
22
# File 'lib/candidhealth/organization_providers/v_3/types/organization_provider_create_v_2.rb', line 20

def is_rendering
  @is_rendering
end

#last_nameString (readonly)



26
27
28
# File 'lib/candidhealth/organization_providers/v_3/types/organization_provider_create_v_2.rb', line 26

def last_name
  @last_name
end

#license_typeCandidApiClient::OrganizationProviders::V2::Types::LicenseType (readonly)



38
39
40
# File 'lib/candidhealth/organization_providers/v_3/types/organization_provider_create_v_2.rb', line 38

def license_type
  @license_type
end

#npiString (readonly)



18
19
20
# File 'lib/candidhealth/organization_providers/v_3/types/organization_provider_create_v_2.rb', line 18

def npi
  @npi
end

#organization_nameString (readonly)



28
29
30
# File 'lib/candidhealth/organization_providers/v_3/types/organization_provider_create_v_2.rb', line 28

def organization_name
  @organization_name
end

#provider_typeCandidApiClient::OrganizationProviders::V2::Types::ProviderType (readonly)



31
32
33
# File 'lib/candidhealth/organization_providers/v_3/types/organization_provider_create_v_2.rb', line 31

def provider_type
  @provider_type
end

#qualificationsArray<CandidApiClient::Identifiers::Types::IdentifierCreate> (readonly)



46
47
48
# File 'lib/candidhealth/organization_providers/v_3/types/organization_provider_create_v_2.rb', line 46

def qualifications
  @qualifications
end

#tax_idString (readonly)



34
35
36
# File 'lib/candidhealth/organization_providers/v_3/types/organization_provider_create_v_2.rb', line 34

def tax_id
  @tax_id
end

#taxonomy_codeString (readonly)



36
37
38
# File 'lib/candidhealth/organization_providers/v_3/types/organization_provider_create_v_2.rb', line 36

def taxonomy_code
  @taxonomy_code
end

Class Method Details

.from_json(json_object:) ⇒ CandidApiClient::OrganizationProviders::V3::Types::OrganizationProviderCreateV2

Deserialize a JSON object to an instance of OrganizationProviderCreateV2



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/candidhealth/organization_providers/v_3/types/organization_provider_create_v_2.rb', line 115

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  npi = struct["npi"]
  is_rendering = struct["is_rendering"]
  is_billing = struct["is_billing"]
  first_name = struct["first_name"]
  last_name = struct["last_name"]
  organization_name = struct["organization_name"]
  provider_type = struct["provider_type"]
  tax_id = struct["tax_id"]
  taxonomy_code = struct["taxonomy_code"]
  license_type = struct["license_type"]
  addresses = parsed_json["addresses"]&.map do |item|
    item = item.to_json
    CandidApiClient::OrganizationProviders::V2::Types::OrganizationProviderAddress.from_json(json_object: item)
  end
  employment_start_date = unless parsed_json["employment_start_date"].nil?
                            Date.parse(parsed_json["employment_start_date"])
                          end
  employment_termination_date = unless parsed_json["employment_termination_date"].nil?
                                  Date.parse(parsed_json["employment_termination_date"])
                                end
  qualifications = parsed_json["qualifications"]&.map do |item|
    item = item.to_json
    CandidApiClient::Identifiers::Types::IdentifierCreate.from_json(json_object: item)
  end
  new(
    npi: npi,
    is_rendering: is_rendering,
    is_billing: is_billing,
    first_name: first_name,
    last_name: last_name,
    organization_name: organization_name,
    provider_type: provider_type,
    tax_id: tax_id,
    taxonomy_code: taxonomy_code,
    license_type: license_type,
    addresses: addresses,
    employment_start_date: employment_start_date,
    employment_termination_date: employment_termination_date,
    qualifications: qualifications,
    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.


174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/candidhealth/organization_providers/v_3/types/organization_provider_create_v_2.rb', line 174

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.is_rendering.is_a?(Boolean) != false || raise("Passed value for field obj.is_rendering is not the expected type, validation failed.")
  obj.is_billing.is_a?(Boolean) != false || raise("Passed value for field obj.is_billing 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.")
  obj.provider_type.is_a?(CandidApiClient::OrganizationProviders::V2::Types::ProviderType) != false || raise("Passed value for field obj.provider_type is not the expected type, validation failed.")
  obj.tax_id&.is_a?(String) != false || raise("Passed value for field obj.tax_id 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.license_type.is_a?(CandidApiClient::OrganizationProviders::V2::Types::LicenseType) != false || raise("Passed value for field obj.license_type 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.employment_start_date&.is_a?(Date) != false || raise("Passed value for field obj.employment_start_date is not the expected type, validation failed.")
  obj.employment_termination_date&.is_a?(Date) != false || raise("Passed value for field obj.employment_termination_date is not the expected type, validation failed.")
  obj.qualifications.is_a?(Array) != false || raise("Passed value for field obj.qualifications is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of OrganizationProviderCreateV2 to a JSON object



164
165
166
# File 'lib/candidhealth/organization_providers/v_3/types/organization_provider_create_v_2.rb', line 164

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