quickbooks-ruby 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/quickbooks/model/batch_request.rb +1 -0
- data/lib/quickbooks/model/batch_response.rb +1 -0
- data/lib/quickbooks/model/credit_memo.rb +4 -3
- data/lib/quickbooks/model/employee.rb +1 -1
- data/lib/quickbooks/model/estimate.rb +1 -1
- data/lib/quickbooks/model/line.rb +32 -4
- data/lib/quickbooks/model/payment.rb +5 -0
- data/lib/quickbooks/model/refund_receipt.rb +3 -1
- data/lib/quickbooks/model/sales_receipt.rb +4 -1
- data/lib/quickbooks/model/time_activity.rb +1 -0
- data/lib/quickbooks/util/query_builder.rb +18 -4
- data/lib/quickbooks/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 333d4d3a664eb7b3b48294bdcd2de31071593403
|
4
|
+
data.tar.gz: f67d64f084bec1975705b7aaa19148716f82ed37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83df4ff5537f43d8066a62804fe31781a7ab95be145c599fbf0b10ae27faf493d7615c1f53ca7454e60a86ec3a2e1f0aab6f3f0576852e1ca10fecd6872e4d1c
|
7
|
+
data.tar.gz: 676423da97728dfde65cf08f9750aaf26ec093f32138b2b6be979c651fe51eda8efd26c9cc6cb36b1ad0f2d46cdd75af14dfea739a6669ddcc4316702047037f
|
@@ -17,6 +17,7 @@ class Quickbooks::Model::BatchRequest < Quickbooks::Model::BaseModel
|
|
17
17
|
xml_accessor :bill_payment, from: "BillPayment", as: Quickbooks::Model::BillPayment
|
18
18
|
xml_accessor :purchase, from: "Purchase", as: Quickbooks::Model::Purchase
|
19
19
|
xml_accessor :credit_memo, from: "CreditMemo", as: Quickbooks::Model::CreditMemo
|
20
|
+
xml_accessor :payment, from: "Payment", as: Quickbooks::Model::Payment
|
20
21
|
end
|
21
22
|
|
22
23
|
XML_COLLECTION_NODE = "IntuitBatchRequest"
|
@@ -16,6 +16,7 @@ class Quickbooks::Model::BatchResponse < Quickbooks::Model::BaseModel
|
|
16
16
|
xml_accessor :bill_payment, from: "BillPayment", as: Quickbooks::Model::BillPayment
|
17
17
|
xml_accessor :purchase, from: "Purchase", as: Quickbooks::Model::Purchase
|
18
18
|
xml_accessor :credit_memo, from: "CreditMemo", as: Quickbooks::Model::CreditMemo
|
19
|
+
xml_accessor :payment, from: "Payment", as: Quickbooks::Model::Payment
|
19
20
|
|
20
21
|
def fault?
|
21
22
|
fault
|
@@ -11,9 +11,7 @@ module Quickbooks
|
|
11
11
|
xml_accessor :meta_data, :from => 'MetaData', :as => MetaData
|
12
12
|
xml_accessor :auto_doc_number, :from => 'AutoDocNumber' # See auto_doc_number! method below for usage
|
13
13
|
xml_accessor :doc_number, :from => 'DocNumber'
|
14
|
-
|
15
|
-
# TODO: Next major version 'placed_on' should be replaced by 'txn_date'
|
16
|
-
xml_accessor :placed_on, :from => 'TxnDate', :as => Date
|
14
|
+
xml_accessor :txn_date, :from => 'TxnDate', :as => Date
|
17
15
|
xml_accessor :department_ref, :from => 'DepartmentRef', :as => BaseReference
|
18
16
|
|
19
17
|
xml_accessor :line_items, :from => 'Line', :as => [Line]
|
@@ -31,6 +29,9 @@ module Quickbooks
|
|
31
29
|
# readonly
|
32
30
|
xml_accessor :total, :from => 'TotalAmt', :as => BigDecimal
|
33
31
|
|
32
|
+
# backward-compatible alias
|
33
|
+
alias_attribute :placed_on, :txn_date
|
34
|
+
|
34
35
|
validate :line_item_size
|
35
36
|
validate :document_numbering
|
36
37
|
|
@@ -27,7 +27,7 @@ module Quickbooks
|
|
27
27
|
xml_accessor :primary_phone, :from => 'PrimaryPhone', :as => TelephoneNumber
|
28
28
|
xml_accessor :mobile_phone, :from => 'Mobile', :as => TelephoneNumber
|
29
29
|
xml_accessor :primary_email_address, :from => 'PrimaryEmailAddr', :as => EmailAddress
|
30
|
-
xml_accessor :number, :from => 'EmployeeNumber'
|
30
|
+
xml_accessor :number, :from => 'EmployeeNumber'
|
31
31
|
xml_accessor :ssn, :from => 'SSN'
|
32
32
|
xml_accessor :address, :from => 'PrimaryAddr', :as => PhysicalAddress
|
33
33
|
xml_accessor :billable?, :from => 'BillableTime'
|
@@ -25,7 +25,7 @@ module Quickbooks
|
|
25
25
|
xml_accessor :department_ref, :from => 'DepartmentRef', :as => BaseReference
|
26
26
|
xml_accessor :linked_transactions, :from => 'LinkedTxn', :as => [LinkedTransaction]
|
27
27
|
xml_accessor :line_items, :from => 'Line', :as => [InvoiceLineItem]
|
28
|
-
xml_accessor :txn_tax_detail, :from => 'TxnTaxDetail'
|
28
|
+
xml_accessor :txn_tax_detail, :from => 'TxnTaxDetail', :as => TransactionTaxDetail
|
29
29
|
xml_accessor :txn_status, :from => 'TxnStatus'
|
30
30
|
|
31
31
|
xml_accessor :customer_ref, :from => 'CustomerRef', :as => BaseReference
|
@@ -21,19 +21,47 @@ module Quickbooks
|
|
21
21
|
xml_accessor :payment_line_detail, :from => 'PaymentLineDetail', :as => PaymentLineDetail
|
22
22
|
xml_accessor :discount_line_detail, :from => 'DiscountLineDetail', :as => DiscountOverride
|
23
23
|
xml_accessor :journal_entry_line_detail, :from => 'JournalEntryLineDetail', :as => JournalEntryLineDetail
|
24
|
-
xml_accessor :linked_transaction, :from => 'LinkedTxn', :as => LinkedTransaction
|
25
24
|
|
26
|
-
def
|
27
|
-
|
28
|
-
|
25
|
+
def initialize(*args)
|
26
|
+
super
|
27
|
+
self.linked_transactions ||= []
|
29
28
|
end
|
30
29
|
|
30
|
+
def invoice_id=(id)
|
31
|
+
update_linked_transactions([id], 'Invoice')
|
32
|
+
end
|
33
|
+
alias_method :invoice_ids=, :invoice_id=
|
34
|
+
|
35
|
+
def credit_memo_id=(id)
|
36
|
+
update_linked_transactions([id], 'CreditMemo')
|
37
|
+
end
|
38
|
+
alias_method :credit_memo_ids=, :credit_memo_id=
|
39
|
+
|
31
40
|
def sales_item!
|
32
41
|
self.detail_type = SALES_LINE_ITEM_DETAIL
|
33
42
|
self.sales_item_line_detail = SalesItemLineDetail.new
|
34
43
|
|
35
44
|
yield self.sales_item_line_detail if block_given?
|
36
45
|
end
|
46
|
+
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def update_linked_transactions(txn_ids, txn_type)
|
51
|
+
remove_linked_transactions(txn_type)
|
52
|
+
txn_ids.flatten.compact.each do |id|
|
53
|
+
add_linked_transaction(id, txn_type)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def remove_linked_transactions(txn_type)
|
58
|
+
self.linked_transactions.delete_if { |lt| lt.txn_type == txn_type }
|
59
|
+
end
|
60
|
+
|
61
|
+
def add_linked_transaction(txn_id, txn_type)
|
62
|
+
self.linked_transactions << LinkedTransaction.new(txn_id: txn_id,
|
63
|
+
txn_type: txn_type)
|
64
|
+
end
|
37
65
|
end
|
38
66
|
end
|
39
67
|
end
|
@@ -10,7 +10,6 @@ module Quickbooks
|
|
10
10
|
xml_accessor :meta_data, :from => 'MetaData', :as => MetaData
|
11
11
|
xml_accessor :auto_doc_number, :from => 'AutoDocNumber' # See auto_doc_number! method below for usage
|
12
12
|
xml_accessor :doc_number, :from => 'DocNumber'
|
13
|
-
xml_accessor :placed_on, :from => 'TxnDate', :as => Time
|
14
13
|
xml_accessor :line_items, :from => 'Line', :as => [Line]
|
15
14
|
xml_accessor :customer_ref, :from => 'CustomerRef', :as => BaseReference
|
16
15
|
xml_accessor :department_ref, :from => 'DepartmentRef', :as => BaseReference
|
@@ -39,6 +38,9 @@ module Quickbooks
|
|
39
38
|
xml_accessor :total, :from => 'TotalAmt', :as => BigDecimal
|
40
39
|
xml_accessor :home_total, :from => 'HomeTotalAmt', :as => BigDecimal, :to_xml => to_xml_big_decimal
|
41
40
|
|
41
|
+
# backward-compatible alias
|
42
|
+
alias_attribute :placed_on, :txn_date
|
43
|
+
|
42
44
|
include DocumentNumbering
|
43
45
|
reference_setters :customer_ref, :payment_method_ref, :deposit_to_account_ref, :department_ref, :currency_ref, :class_ref
|
44
46
|
|
@@ -11,7 +11,7 @@ module Quickbooks
|
|
11
11
|
xml_accessor :meta_data, :from => 'MetaData', :as => MetaData
|
12
12
|
xml_accessor :auto_doc_number, :from => 'AutoDocNumber' # See auto_doc_number! method below for usage
|
13
13
|
xml_accessor :doc_number, :from => 'DocNumber'
|
14
|
-
xml_accessor :
|
14
|
+
xml_accessor :txn_date, :from => 'TxnDate', :as => Time
|
15
15
|
xml_accessor :line_items, :from => 'Line', :as => [Line]
|
16
16
|
xml_accessor :customer_ref, :from => 'CustomerRef', :as => BaseReference
|
17
17
|
xml_accessor :bill_email, :from => 'BillEmail', :as => EmailAddress
|
@@ -30,6 +30,9 @@ module Quickbooks
|
|
30
30
|
# readonly
|
31
31
|
xml_accessor :total, :from => 'TotalAmt', :as => BigDecimal
|
32
32
|
|
33
|
+
# backward-compatible alias
|
34
|
+
alias_attribute :placed_on, :txn_date
|
35
|
+
|
33
36
|
reference_setters :customer_ref, :payment_method_ref, :deposit_to_account_ref
|
34
37
|
|
35
38
|
validate :line_item_size
|
@@ -20,6 +20,7 @@ module Quickbooks
|
|
20
20
|
xml_accessor :vendor_ref, :from => 'VendorRef', :as => BaseReference
|
21
21
|
xml_accessor :customer_ref, :from => 'CustomerRef', :as => BaseReference
|
22
22
|
xml_accessor :item_ref, :from => 'ItemRef', :as => BaseReference
|
23
|
+
xml_accessor :class_ref, :from => 'ClassRef', :as => BaseReference
|
23
24
|
|
24
25
|
xml_accessor :billable_status, :from => 'BillableStatus'
|
25
26
|
xml_accessor :taxable, :from => 'Taxable'
|
@@ -10,12 +10,26 @@ module Quickbooks
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def clause(field, operator, value)
|
13
|
-
|
14
|
-
|
13
|
+
value = case value
|
14
|
+
when DateTime, Time
|
15
|
+
value.iso8601
|
16
|
+
when Date
|
17
|
+
value.strftime('%Y-%m-%d')
|
18
|
+
when Array
|
19
|
+
value = value.map{|v| v.to_s.gsub("'", "\\\\'") }
|
20
|
+
else
|
21
|
+
# escape single quotes with an escaped backslash
|
22
|
+
value = value.gsub("'", "\\\\'")
|
23
|
+
end
|
15
24
|
|
16
|
-
|
25
|
+
if operator.downcase == 'in' && value.is_a?(Array)
|
26
|
+
value = value.map{|v| "#{VALUE_QUOTE}#{v}#{VALUE_QUOTE}"}
|
27
|
+
"#{field} #{operator} (#{value.join(', ')})"
|
28
|
+
else
|
29
|
+
"#{field} #{operator} #{VALUE_QUOTE}#{value}#{VALUE_QUOTE}"
|
30
|
+
end
|
17
31
|
end
|
18
32
|
|
19
33
|
end
|
20
34
|
end
|
21
|
-
end
|
35
|
+
end
|
data/lib/quickbooks/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quickbooks-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cody Caughlan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oauth
|