Class: Merge::Accounting::CreditNoteApplyLineForCreditNoteRequest
- Inherits:
-
Object
- Object
- Merge::Accounting::CreditNoteApplyLineForCreditNoteRequest
- Defined in:
- lib/merge_ruby_client/accounting/types/credit_note_apply_line_for_credit_note_request.rb
Overview
# The CreditNoteApplyLine Object
### Description
The `CreditNoteApplyLine` is attached to the CreditNote model.
### Usage Example
Fetch from the `GET CreditNote` endpoint and view the invoice's applied to
lines.
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 of the Credit Note applied to the invoice.
-
#applied_date ⇒ DateTime
readonly
Date that the credit note is applied to the invoice.
- #integration_params ⇒ Hash{String => Object} readonly
- #invoice ⇒ Merge::Accounting::CreditNoteApplyLineForCreditNoteRequestInvoice readonly
- #linked_account_params ⇒ Hash{String => Object} readonly
-
#remote_id ⇒ String
readonly
The third-party API ID of the matching object.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Accounting::CreditNoteApplyLineForCreditNoteRequest
Deserialize a JSON object to an instance of CreditNoteApplyLineForCreditNoteRequest.
-
.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, invoice: OMIT, applied_date: OMIT, applied_amount: OMIT, integration_params: OMIT, linked_account_params: OMIT, additional_properties: nil) ⇒ Merge::Accounting::CreditNoteApplyLineForCreditNoteRequest constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of CreditNoteApplyLineForCreditNoteRequest to a JSON object.
Constructor Details
#initialize(remote_id: OMIT, invoice: OMIT, applied_date: OMIT, applied_amount: OMIT, integration_params: OMIT, linked_account_params: OMIT, additional_properties: nil) ⇒ Merge::Accounting::CreditNoteApplyLineForCreditNoteRequest
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/merge_ruby_client/accounting/types/credit_note_apply_line_for_credit_note_request.rb', line 45 def initialize(remote_id: OMIT, invoice: OMIT, applied_date: OMIT, applied_amount: OMIT, integration_params: OMIT, linked_account_params: OMIT, additional_properties: nil) @remote_id = remote_id if remote_id != OMIT @invoice = invoice if invoice != OMIT @applied_date = applied_date if applied_date != OMIT @applied_amount = applied_amount if applied_amount != OMIT @integration_params = integration_params if integration_params != OMIT @linked_account_params = linked_account_params if linked_account_params != OMIT @additional_properties = additional_properties @_field_set = { "remote_id": remote_id, "invoice": invoice, "applied_date": applied_date, "applied_amount": applied_amount, "integration_params": integration_params, "linked_account_params": linked_account_params }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
30 31 32 |
# File 'lib/merge_ruby_client/accounting/types/credit_note_apply_line_for_credit_note_request.rb', line 30 def additional_properties @additional_properties end |
#applied_amount ⇒ String (readonly)
Returns The amount of the Credit Note applied to the invoice.
24 25 26 |
# File 'lib/merge_ruby_client/accounting/types/credit_note_apply_line_for_credit_note_request.rb', line 24 def applied_amount @applied_amount end |
#applied_date ⇒ DateTime (readonly)
Returns Date that the credit note is applied to the invoice.
22 23 24 |
# File 'lib/merge_ruby_client/accounting/types/credit_note_apply_line_for_credit_note_request.rb', line 22 def applied_date @applied_date end |
#integration_params ⇒ Hash{String => Object} (readonly)
26 27 28 |
# File 'lib/merge_ruby_client/accounting/types/credit_note_apply_line_for_credit_note_request.rb', line 26 def integration_params @integration_params end |
#invoice ⇒ Merge::Accounting::CreditNoteApplyLineForCreditNoteRequestInvoice (readonly)
20 21 22 |
# File 'lib/merge_ruby_client/accounting/types/credit_note_apply_line_for_credit_note_request.rb', line 20 def invoice @invoice end |
#linked_account_params ⇒ Hash{String => Object} (readonly)
28 29 30 |
# File 'lib/merge_ruby_client/accounting/types/credit_note_apply_line_for_credit_note_request.rb', line 28 def linked_account_params @linked_account_params end |
#remote_id ⇒ String (readonly)
Returns The third-party API ID of the matching object.
18 19 20 |
# File 'lib/merge_ruby_client/accounting/types/credit_note_apply_line_for_credit_note_request.rb', line 18 def remote_id @remote_id end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Accounting::CreditNoteApplyLineForCreditNoteRequest
Deserialize a JSON object to an instance of
CreditNoteApplyLineForCreditNoteRequest
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/merge_ruby_client/accounting/types/credit_note_apply_line_for_credit_note_request.rb', line 71 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"] if parsed_json["invoice"].nil? invoice = nil else invoice = parsed_json["invoice"].to_json invoice = Merge::Accounting::CreditNoteApplyLineForCreditNoteRequestInvoice.from_json(json_object: invoice) end applied_date = (DateTime.parse(parsed_json["applied_date"]) unless parsed_json["applied_date"].nil?) applied_amount = parsed_json["applied_amount"] integration_params = parsed_json["integration_params"] linked_account_params = parsed_json["linked_account_params"] new( remote_id: remote_id, invoice: invoice, applied_date: applied_date, applied_amount: applied_amount, integration_params: integration_params, linked_account_params: linked_account_params, 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.
110 111 112 113 114 115 116 117 |
# File 'lib/merge_ruby_client/accounting/types/credit_note_apply_line_for_credit_note_request.rb', line 110 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.invoice.nil? || Merge::Accounting::CreditNoteApplyLineForCreditNoteRequestInvoice.validate_raw(obj: obj.invoice) obj.applied_date&.is_a?(DateTime) != false || raise("Passed value for field obj.applied_date 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.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.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of CreditNoteApplyLineForCreditNoteRequest to a JSON
object
100 101 102 |
# File 'lib/merge_ruby_client/accounting/types/credit_note_apply_line_for_credit_note_request.rb', line 100 def to_json(*_args) @_field_set&.to_json end |