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'
GROUP_LINE_DETAIL =
'GroupLineDetail'

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.



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

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

Instance Method Details

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



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

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

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

Yields:

  • (self.discount_line_detail)


66
67
68
69
70
71
# 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

#group_line! {|self.group_line_detail| ... } ⇒ Object

Yields:

  • (self.group_line_detail)


80
81
82
83
84
85
# 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

#invoice_id=(id) ⇒ Object Also known as: invoice_ids=



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

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

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

Yields:

  • (self.journal_entry_line_detail)


73
74
75
76
77
78
# 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

#payment! {|self.payment_line_detail| ... } ⇒ Object

Yields:

  • (self.payment_line_detail)


59
60
61
62
63
64
# 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

#sales_item! {|self.sales_item_line_detail| ... } ⇒ Object

Yields:

  • (self.sales_item_line_detail)


45
46
47
48
49
50
# 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

#sub_total! {|self.sub_total_line_detail| ... } ⇒ Object

Yields:

  • (self.sub_total_line_detail)


52
53
54
55
56
57
# 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