Class: Quickbooks::Model::Line

Inherits:
BaseModel show all
Defined in:
lib/quickbooks/model/line.rb

Constant Summary collapse

SALES_ITEM_LINE_DETAIL =

Constants

'SalesItemLineDetail'
SUB_TOTAL_LINE_DETAIL =
'SubTotalLineDetail'
PAYMENT_LINE_DETAIL =
'PaymentLineDetail'
DISCOUNT_LINE_DETAIL =
'DiscountLineDetail'
JOURNAL_ENTRY_LINE_DETAIL =
'JournalEntryLineDetail'

Instance Method Summary collapse

Methods inherited from BaseModel

#as_json, attribute_names, #attributes, attrs_with_types, #inspect, inspect, reference_attrs, reference_setters, resource_for_collection, resource_for_singular, to_xml_big_decimal, #to_xml_inject_ns, #to_xml_ns

Methods included from Validator

#line_item_size

Methods included from Definition

included, #is_name_list_entity?, #is_transaction_entity?

Constructor Details

#initialize(*args) ⇒ Line

Returns a new instance of Line.



26
27
28
29
# File 'lib/quickbooks/model/line.rb', line 26

def initialize(*args)
  self.linked_transactions ||= []
  super
end

Instance Method Details

#credit_memo_id=(id) ⇒ Object Also known as: credit_memo_ids=



36
37
38
# File 'lib/quickbooks/model/line.rb', line 36

def credit_memo_id=(id)
  update_linked_transactions([id], 'CreditMemo')
end

#discount! {|self.discount_line_detail| ... } ⇒ Object

Yields:

  • (self.discount_line_detail)


62
63
64
65
66
67
# 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) ⇒ Object Also known as: invoice_ids=



31
32
33
# File 'lib/quickbooks/model/line.rb', line 31

def invoice_id=(id)
  update_linked_transactions([id], 'Invoice')
end

#journal_entry! {|self.journal_entry_line_detail| ... } ⇒ Object

Yields:

  • (self.journal_entry_line_detail)


69
70
71
72
73
74
# 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! {|self.payment_line_detail| ... } ⇒ Object

Yields:

  • (self.payment_line_detail)


55
56
57
58
59
60
# 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! {|self.sales_item_line_detail| ... } ⇒ Object

Yields:

  • (self.sales_item_line_detail)


41
42
43
44
45
46
# 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! {|self.sub_total_line_detail| ... } ⇒ Object

Yields:

  • (self.sub_total_line_detail)


48
49
50
51
52
53
# 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