class Quickbooks::Model::Line
Constants
- DISCOUNT_LINE_DETAIL
- JOURNAL_ENTRY_LINE_DETAIL
- PAYMENT_LINE_DETAIL
- SALES_ITEM_LINE_DETAIL
Constants¶ ↑
- SUB_TOTAL_LINE_DETAIL
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
Quickbooks::Model::BaseModel::new
# File lib/quickbooks/model/line.rb, line 26 def initialize(*args) self.linked_transactions ||= [] super end
Public Instance Methods
credit_memo_id=(id)
click to toggle source
# File lib/quickbooks/model/line.rb, line 36 def credit_memo_id=(id) update_linked_transactions([id], 'CreditMemo') end
Also aliased as: credit_memo_ids=
discount!() { |discount_line_detail| ... }
click to toggle source
# File lib/quickbooks/model/line.rb, line 62 def discount! self.detail_type = DISCOUNT_LINE_DETAIL self.discount_line_detail = DiscountLineDetail.new yield self.discount_line_detail if block_given? end
invoice_id=(id)
click to toggle source
# File lib/quickbooks/model/line.rb, line 31 def invoice_id=(id) update_linked_transactions([id], 'Invoice') end
Also aliased as: invoice_ids=
journal_entry!() { |journal_entry_line_detail| ... }
click to toggle source
# File lib/quickbooks/model/line.rb, line 69 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
payment!() { |payment_line_detail| ... }
click to toggle source
# File lib/quickbooks/model/line.rb, line 55 def payment! self.detail_type = PAYMENT_LINE_DETAIL self.payment_line_detail = PaymentLineDetail.new yield self.payment_line_detail if block_given? end
sales_item!() { |sales_item_line_detail| ... }
click to toggle source
# File lib/quickbooks/model/line.rb, line 41 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
sub_total!() { |sub_total_line_detail| ... }
click to toggle source
# File lib/quickbooks/model/line.rb, line 48 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
add_linked_transaction(txn_id, txn_type)
click to toggle source
# File lib/quickbooks/model/line.rb, line 89 def add_linked_transaction(txn_id, txn_type) self.linked_transactions << LinkedTransaction.new(txn_id: txn_id, txn_type: txn_type) end
remove_linked_transactions(txn_type)
click to toggle source
# File lib/quickbooks/model/line.rb, line 85 def remove_linked_transactions(txn_type) self.linked_transactions.delete_if { |lt| lt.txn_type == txn_type } end
update_linked_transactions(txn_ids, txn_type)
click to toggle source
# File lib/quickbooks/model/line.rb, line 78 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