Class: CandidApiClient::Invoices::V2::Types::InvoiceDestinationMetadata

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(invoice_destination:, source_id:, source_customer_id:, destination_status: OMIT, additional_properties: nil) ⇒ CandidApiClient::Invoices::V2::Types::InvoiceDestinationMetadata

Parameters:

  • invoice_destination (CandidApiClient::Invoices::V2::Types::InvoiceDestination)

    Defines which third-party service this invoice was created in

  • source_id (String)

    The id of the invoice in the third-party service

  • source_customer_id (String)

    The id of the customer that the invoice is attributed to in the third-party service

  • destination_status (String) (defaults to: OMIT)

    The status of the invoice in the third-party service

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/candidhealth/invoices/v_2/types/invoice_destination_metadata.rb', line 36

def initialize(invoice_destination:, source_id:, source_customer_id:, destination_status: OMIT,
               additional_properties: nil)
  @invoice_destination = invoice_destination
  @source_id = source_id
  @source_customer_id = source_customer_id
  @destination_status = destination_status if destination_status != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "invoice_destination": invoice_destination,
    "source_id": source_id,
    "source_customer_id": source_customer_id,
    "destination_status": destination_status
  }.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



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

def additional_properties
  @additional_properties
end

#destination_statusString (readonly)

Returns The status of the invoice in the third-party service.

Returns:

  • (String)

    The status of the invoice in the third-party service



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

def destination_status
  @destination_status
end

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

Returns Defines which third-party service this invoice was created in.

Returns:



13
14
15
# File 'lib/candidhealth/invoices/v_2/types/invoice_destination_metadata.rb', line 13

def invoice_destination
  @invoice_destination
end

#source_customer_idString (readonly)

Returns The id of the customer that the invoice is attributed to in the third-party service.

Returns:

  • (String)

    The id of the customer that the invoice is attributed to in the third-party service



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

def source_customer_id
  @source_customer_id
end

#source_idString (readonly)

Returns The id of the invoice in the third-party service.

Returns:

  • (String)

    The id of the invoice in the third-party service



15
16
17
# File 'lib/candidhealth/invoices/v_2/types/invoice_destination_metadata.rb', line 15

def source_id
  @source_id
end

Class Method Details

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

Deserialize a JSON object to an instance of InvoiceDestinationMetadata

Parameters:

  • json_object (String)

Returns:



57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/candidhealth/invoices/v_2/types/invoice_destination_metadata.rb', line 57

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  invoice_destination = struct["invoice_destination"]
  source_id = struct["source_id"]
  source_customer_id = struct["source_customer_id"]
  destination_status = struct["destination_status"]
  new(
    invoice_destination: invoice_destination,
    source_id: source_id,
    source_customer_id: source_customer_id,
    destination_status: destination_status,
    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)


85
86
87
88
89
90
# File 'lib/candidhealth/invoices/v_2/types/invoice_destination_metadata.rb', line 85

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

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of InvoiceDestinationMetadata to a JSON object

Returns:

  • (String)


75
76
77
# File 'lib/candidhealth/invoices/v_2/types/invoice_destination_metadata.rb', line 75

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