class Quickbooks::Model::Line
Constants
- DISCOUNT_LINE_DETAIL
- GROUP_LINE_DETAIL
- JOURNAL_ENTRY_LINE_DETAIL
- PAYMENT_LINE_DETAIL
- SALES_ITEM_LINE_DETAIL
-
Constants¶ ↑
- SUB_TOTAL_LINE_DETAIL
Public Class Methods
Source
# File lib/quickbooks/model/line.rb, line 30 def initialize(*args) self.linked_transactions ||= [] super end
Calls superclass method
Quickbooks::Model::BaseModel::new
Public Instance Methods
Source
# File lib/quickbooks/model/line.rb, line 40 def credit_memo_id=(id) update_linked_transactions([id], 'CreditMemo') end
Also aliased as: credit_memo_ids=
Source
# File lib/quickbooks/model/line.rb, line 66 def discount! self.detail_type = DISCOUNT_LINE_DETAIL self.discount_line_detail = DiscountLineDetail.new yield self.discount_line_detail if block_given? end
Source
# File lib/quickbooks/model/line.rb, line 80 def group_line! self.detail_type = GROUP_LINE_DETAIL self.group_line_detail = GroupLineDetail.new yield self.group_line_detail if block_given? end
Source
# File lib/quickbooks/model/line.rb, line 35 def invoice_id=(id) update_linked_transactions([id], 'Invoice') end
Also aliased as: invoice_ids=
Source
# File lib/quickbooks/model/line.rb, line 73 def journal_entry! self.detail_type = JOURNAL_ENTRY_LINE_DETAIL self.journal_entry_line_detail = JournalEntryLineDetail.new yield self.journal_entry_line_detail if block_given? end
Source
# File lib/quickbooks/model/line.rb, line 59 def payment! self.detail_type = PAYMENT_LINE_DETAIL self.payment_line_detail = PaymentLineDetail.new yield self.payment_line_detail if block_given? end
Source
# File lib/quickbooks/model/line.rb, line 45 def sales_item! self.detail_type = SALES_ITEM_LINE_DETAIL self.sales_item_line_detail = SalesItemLineDetail.new yield self.sales_item_line_detail if block_given? end
Source
# File lib/quickbooks/model/line.rb, line 52 def sub_total! self.detail_type = SUB_TOTAL_LINE_DETAIL self.sub_total_line_detail = SubTotalLineDetail.new yield self.sub_total_line_detail if block_given? end
Private Instance Methods
Source
# File lib/quickbooks/model/line.rb, line 100 def add_linked_transaction(txn_id, txn_type) self.linked_transactions << LinkedTransaction.new(txn_id: txn_id, txn_type: txn_type) end
Source
# File lib/quickbooks/model/line.rb, line 96 def remove_linked_transactions(txn_type) self.linked_transactions.delete_if { |lt| lt.txn_type == txn_type } end
Source
# File lib/quickbooks/model/line.rb, line 89 def update_linked_transactions(txn_ids, txn_type) remove_linked_transactions(txn_type) txn_ids.flatten.compact.each do |id| add_linked_transaction(id, txn_type) end end