Class: Merge::Accounting::PaymentLineItemRequest
- Inherits:
-
Object
- Object
- Merge::Accounting::PaymentLineItemRequest
- Defined in:
- lib/merge_ruby_client/accounting/types/payment_line_item_request.rb
Overview
# The PaymentLineItem Object
### Description
The `PaymentLineItem` object is an applied-to-line on a `Payment` that can
either be a `Invoice`, `CreditNote`, or `JournalEntry`.
### Usage Example
`Payment` will have a field called `applied-to-lines` which will be an array of
`PaymentLineItemInternalMappingSerializer` objects that can either be a
`Invoice`, `CreditNote`, or `JournalEntry`.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#applied_amount ⇒ String
readonly
The amount being applied to the transaction.
-
#applied_date ⇒ DateTime
readonly
The date the payment portion is applied.
- #integration_params ⇒ Hash{String => Object} readonly
- #linked_account_params ⇒ Hash{String => Object} readonly
-
#related_object_id ⇒ String
readonly
The Merge ID of the transaction the payment portion is being applied to.
-
#related_object_type ⇒ String
readonly
The type of transaction the payment portion is being applied to.
- #remote_fields ⇒ Array<Merge::Accounting::RemoteFieldRequest> readonly
-
#remote_id ⇒ String
readonly
The third-party API ID of the matching object.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Accounting::PaymentLineItemRequest
Deserialize a JSON object to an instance of PaymentLineItemRequest.
-
.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(remote_id: OMIT, applied_amount: OMIT, applied_date: OMIT, related_object_id: OMIT, related_object_type: OMIT, integration_params: OMIT, linked_account_params: OMIT, remote_fields: OMIT, additional_properties: nil) ⇒ Merge::Accounting::PaymentLineItemRequest constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of PaymentLineItemRequest to a JSON object.
Constructor Details
#initialize(remote_id: OMIT, applied_amount: OMIT, applied_date: OMIT, related_object_id: OMIT, related_object_type: OMIT, integration_params: OMIT, linked_account_params: OMIT, remote_fields: OMIT, additional_properties: nil) ⇒ Merge::Accounting::PaymentLineItemRequest
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/merge_ruby_client/accounting/types/payment_line_item_request.rb', line 55 def initialize(remote_id: OMIT, applied_amount: OMIT, applied_date: OMIT, related_object_id: OMIT, related_object_type: OMIT, integration_params: OMIT, linked_account_params: OMIT, remote_fields: OMIT, additional_properties: nil) @remote_id = remote_id if remote_id != OMIT @applied_amount = applied_amount if applied_amount != OMIT @applied_date = applied_date if applied_date != OMIT @related_object_id = if != OMIT @related_object_type = if != OMIT @integration_params = integration_params if integration_params != OMIT @linked_account_params = linked_account_params if linked_account_params != OMIT @remote_fields = remote_fields if remote_fields != OMIT @additional_properties = additional_properties @_field_set = { "remote_id": remote_id, "applied_amount": applied_amount, "applied_date": applied_date, "related_object_id": , "related_object_type": , "integration_params": integration_params, "linked_account_params": linked_account_params, "remote_fields": remote_fields }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
37 38 39 |
# File 'lib/merge_ruby_client/accounting/types/payment_line_item_request.rb', line 37 def additional_properties @additional_properties end |
#applied_amount ⇒ String (readonly)
Returns The amount being applied to the transaction.
22 23 24 |
# File 'lib/merge_ruby_client/accounting/types/payment_line_item_request.rb', line 22 def applied_amount @applied_amount end |
#applied_date ⇒ DateTime (readonly)
Returns The date the payment portion is applied.
24 25 26 |
# File 'lib/merge_ruby_client/accounting/types/payment_line_item_request.rb', line 24 def applied_date @applied_date end |
#integration_params ⇒ Hash{String => Object} (readonly)
31 32 33 |
# File 'lib/merge_ruby_client/accounting/types/payment_line_item_request.rb', line 31 def integration_params @integration_params end |
#linked_account_params ⇒ Hash{String => Object} (readonly)
33 34 35 |
# File 'lib/merge_ruby_client/accounting/types/payment_line_item_request.rb', line 33 def linked_account_params @linked_account_params end |
#related_object_id ⇒ String (readonly)
Returns The Merge ID of the transaction the payment portion is being applied to.
26 27 28 |
# File 'lib/merge_ruby_client/accounting/types/payment_line_item_request.rb', line 26 def @related_object_id end |
#related_object_type ⇒ String (readonly)
Returns The type of transaction the payment portion is being applied to. Possible values include: INVOICE, JOURNAL_ENTRY, or CREDIT_NOTE.
29 30 31 |
# File 'lib/merge_ruby_client/accounting/types/payment_line_item_request.rb', line 29 def @related_object_type end |
#remote_fields ⇒ Array<Merge::Accounting::RemoteFieldRequest> (readonly)
35 36 37 |
# File 'lib/merge_ruby_client/accounting/types/payment_line_item_request.rb', line 35 def remote_fields @remote_fields end |
#remote_id ⇒ String (readonly)
Returns The third-party API ID of the matching object.
20 21 22 |
# File 'lib/merge_ruby_client/accounting/types/payment_line_item_request.rb', line 20 def remote_id @remote_id end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Accounting::PaymentLineItemRequest
Deserialize a JSON object to an instance of PaymentLineItemRequest
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/merge_ruby_client/accounting/types/payment_line_item_request.rb', line 84 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) remote_id = parsed_json["remote_id"] applied_amount = parsed_json["applied_amount"] applied_date = (DateTime.parse(parsed_json["applied_date"]) unless parsed_json["applied_date"].nil?) = parsed_json["related_object_id"] = parsed_json["related_object_type"] integration_params = parsed_json["integration_params"] linked_account_params = parsed_json["linked_account_params"] remote_fields = parsed_json["remote_fields"]&.map do |item| item = item.to_json Merge::Accounting::RemoteFieldRequest.from_json(json_object: item) end new( remote_id: remote_id, applied_amount: applied_amount, applied_date: applied_date, related_object_id: , related_object_type: , integration_params: integration_params, linked_account_params: linked_account_params, remote_fields: remote_fields, 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.
124 125 126 127 128 129 130 131 132 133 |
# File 'lib/merge_ruby_client/accounting/types/payment_line_item_request.rb', line 124 def self.validate_raw(obj:) obj.remote_id&.is_a?(String) != false || raise("Passed value for field obj.remote_id is not the expected type, validation failed.") obj.applied_amount&.is_a?(String) != false || raise("Passed value for field obj.applied_amount is not the expected type, validation failed.") obj.applied_date&.is_a?(DateTime) != false || raise("Passed value for field obj.applied_date is not the expected type, validation failed.") obj.&.is_a?(String) != false || raise("Passed value for field obj.related_object_id is not the expected type, validation failed.") obj.&.is_a?(String) != false || raise("Passed value for field obj.related_object_type is not the expected type, validation failed.") obj.integration_params&.is_a?(Hash) != false || raise("Passed value for field obj.integration_params is not the expected type, validation failed.") obj.linked_account_params&.is_a?(Hash) != false || raise("Passed value for field obj.linked_account_params is not the expected type, validation failed.") obj.remote_fields&.is_a?(Array) != false || raise("Passed value for field obj.remote_fields is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of PaymentLineItemRequest to a JSON object
114 115 116 |
# File 'lib/merge_ruby_client/accounting/types/payment_line_item_request.rb', line 114 def to_json(*_args) @_field_set&.to_json end |