Class: CandidApiClient::Invoices::Types::Invoice
- Inherits:
-
Object
- Object
- CandidApiClient::Invoices::Types::Invoice
- Defined in:
- lib/candidhealth/invoices/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.
- #created_at ⇒ DateTime readonly
- #customer_invoice_url ⇒ String readonly
- #due_date ⇒ String readonly
- #id ⇒ String readonly
- #items ⇒ Array<CandidApiClient::Invoices::Types::InvoiceItem> readonly
- #note ⇒ String readonly
- #organzation_id ⇒ String readonly
- #patient_external_id ⇒ String readonly
- #source_customer_id ⇒ String readonly
- #source_id ⇒ String readonly
- #status ⇒ CandidApiClient::Invoices::Types::InvoiceStatus readonly
- #updated_at ⇒ DateTime readonly
- #url ⇒ String readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ CandidApiClient::Invoices::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(id:, created_at:, updated_at:, organzation_id:, source_id:, source_customer_id:, patient_external_id:, due_date:, status:, items:, note: OMIT, url: OMIT, customer_invoice_url: OMIT, additional_properties: nil) ⇒ CandidApiClient::Invoices::Types::Invoice constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of Invoice to a JSON object.
Constructor Details
#initialize(id:, created_at:, updated_at:, organzation_id:, source_id:, source_customer_id:, patient_external_id:, due_date:, status:, items:, note: OMIT, url: OMIT, customer_invoice_url: OMIT, additional_properties: nil) ⇒ CandidApiClient::Invoices::Types::Invoice
62 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 95 |
# File 'lib/candidhealth/invoices/types/invoice.rb', line 62 def initialize(id:, created_at:, updated_at:, organzation_id:, source_id:, source_customer_id:, patient_external_id:, due_date:, status:, items:, note: OMIT, url: OMIT, customer_invoice_url: OMIT, additional_properties: nil) @id = id @created_at = created_at @updated_at = updated_at @organzation_id = organzation_id @source_id = source_id @source_customer_id = source_customer_id @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 = { "id": id, "created_at": created_at, "updated_at": updated_at, "organzation_id": organzation_id, "source_id": source_id, "source_customer_id": source_customer_id, "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.
40 41 42 |
# File 'lib/candidhealth/invoices/types/invoice.rb', line 40 def additional_properties @additional_properties end |
#created_at ⇒ DateTime (readonly)
16 17 18 |
# File 'lib/candidhealth/invoices/types/invoice.rb', line 16 def created_at @created_at end |
#customer_invoice_url ⇒ String (readonly)
36 37 38 |
# File 'lib/candidhealth/invoices/types/invoice.rb', line 36 def customer_invoice_url @customer_invoice_url end |
#due_date ⇒ String (readonly)
30 31 32 |
# File 'lib/candidhealth/invoices/types/invoice.rb', line 30 def due_date @due_date end |
#id ⇒ String (readonly)
14 15 16 |
# File 'lib/candidhealth/invoices/types/invoice.rb', line 14 def id @id end |
#items ⇒ Array<CandidApiClient::Invoices::Types::InvoiceItem> (readonly)
38 39 40 |
# File 'lib/candidhealth/invoices/types/invoice.rb', line 38 def items @items end |
#note ⇒ String (readonly)
28 29 30 |
# File 'lib/candidhealth/invoices/types/invoice.rb', line 28 def note @note end |
#organzation_id ⇒ String (readonly)
20 21 22 |
# File 'lib/candidhealth/invoices/types/invoice.rb', line 20 def organzation_id @organzation_id end |
#patient_external_id ⇒ String (readonly)
26 27 28 |
# File 'lib/candidhealth/invoices/types/invoice.rb', line 26 def patient_external_id @patient_external_id end |
#source_customer_id ⇒ String (readonly)
24 25 26 |
# File 'lib/candidhealth/invoices/types/invoice.rb', line 24 def source_customer_id @source_customer_id end |
#source_id ⇒ String (readonly)
22 23 24 |
# File 'lib/candidhealth/invoices/types/invoice.rb', line 22 def source_id @source_id end |
#status ⇒ CandidApiClient::Invoices::Types::InvoiceStatus (readonly)
32 33 34 |
# File 'lib/candidhealth/invoices/types/invoice.rb', line 32 def status @status end |
#updated_at ⇒ DateTime (readonly)
18 19 20 |
# File 'lib/candidhealth/invoices/types/invoice.rb', line 18 def updated_at @updated_at end |
#url ⇒ String (readonly)
34 35 36 |
# File 'lib/candidhealth/invoices/types/invoice.rb', line 34 def url @url end |
Class Method Details
.from_json(json_object:) ⇒ CandidApiClient::Invoices::Types::Invoice
Deserialize a JSON object to an instance of Invoice
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 |
# File 'lib/candidhealth/invoices/types/invoice.rb', line 101 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = struct["id"] 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?) organzation_id = struct["organzation_id"] source_id = struct["source_id"] source_customer_id = struct["source_customer_id"] patient_external_id = struct["patient_external_id"] note = struct["note"] due_date = struct["due_date"] status = struct["status"] url = struct["url"] customer_invoice_url = struct["customer_invoice_url"] items = parsed_json["items"]&.map do |item| item = item.to_json CandidApiClient::Invoices::Types::InvoiceItem.from_json(json_object: item) end new( id: id, created_at: created_at, updated_at: updated_at, organzation_id: organzation_id, source_id: source_id, source_customer_id: source_customer_id, 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.
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/candidhealth/invoices/types/invoice.rb', line 151 def self.validate_raw(obj:) obj.id.is_a?(String) != false || raise("Passed value for field obj.id 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.organzation_id.is_a?(String) != false || raise("Passed value for field obj.organzation_id is not the expected type, validation failed.") obj.source_id.is_a?(String) != false || raise("Passed value for field obj.source_id is not the expected type, validation failed.") obj.source_customer_id.is_a?(String) != false || raise("Passed value for field obj.source_customer_id is not the expected type, validation failed.") 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?(String) != false || raise("Passed value for field obj.due_date is not the expected type, validation failed.") obj.status.is_a?(CandidApiClient::Invoices::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.") obj.items.is_a?(Array) != false || raise("Passed value for field obj.items is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of Invoice to a JSON object
141 142 143 |
# File 'lib/candidhealth/invoices/types/invoice.rb', line 141 def to_json(*_args) @_field_set&.to_json end |