Class: CandidApiClient::Invoices::V2::Types::Invoice
- Inherits:
-
Object
- Object
- CandidApiClient::Invoices::V2::Types::Invoice
- Defined in:
- lib/candidhealth/invoices/v_2/types/invoice.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#amount_cents ⇒ Integer
readonly
Total monetary amount (in cents) of all Invoice Items.
- #created_at ⇒ DateTime readonly
-
#customer_invoice_url ⇒ String
readonly
Link to the patient view of the invoice in the third-party service.
- #due_date ⇒ Date readonly
-
#invoice_destination_metadata ⇒ CandidApiClient::Invoices::V2::Types::InvoiceDestinationMetadata
readonly
Contains all relevant information from the third-party service this invoice was created in.
-
#items ⇒ CandidApiClient::Invoices::V2::Types::InvoiceItemInfo
readonly
The InvoiceItem rollup which contains all claim and service line invoice items.
- #note ⇒ String readonly
- #organization_id ⇒ String readonly
- #patient_external_id ⇒ String readonly
- #status ⇒ CandidApiClient::Invoices::V2::Types::InvoiceStatus readonly
- #updated_at ⇒ DateTime readonly
-
#url ⇒ String
readonly
Link to the admin view of the invoice in the third-party service.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ CandidApiClient::Invoices::V2::Types::Invoice
Deserialize a JSON object to an instance of Invoice.
-
.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(amount_cents:, created_at:, updated_at:, organization_id:, invoice_destination_metadata:, patient_external_id:, due_date:, status:, items:, note: OMIT, url: OMIT, customer_invoice_url: OMIT, additional_properties: nil) ⇒ CandidApiClient::Invoices::V2::Types::Invoice constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of Invoice to a JSON object.
Constructor Details
#initialize(amount_cents:, created_at:, updated_at:, organization_id:, invoice_destination_metadata:, patient_external_id:, due_date:, status:, items:, note: OMIT, url: OMIT, customer_invoice_url: OMIT, additional_properties: nil) ⇒ CandidApiClient::Invoices::V2::Types::Invoice
63 64 65 66 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 |
# File 'lib/candidhealth/invoices/v_2/types/invoice.rb', line 63 def initialize(amount_cents:, created_at:, updated_at:, organization_id:, invoice_destination_metadata:, patient_external_id:, due_date:, status:, items:, note: OMIT, url: OMIT, customer_invoice_url: OMIT, additional_properties: nil) @amount_cents = amount_cents @created_at = created_at @updated_at = updated_at @organization_id = organization_id @invoice_destination_metadata = @patient_external_id = patient_external_id @note = note if note != OMIT @due_date = due_date @status = status @url = url if url != OMIT @customer_invoice_url = customer_invoice_url if customer_invoice_url != OMIT @items = items @additional_properties = additional_properties @_field_set = { "amount_cents": amount_cents, "created_at": created_at, "updated_at": updated_at, "organization_id": organization_id, "invoice_destination_metadata": , "patient_external_id": patient_external_id, "note": note, "due_date": due_date, "status": status, "url": url, "customer_invoice_url": customer_invoice_url, "items": items }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
41 42 43 |
# File 'lib/candidhealth/invoices/v_2/types/invoice.rb', line 41 def additional_properties @additional_properties end |
#amount_cents ⇒ Integer (readonly)
Returns Total monetary amount (in cents) of all Invoice Items.
16 17 18 |
# File 'lib/candidhealth/invoices/v_2/types/invoice.rb', line 16 def amount_cents @amount_cents end |
#created_at ⇒ DateTime (readonly)
18 19 20 |
# File 'lib/candidhealth/invoices/v_2/types/invoice.rb', line 18 def created_at @created_at end |
#customer_invoice_url ⇒ String (readonly)
Returns Link to the patient view of the invoice in the third-party service.
37 38 39 |
# File 'lib/candidhealth/invoices/v_2/types/invoice.rb', line 37 def customer_invoice_url @customer_invoice_url end |
#due_date ⇒ Date (readonly)
31 32 33 |
# File 'lib/candidhealth/invoices/v_2/types/invoice.rb', line 31 def due_date @due_date end |
#invoice_destination_metadata ⇒ CandidApiClient::Invoices::V2::Types::InvoiceDestinationMetadata (readonly)
Returns Contains all relevant information from the third-party service this invoice was created in.
25 26 27 |
# File 'lib/candidhealth/invoices/v_2/types/invoice.rb', line 25 def @invoice_destination_metadata end |
#items ⇒ CandidApiClient::Invoices::V2::Types::InvoiceItemInfo (readonly)
Returns The InvoiceItem rollup which contains all claim and service line invoice items.
39 40 41 |
# File 'lib/candidhealth/invoices/v_2/types/invoice.rb', line 39 def items @items end |
#note ⇒ String (readonly)
29 30 31 |
# File 'lib/candidhealth/invoices/v_2/types/invoice.rb', line 29 def note @note end |
#organization_id ⇒ String (readonly)
22 23 24 |
# File 'lib/candidhealth/invoices/v_2/types/invoice.rb', line 22 def organization_id @organization_id end |
#patient_external_id ⇒ String (readonly)
27 28 29 |
# File 'lib/candidhealth/invoices/v_2/types/invoice.rb', line 27 def patient_external_id @patient_external_id end |
#status ⇒ CandidApiClient::Invoices::V2::Types::InvoiceStatus (readonly)
33 34 35 |
# File 'lib/candidhealth/invoices/v_2/types/invoice.rb', line 33 def status @status end |
#updated_at ⇒ DateTime (readonly)
20 21 22 |
# File 'lib/candidhealth/invoices/v_2/types/invoice.rb', line 20 def updated_at @updated_at end |
#url ⇒ String (readonly)
Returns Link to the admin view of the invoice in the third-party service.
35 36 37 |
# File 'lib/candidhealth/invoices/v_2/types/invoice.rb', line 35 def url @url end |
Class Method Details
.from_json(json_object:) ⇒ CandidApiClient::Invoices::V2::Types::Invoice
Deserialize a JSON object to an instance of Invoice
100 101 102 103 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 |
# File 'lib/candidhealth/invoices/v_2/types/invoice.rb', line 100 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) amount_cents = struct["amount_cents"] created_at = (DateTime.parse(parsed_json["created_at"]) unless parsed_json["created_at"].nil?) updated_at = (DateTime.parse(parsed_json["updated_at"]) unless parsed_json["updated_at"].nil?) organization_id = struct["organization_id"] if parsed_json["invoice_destination_metadata"].nil? = nil else = parsed_json["invoice_destination_metadata"].to_json = CandidApiClient::Invoices::V2::Types::InvoiceDestinationMetadata.from_json(json_object: ) end patient_external_id = struct["patient_external_id"] note = struct["note"] due_date = (Date.parse(parsed_json["due_date"]) unless parsed_json["due_date"].nil?) status = struct["status"] url = struct["url"] customer_invoice_url = struct["customer_invoice_url"] if parsed_json["items"].nil? items = nil else items = parsed_json["items"].to_json items = CandidApiClient::Invoices::V2::Types::InvoiceItemInfo.from_json(json_object: items) end new( amount_cents: amount_cents, created_at: created_at, updated_at: updated_at, organization_id: organization_id, invoice_destination_metadata: , patient_external_id: patient_external_id, note: note, due_date: due_date, status: status, url: url, customer_invoice_url: customer_invoice_url, items: items, 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.
155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/candidhealth/invoices/v_2/types/invoice.rb', line 155 def self.validate_raw(obj:) obj.amount_cents.is_a?(Integer) != false || raise("Passed value for field obj.amount_cents is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") obj.organization_id.is_a?(String) != false || raise("Passed value for field obj.organization_id is not the expected type, validation failed.") CandidApiClient::Invoices::V2::Types::InvoiceDestinationMetadata.validate_raw(obj: obj.) obj.patient_external_id.is_a?(String) != false || raise("Passed value for field obj.patient_external_id is not the expected type, validation failed.") obj.note&.is_a?(String) != false || raise("Passed value for field obj.note is not the expected type, validation failed.") obj.due_date.is_a?(Date) != false || raise("Passed value for field obj.due_date is not the expected type, validation failed.") obj.status.is_a?(CandidApiClient::Invoices::V2::Types::InvoiceStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.") obj.url&.is_a?(String) != false || raise("Passed value for field obj.url is not the expected type, validation failed.") obj.customer_invoice_url&.is_a?(String) != false || raise("Passed value for field obj.customer_invoice_url is not the expected type, validation failed.") CandidApiClient::Invoices::V2::Types::InvoiceItemInfo.validate_raw(obj: obj.items) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of Invoice to a JSON object
145 146 147 |
# File 'lib/candidhealth/invoices/v_2/types/invoice.rb', line 145 def to_json(*_args) @_field_set&.to_json end |