Class: CandidApiClient::ImportInvoice::V1::Types::InvoiceItemInfoUpdate

Inherits:
Object
  • Object
show all
Defined in:
lib/candidhealth/import_invoice/v_1/types/invoice_item_info_update.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(update_type:, items:, additional_properties: nil) ⇒ CandidApiClient::ImportInvoice::V1::Types::InvoiceItemInfoUpdate

Parameters:



33
34
35
36
37
38
# File 'lib/candidhealth/import_invoice/v_1/types/invoice_item_info_update.rb', line 33

def initialize(update_type:, items:, additional_properties: nil)
  @update_type = update_type
  @items = items
  @additional_properties = additional_properties
  @_field_set = { "update_type": update_type, "items": items }
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/import_invoice/v_1/types/invoice_item_info_update.rb', line 20

def additional_properties
  @additional_properties
end

#itemsArray<CandidApiClient::Invoices::V2::Types::InvoiceItemCreate> (readonly)



18
19
20
# File 'lib/candidhealth/import_invoice/v_1/types/invoice_item_info_update.rb', line 18

def items
  @items
end

#update_typeCandidApiClient::ImportInvoice::V1::Types::InvoiceItemUpdateType (readonly)

Returns The only supported update operations for invoice items is to either overwrite the entire list of invoice items or to append new invoice items.

Returns:



16
17
18
# File 'lib/candidhealth/import_invoice/v_1/types/invoice_item_info_update.rb', line 16

def update_type
  @update_type
end

Class Method Details

.from_json(json_object:) ⇒ CandidApiClient::ImportInvoice::V1::Types::InvoiceItemInfoUpdate

Deserialize a JSON object to an instance of InvoiceItemInfoUpdate

Parameters:

  • json_object (String)

Returns:



44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/candidhealth/import_invoice/v_1/types/invoice_item_info_update.rb', line 44

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  update_type = struct["update_type"]
  items = parsed_json["items"]&.map do |item|
    item = item.to_json
    CandidApiClient::Invoices::V2::Types::InvoiceItemCreate.from_json(json_object: item)
  end
  new(
    update_type: update_type,
    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)


72
73
74
75
# File 'lib/candidhealth/import_invoice/v_1/types/invoice_item_info_update.rb', line 72

def self.validate_raw(obj:)
  obj.update_type.is_a?(CandidApiClient::ImportInvoice::V1::Types::InvoiceItemUpdateType) != false || raise("Passed value for field obj.update_type 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 InvoiceItemInfoUpdate to a JSON object

Returns:

  • (String)


62
63
64
# File 'lib/candidhealth/import_invoice/v_1/types/invoice_item_info_update.rb', line 62

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