Class: CandidApiClient::Contracts::V2::Types::Contract

Inherits:
Object
  • Object
show all
Defined in:
lib/candidhealth/contracts/v_2/types/contract.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(contract_id:, contracting_provider:, provider_count:, payer:, effective_date:, regions:, commercial_insurance_types:, medicare_insurance_types:, medicaid_insurance_types:, expiration_date: OMIT, contract_status: OMIT, authorized_signatory: OMIT, additional_properties: nil) ⇒ CandidApiClient::Contracts::V2::Types::Contract

Parameters:



67
68
69
70
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
# File 'lib/candidhealth/contracts/v_2/types/contract.rb', line 67

def initialize(contract_id:, contracting_provider:, provider_count:, payer:, effective_date:, regions:, commercial_insurance_types:, medicare_insurance_types:, medicaid_insurance_types:,
               expiration_date: OMIT, contract_status: OMIT, authorized_signatory: OMIT, additional_properties: nil)
  @contract_id = contract_id
  @contracting_provider = contracting_provider
  @provider_count = provider_count
  @payer = payer
  @effective_date = effective_date
  @expiration_date = expiration_date if expiration_date != OMIT
  @regions = regions
  @contract_status = contract_status if contract_status != OMIT
  @authorized_signatory = authorized_signatory if authorized_signatory != OMIT
  @commercial_insurance_types = commercial_insurance_types
  @medicare_insurance_types = medicare_insurance_types
  @medicaid_insurance_types = medicaid_insurance_types
  @additional_properties = additional_properties
  @_field_set = {
    "contract_id": contract_id,
    "contracting_provider": contracting_provider,
    "provider_count": provider_count,
    "payer": payer,
    "effective_date": effective_date,
    "expiration_date": expiration_date,
    "regions": regions,
    "contract_status": contract_status,
    "authorized_signatory": authorized_signatory,
    "commercial_insurance_types": commercial_insurance_types,
    "medicare_insurance_types": medicare_insurance_types,
    "medicaid_insurance_types": medicaid_insurance_types
  }.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



44
45
46
# File 'lib/candidhealth/contracts/v_2/types/contract.rb', line 44

def additional_properties
  @additional_properties
end

#authorized_signatoryCandidApiClient::Contracts::V2::Types::AuthorizedSignatory (readonly)



36
37
38
# File 'lib/candidhealth/contracts/v_2/types/contract.rb', line 36

def authorized_signatory
  @authorized_signatory
end

#commercial_insurance_typesCandidApiClient::Contracts::V2::Types::InsuranceTypes (readonly)

Returns The commercial plan insurance types this contract applies.

Returns:



38
39
40
# File 'lib/candidhealth/contracts/v_2/types/contract.rb', line 38

def commercial_insurance_types
  @commercial_insurance_types
end

#contract_idString (readonly)

Returns:

  • (String)


18
19
20
# File 'lib/candidhealth/contracts/v_2/types/contract.rb', line 18

def contract_id
  @contract_id
end

#contract_statusCandidApiClient::Contracts::V2::Types::ContractStatus (readonly)



34
35
36
# File 'lib/candidhealth/contracts/v_2/types/contract.rb', line 34

def contract_status
  @contract_status
end

#contracting_providerCandidApiClient::OrganizationProviders::V2::Types::OrganizationProvider (readonly)

Returns The provider under contract.



20
21
22
# File 'lib/candidhealth/contracts/v_2/types/contract.rb', line 20

def contracting_provider
  @contracting_provider
end

#effective_dateString (readonly)

Returns The starting day upon which the contract is effective.

Returns:

  • (String)

    The starting day upon which the contract is effective



27
28
29
# File 'lib/candidhealth/contracts/v_2/types/contract.rb', line 27

def effective_date
  @effective_date
end

#expiration_dateString (readonly)

Returns An optional end day upon which the contract expires.

Returns:

  • (String)

    An optional end day upon which the contract expires



29
30
31
# File 'lib/candidhealth/contracts/v_2/types/contract.rb', line 29

def expiration_date
  @expiration_date
end

#medicaid_insurance_typesCandidApiClient::Contracts::V2::Types::InsuranceTypes (readonly)

Returns The Medicaid plan insurance types this contract applies.

Returns:



42
43
44
# File 'lib/candidhealth/contracts/v_2/types/contract.rb', line 42

def medicaid_insurance_types
  @medicaid_insurance_types
end

#medicare_insurance_typesCandidApiClient::Contracts::V2::Types::InsuranceTypes (readonly)

Returns The Medicare plan insurance types this contract applies.

Returns:



40
41
42
# File 'lib/candidhealth/contracts/v_2/types/contract.rb', line 40

def medicare_insurance_types
  @medicare_insurance_types
end

#payerCandidApiClient::Payers::V3::Types::Payer (readonly)

Returns The insurance company under contract.

Returns:



25
26
27
# File 'lib/candidhealth/contracts/v_2/types/contract.rb', line 25

def payer
  @payer
end

#provider_countInteger (readonly)

Returns The number of linked providers who can render medical services under this contract.

Returns:

  • (Integer)

    The number of linked providers who can render medical services under this contract



23
24
25
# File 'lib/candidhealth/contracts/v_2/types/contract.rb', line 23

def provider_count
  @provider_count
end

#regionsCandidApiClient::Commons::Types::Regions (readonly)

Returns The state(s) to which the contract’s coverage extends. It may also be set to “national” for the entirety of the US.

Returns:



32
33
34
# File 'lib/candidhealth/contracts/v_2/types/contract.rb', line 32

def regions
  @regions
end

Class Method Details

.from_json(json_object:) ⇒ CandidApiClient::Contracts::V2::Types::Contract

Deserialize a JSON object to an instance of Contract

Parameters:

  • json_object (String)

Returns:



104
105
106
107
108
109
110
111
112
113
114
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
160
161
162
163
164
165
166
167
168
169
# File 'lib/candidhealth/contracts/v_2/types/contract.rb', line 104

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  contract_id = struct["contract_id"]
  if parsed_json["contracting_provider"].nil?
    contracting_provider = nil
  else
    contracting_provider = parsed_json["contracting_provider"].to_json
    contracting_provider = CandidApiClient::OrganizationProviders::V2::Types::OrganizationProvider.from_json(json_object: contracting_provider)
  end
  provider_count = struct["provider_count"]
  if parsed_json["payer"].nil?
    payer = nil
  else
    payer = parsed_json["payer"].to_json
    payer = CandidApiClient::Payers::V3::Types::Payer.from_json(json_object: payer)
  end
  effective_date = struct["effective_date"]
  expiration_date = struct["expiration_date"]
  if parsed_json["regions"].nil?
    regions = nil
  else
    regions = parsed_json["regions"].to_json
    regions = CandidApiClient::Commons::Types::Regions.from_json(json_object: regions)
  end
  contract_status = struct["contract_status"]
  if parsed_json["authorized_signatory"].nil?
    authorized_signatory = nil
  else
    authorized_signatory = parsed_json["authorized_signatory"].to_json
    authorized_signatory = CandidApiClient::Contracts::V2::Types::AuthorizedSignatory.from_json(json_object: authorized_signatory)
  end
  if parsed_json["commercial_insurance_types"].nil?
    commercial_insurance_types = nil
  else
    commercial_insurance_types = parsed_json["commercial_insurance_types"].to_json
    commercial_insurance_types = CandidApiClient::Contracts::V2::Types::InsuranceTypes.from_json(json_object: commercial_insurance_types)
  end
  if parsed_json["medicare_insurance_types"].nil?
    medicare_insurance_types = nil
  else
    medicare_insurance_types = parsed_json["medicare_insurance_types"].to_json
    medicare_insurance_types = CandidApiClient::Contracts::V2::Types::InsuranceTypes.from_json(json_object: medicare_insurance_types)
  end
  if parsed_json["medicaid_insurance_types"].nil?
    medicaid_insurance_types = nil
  else
    medicaid_insurance_types = parsed_json["medicaid_insurance_types"].to_json
    medicaid_insurance_types = CandidApiClient::Contracts::V2::Types::InsuranceTypes.from_json(json_object: medicaid_insurance_types)
  end
  new(
    contract_id: contract_id,
    contracting_provider: contracting_provider,
    provider_count: provider_count,
    payer: payer,
    effective_date: effective_date,
    expiration_date: expiration_date,
    regions: regions,
    contract_status: contract_status,
    authorized_signatory: authorized_signatory,
    commercial_insurance_types: commercial_insurance_types,
    medicare_insurance_types: medicare_insurance_types,
    medicaid_insurance_types: medicaid_insurance_types,
    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)


184
185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/candidhealth/contracts/v_2/types/contract.rb', line 184

def self.validate_raw(obj:)
  obj.contract_id.is_a?(String) != false || raise("Passed value for field obj.contract_id is not the expected type, validation failed.")
  CandidApiClient::OrganizationProviders::V2::Types::OrganizationProvider.validate_raw(obj: obj.contracting_provider)
  obj.provider_count.is_a?(Integer) != false || raise("Passed value for field obj.provider_count is not the expected type, validation failed.")
  CandidApiClient::Payers::V3::Types::Payer.validate_raw(obj: obj.payer)
  obj.effective_date.is_a?(String) != false || raise("Passed value for field obj.effective_date is not the expected type, validation failed.")
  obj.expiration_date&.is_a?(String) != false || raise("Passed value for field obj.expiration_date is not the expected type, validation failed.")
  CandidApiClient::Commons::Types::Regions.validate_raw(obj: obj.regions)
  obj.contract_status&.is_a?(CandidApiClient::Contracts::V2::Types::ContractStatus) != false || raise("Passed value for field obj.contract_status is not the expected type, validation failed.")
  obj.authorized_signatory.nil? || CandidApiClient::Contracts::V2::Types::AuthorizedSignatory.validate_raw(obj: obj.authorized_signatory)
  CandidApiClient::Contracts::V2::Types::InsuranceTypes.validate_raw(obj: obj.commercial_insurance_types)
  CandidApiClient::Contracts::V2::Types::InsuranceTypes.validate_raw(obj: obj.medicare_insurance_types)
  CandidApiClient::Contracts::V2::Types::InsuranceTypes.validate_raw(obj: obj.medicaid_insurance_types)
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of Contract to a JSON object

Returns:

  • (String)


174
175
176
# File 'lib/candidhealth/contracts/v_2/types/contract.rb', line 174

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