Class: CandidApiClient::Invoices::Types::Invoice

Inherits:
Object
  • Object
show all
Defined in:
lib/candidhealth/invoices/types/invoice.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

Parameters:

  • id (String)
  • created_at (DateTime)
  • updated_at (DateTime)
  • organzation_id (String)
  • source_id (String)
  • source_customer_id (String)
  • patient_external_id (String)
  • note (String) (defaults to: OMIT)
  • due_date (String)
  • status (CandidApiClient::Invoices::Types::InvoiceStatus)
  • url (String) (defaults to: OMIT)
  • customer_invoice_url (String) (defaults to: OMIT)
  • items (Array<CandidApiClient::Invoices::Types::InvoiceItem>)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    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_atDateTime (readonly)

Returns:

  • (DateTime)


16
17
18
# File 'lib/candidhealth/invoices/types/invoice.rb', line 16

def created_at
  @created_at
end

#customer_invoice_urlString (readonly)

Returns:

  • (String)


36
37
38
# File 'lib/candidhealth/invoices/types/invoice.rb', line 36

def customer_invoice_url
  @customer_invoice_url
end

#due_dateString (readonly)

Returns:

  • (String)


30
31
32
# File 'lib/candidhealth/invoices/types/invoice.rb', line 30

def due_date
  @due_date
end

#idString (readonly)

Returns:

  • (String)


14
15
16
# File 'lib/candidhealth/invoices/types/invoice.rb', line 14

def id
  @id
end

#itemsArray<CandidApiClient::Invoices::Types::InvoiceItem> (readonly)



38
39
40
# File 'lib/candidhealth/invoices/types/invoice.rb', line 38

def items
  @items
end

#noteString (readonly)

Returns:

  • (String)


28
29
30
# File 'lib/candidhealth/invoices/types/invoice.rb', line 28

def note
  @note
end

#organzation_idString (readonly)

Returns:

  • (String)


20
21
22
# File 'lib/candidhealth/invoices/types/invoice.rb', line 20

def organzation_id
  @organzation_id
end

#patient_external_idString (readonly)

Returns:

  • (String)


26
27
28
# File 'lib/candidhealth/invoices/types/invoice.rb', line 26

def patient_external_id
  @patient_external_id
end

#source_customer_idString (readonly)

Returns:

  • (String)


24
25
26
# File 'lib/candidhealth/invoices/types/invoice.rb', line 24

def source_customer_id
  @source_customer_id
end

#source_idString (readonly)

Returns:

  • (String)


22
23
24
# File 'lib/candidhealth/invoices/types/invoice.rb', line 22

def source_id
  @source_id
end

#statusCandidApiClient::Invoices::Types::InvoiceStatus (readonly)



32
33
34
# File 'lib/candidhealth/invoices/types/invoice.rb', line 32

def status
  @status
end

#updated_atDateTime (readonly)

Returns:

  • (DateTime)


18
19
20
# File 'lib/candidhealth/invoices/types/invoice.rb', line 18

def updated_at
  @updated_at
end

#urlString (readonly)

Returns:

  • (String)


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

Parameters:

  • json_object (String)

Returns:



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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


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

Returns:

  • (String)


141
142
143
# File 'lib/candidhealth/invoices/types/invoice.rb', line 141

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