Class: CandidApiClient::Financials::Types::AllocationTarget
- Inherits:
-
Object
- Object
- CandidApiClient::Financials::Types::AllocationTarget
- Defined in:
- lib/candidhealth/financials/types/allocation_target.rb
Overview
Allocation targets describe whether the portion of a payment is being applied
toward a specific service line,
claim, billing provider, or is unallocated.
Instance Attribute Summary collapse
- #discriminant ⇒ String readonly
- #member ⇒ Object readonly
Class Method Summary collapse
- .appointment(member:) ⇒ CandidApiClient::Financials::Types::AllocationTarget
- .billing_provider_id(member:) ⇒ CandidApiClient::Financials::Types::AllocationTarget
- .claim(member:) ⇒ CandidApiClient::Financials::Types::AllocationTarget
-
.from_json(json_object:) ⇒ CandidApiClient::Financials::Types::AllocationTarget
Deserialize a JSON object to an instance of AllocationTarget.
- .service_line(member:) ⇒ CandidApiClient::Financials::Types::AllocationTarget
- .unattributed ⇒ CandidApiClient::Financials::Types::AllocationTarget
-
.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.
Instance Method Summary collapse
- #initialize(member:, discriminant:) ⇒ CandidApiClient::Financials::Types::AllocationTarget constructor
-
#is_a?(obj) ⇒ Boolean
For Union Types, is_a? functionality is delegated to the wrapped member.
- #kind_of? ⇒ Object
-
#to_json(*_args) ⇒ String
For Union Types, to_json functionality is delegated to the wrapped member.
Constructor Details
#initialize(member:, discriminant:) ⇒ CandidApiClient::Financials::Types::AllocationTarget
27 28 29 30 |
# File 'lib/candidhealth/financials/types/allocation_target.rb', line 27 def initialize(member:, discriminant:) @member = member @discriminant = discriminant end |
Instance Attribute Details
#discriminant ⇒ String (readonly)
19 20 21 |
# File 'lib/candidhealth/financials/types/allocation_target.rb', line 19 def discriminant @discriminant end |
#member ⇒ Object (readonly)
17 18 19 |
# File 'lib/candidhealth/financials/types/allocation_target.rb', line 17 def member @member end |
Class Method Details
.appointment(member:) ⇒ CandidApiClient::Financials::Types::AllocationTarget
127 128 129 |
# File 'lib/candidhealth/financials/types/allocation_target.rb', line 127 def self.appointment(member:) new(member: member, discriminant: "appointment") end |
.billing_provider_id(member:) ⇒ CandidApiClient::Financials::Types::AllocationTarget
121 122 123 |
# File 'lib/candidhealth/financials/types/allocation_target.rb', line 121 def self.billing_provider_id(member:) new(member: member, discriminant: "billing_provider_id") end |
.claim(member:) ⇒ CandidApiClient::Financials::Types::AllocationTarget
115 116 117 |
# File 'lib/candidhealth/financials/types/allocation_target.rb', line 115 def self.claim(member:) new(member: member, discriminant: "claim") end |
.from_json(json_object:) ⇒ CandidApiClient::Financials::Types::AllocationTarget
Deserialize a JSON object to an instance of AllocationTarget
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/candidhealth/financials/types/allocation_target.rb', line 36 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) member = case struct.type when "service_line" CandidApiClient::Financials::Types::ServiceLineAllocationTarget.from_json(json_object: json_object) when "claim" CandidApiClient::Financials::Types::ClaimAllocationTarget.from_json(json_object: json_object) when "billing_provider_id" CandidApiClient::Financials::Types::BillingProviderAllocationTarget.from_json(json_object: json_object) when "appointment" CandidApiClient::Financials::Types::AppointmentAllocationTarget.from_json(json_object: json_object) when "unattributed" nil else CandidApiClient::Financials::Types::ServiceLineAllocationTarget.from_json(json_object: json_object) end new(member: member, discriminant: struct.type) end |
.service_line(member:) ⇒ CandidApiClient::Financials::Types::AllocationTarget
109 110 111 |
# File 'lib/candidhealth/financials/types/allocation_target.rb', line 109 def self.service_line(member:) new(member: member, discriminant: "service_line") end |
.unattributed ⇒ CandidApiClient::Financials::Types::AllocationTarget
132 133 134 |
# File 'lib/candidhealth/financials/types/allocation_target.rb', line 132 def self.unattributed new(member: nil, discriminant: "unattributed") 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.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/candidhealth/financials/types/allocation_target.rb', line 82 def self.validate_raw(obj:) case obj.type when "service_line" CandidApiClient::Financials::Types::ServiceLineAllocationTarget.validate_raw(obj: obj) when "claim" CandidApiClient::Financials::Types::ClaimAllocationTarget.validate_raw(obj: obj) when "billing_provider_id" CandidApiClient::Financials::Types::BillingProviderAllocationTarget.validate_raw(obj: obj) when "appointment" CandidApiClient::Financials::Types::AppointmentAllocationTarget.validate_raw(obj: obj) when "unattributed" # noop else raise("Passed value matched no type within the union, validation failed.") end end |
Instance Method Details
#is_a?(obj) ⇒ Boolean
For Union Types, is_a? functionality is delegated to the wrapped member.
103 104 105 |
# File 'lib/candidhealth/financials/types/allocation_target.rb', line 103 def is_a?(obj) @member.is_a?(obj) end |
#kind_of? ⇒ Object
22 |
# File 'lib/candidhealth/financials/types/allocation_target.rb', line 22 alias kind_of? is_a? |
#to_json(*_args) ⇒ String
For Union Types, to_json functionality is delegated to the wrapped member.
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/candidhealth/financials/types/allocation_target.rb', line 58 def to_json(*_args) case @discriminant when "service_line" { **@member.to_json, type: @discriminant }.to_json when "claim" { **@member.to_json, type: @discriminant }.to_json when "billing_provider_id" { **@member.to_json, type: @discriminant }.to_json when "appointment" { **@member.to_json, type: @discriminant }.to_json when "unattributed" { type: @discriminant }.to_json else { "type": @discriminant, value: @member }.to_json end @member.to_json end |