Class: CandidApiClient::Invoices::V2::Types::InvoiceInfo

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, invoice:, invoice_type:, additional_properties: nil) ⇒ CandidApiClient::Invoices::V2::Types::InvoiceInfo

Parameters:



32
33
34
35
36
37
38
# File 'lib/candidhealth/invoices/v_2/types/invoice_info.rb', line 32

def initialize(id:, invoice:, invoice_type:, additional_properties: nil)
  @id = id
  @invoice = invoice
  @invoice_type = invoice_type
  @additional_properties = additional_properties
  @_field_set = { "id": id, "invoice": invoice, "invoice_type": invoice_type }
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



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

def additional_properties
  @additional_properties
end

#idString (readonly)

Returns:

  • (String)


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

def id
  @id
end

#invoiceCandidApiClient::Invoices::V2::Types::Invoice (readonly)



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

def invoice
  @invoice
end

#invoice_typeCandidApiClient::Invoices::V2::Types::InvoiceDestination (readonly)



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

def invoice_type
  @invoice_type
end

Class Method Details

.from_json(json_object:) ⇒ CandidApiClient::Invoices::V2::Types::InvoiceInfo

Deserialize a JSON object to an instance of InvoiceInfo

Parameters:

  • json_object (String)

Returns:



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/candidhealth/invoices/v_2/types/invoice_info.rb', line 44

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  id = struct["id"]
  if parsed_json["invoice"].nil?
    invoice = nil
  else
    invoice = parsed_json["invoice"].to_json
    invoice = CandidApiClient::Invoices::V2::Types::Invoice.from_json(json_object: invoice)
  end
  invoice_type = struct["invoice_type"]
  new(
    id: id,
    invoice: invoice,
    invoice_type: invoice_type,
    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)


76
77
78
79
80
# File 'lib/candidhealth/invoices/v_2/types/invoice_info.rb', line 76

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.")
  CandidApiClient::Invoices::V2::Types::Invoice.validate_raw(obj: obj.invoice)
  obj.invoice_type.is_a?(CandidApiClient::Invoices::V2::Types::InvoiceDestination) != false || raise("Passed value for field obj.invoice_type is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of InvoiceInfo to a JSON object

Returns:

  • (String)


66
67
68
# File 'lib/candidhealth/invoices/v_2/types/invoice_info.rb', line 66

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