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.



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

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

Instance Method Details

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



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

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

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

Yields:

  • (self.discount_line_detail)


61
62
63
64
65
66
# File 'lib/quickbooks/model/line.rb', line 61

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=



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

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

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

Yields:

  • (self.journal_entry_line_detail)


68
69
70
71
72
73
# File 'lib/quickbooks/model/line.rb', line 68

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)


54
55
56
57
58
59
# File 'lib/quickbooks/model/line.rb', line 54

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)


40
41
42
43
44
45
# File 'lib/quickbooks/model/line.rb', line 40

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)


47
48
49
50
51
52
# File 'lib/quickbooks/model/line.rb', line 47

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