ledger_sync-quickbooks_online 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.env.test +9 -0
- data/.gitignore +21 -0
- data/.overcommit.yml +29 -0
- data/.rubocop.yml +78 -0
- data/.rubocop_todo.yml +25 -0
- data/.travis.yml +25 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +211 -0
- data/README.md +19 -0
- data/Rakefile +8 -0
- data/bin/console +15 -0
- data/bin/quickbooks_online_oauth_server.rb +104 -0
- data/bin/setup +8 -0
- data/ledger_sync-quickbooks_online.gemspec +46 -0
- data/lib/ledger_sync/quickbooks_online.rb +14 -0
- data/lib/ledger_sync/quickbooks_online/account/deserializer.rb +29 -0
- data/lib/ledger_sync/quickbooks_online/account/operations/create.rb +26 -0
- data/lib/ledger_sync/quickbooks_online/account/operations/find.rb +26 -0
- data/lib/ledger_sync/quickbooks_online/account/operations/update.rb +28 -0
- data/lib/ledger_sync/quickbooks_online/account/searcher.rb +13 -0
- data/lib/ledger_sync/quickbooks_online/account/serializer.rb +29 -0
- data/lib/ledger_sync/quickbooks_online/account_based_expense_line_detail/deserializer.rb +19 -0
- data/lib/ledger_sync/quickbooks_online/account_based_expense_line_detail/serializer.rb +19 -0
- data/lib/ledger_sync/quickbooks_online/bill/deserializer.rb +39 -0
- data/lib/ledger_sync/quickbooks_online/bill/operations/create.rb +27 -0
- data/lib/ledger_sync/quickbooks_online/bill/operations/find.rb +27 -0
- data/lib/ledger_sync/quickbooks_online/bill/operations/update.rb +27 -0
- data/lib/ledger_sync/quickbooks_online/bill/searcher.rb +12 -0
- data/lib/ledger_sync/quickbooks_online/bill/serializer.rb +39 -0
- data/lib/ledger_sync/quickbooks_online/bill_line/deserializer.rb +20 -0
- data/lib/ledger_sync/quickbooks_online/bill_line/serializer.rb +24 -0
- data/lib/ledger_sync/quickbooks_online/bill_payment/deserializer.rb +53 -0
- data/lib/ledger_sync/quickbooks_online/bill_payment/operations/create.rb +31 -0
- data/lib/ledger_sync/quickbooks_online/bill_payment/operations/find.rb +31 -0
- data/lib/ledger_sync/quickbooks_online/bill_payment/operations/update.rb +31 -0
- data/lib/ledger_sync/quickbooks_online/bill_payment/serializer.rb +53 -0
- data/lib/ledger_sync/quickbooks_online/bill_payment_line/deserializer.rb +14 -0
- data/lib/ledger_sync/quickbooks_online/bill_payment_line/serializer.rb +14 -0
- data/lib/ledger_sync/quickbooks_online/check_payment/deserializer.rb +15 -0
- data/lib/ledger_sync/quickbooks_online/check_payment/serializer.rb +15 -0
- data/lib/ledger_sync/quickbooks_online/client.rb +235 -0
- data/lib/ledger_sync/quickbooks_online/config.rb +15 -0
- data/lib/ledger_sync/quickbooks_online/credit_card_payment/deserializer.rb +15 -0
- data/lib/ledger_sync/quickbooks_online/credit_card_payment/serializer.rb +15 -0
- data/lib/ledger_sync/quickbooks_online/currency/deserializer.rb +14 -0
- data/lib/ledger_sync/quickbooks_online/currency/serializer.rb +15 -0
- data/lib/ledger_sync/quickbooks_online/customer/deserializer.rb +24 -0
- data/lib/ledger_sync/quickbooks_online/customer/operations/create.rb +24 -0
- data/lib/ledger_sync/quickbooks_online/customer/operations/find.rb +24 -0
- data/lib/ledger_sync/quickbooks_online/customer/operations/update.rb +24 -0
- data/lib/ledger_sync/quickbooks_online/customer/searcher.rb +13 -0
- data/lib/ledger_sync/quickbooks_online/customer/serializer.rb +24 -0
- data/lib/ledger_sync/quickbooks_online/dashboard_url_helper.rb +32 -0
- data/lib/ledger_sync/quickbooks_online/department/deserializer.rb +20 -0
- data/lib/ledger_sync/quickbooks_online/department/operations/create.rb +23 -0
- data/lib/ledger_sync/quickbooks_online/department/operations/find.rb +23 -0
- data/lib/ledger_sync/quickbooks_online/department/operations/update.rb +23 -0
- data/lib/ledger_sync/quickbooks_online/department/searcher.rb +15 -0
- data/lib/ledger_sync/quickbooks_online/department/serializer.rb +39 -0
- data/lib/ledger_sync/quickbooks_online/deposit/deserializer.rb +34 -0
- data/lib/ledger_sync/quickbooks_online/deposit/operations/create.rb +25 -0
- data/lib/ledger_sync/quickbooks_online/deposit/operations/find.rb +25 -0
- data/lib/ledger_sync/quickbooks_online/deposit/operations/update.rb +25 -0
- data/lib/ledger_sync/quickbooks_online/deposit/searcher.rb +12 -0
- data/lib/ledger_sync/quickbooks_online/deposit/serializer.rb +34 -0
- data/lib/ledger_sync/quickbooks_online/deposit_line/deserializer.rb +20 -0
- data/lib/ledger_sync/quickbooks_online/deposit_line/serializer.rb +24 -0
- data/lib/ledger_sync/quickbooks_online/deposit_line_detail/deserializer.rb +32 -0
- data/lib/ledger_sync/quickbooks_online/deposit_line_detail/serializer.rb +33 -0
- data/lib/ledger_sync/quickbooks_online/deserializer.rb +97 -0
- data/lib/ledger_sync/quickbooks_online/expense/deserializer.rb +52 -0
- data/lib/ledger_sync/quickbooks_online/expense/operations/create.rb +28 -0
- data/lib/ledger_sync/quickbooks_online/expense/operations/find.rb +28 -0
- data/lib/ledger_sync/quickbooks_online/expense/operations/update.rb +28 -0
- data/lib/ledger_sync/quickbooks_online/expense/searcher.rb +12 -0
- data/lib/ledger_sync/quickbooks_online/expense/serializer.rb +51 -0
- data/lib/ledger_sync/quickbooks_online/expense_line/deserializer.rb +20 -0
- data/lib/ledger_sync/quickbooks_online/expense_line/serializer.rb +24 -0
- data/lib/ledger_sync/quickbooks_online/invoice/deserializer.rb +33 -0
- data/lib/ledger_sync/quickbooks_online/invoice/operations/create.rb +25 -0
- data/lib/ledger_sync/quickbooks_online/invoice/operations/find.rb +25 -0
- data/lib/ledger_sync/quickbooks_online/invoice/operations/update.rb +25 -0
- data/lib/ledger_sync/quickbooks_online/invoice/serializer.rb +33 -0
- data/lib/ledger_sync/quickbooks_online/invoice_line/deserializer.rb +19 -0
- data/lib/ledger_sync/quickbooks_online/invoice_line/serializer.rb +23 -0
- data/lib/ledger_sync/quickbooks_online/item/deserializer.rb +11 -0
- data/lib/ledger_sync/quickbooks_online/item/serializer.rb +10 -0
- data/lib/ledger_sync/quickbooks_online/journal_entry/deserializer.rb +26 -0
- data/lib/ledger_sync/quickbooks_online/journal_entry/operations/create.rb +23 -0
- data/lib/ledger_sync/quickbooks_online/journal_entry/operations/find.rb +23 -0
- data/lib/ledger_sync/quickbooks_online/journal_entry/operations/update.rb +23 -0
- data/lib/ledger_sync/quickbooks_online/journal_entry/searcher.rb +12 -0
- data/lib/ledger_sync/quickbooks_online/journal_entry/serializer.rb +26 -0
- data/lib/ledger_sync/quickbooks_online/journal_entry_line/deserializer.rb +18 -0
- data/lib/ledger_sync/quickbooks_online/journal_entry_line/serializer.rb +22 -0
- data/lib/ledger_sync/quickbooks_online/journal_entry_line_detail/deserializer.rb +27 -0
- data/lib/ledger_sync/quickbooks_online/journal_entry_line_detail/serializer.rb +27 -0
- data/lib/ledger_sync/quickbooks_online/ledger_class/deserializer.rb +22 -0
- data/lib/ledger_sync/quickbooks_online/ledger_class/operations/create.rb +23 -0
- data/lib/ledger_sync/quickbooks_online/ledger_class/operations/find.rb +23 -0
- data/lib/ledger_sync/quickbooks_online/ledger_class/operations/update.rb +23 -0
- data/lib/ledger_sync/quickbooks_online/ledger_class/searcher.rb +13 -0
- data/lib/ledger_sync/quickbooks_online/ledger_class/serializer.rb +22 -0
- data/lib/ledger_sync/quickbooks_online/oauth_client.rb +91 -0
- data/lib/ledger_sync/quickbooks_online/operation.rb +59 -0
- data/lib/ledger_sync/quickbooks_online/operation/create.rb +24 -0
- data/lib/ledger_sync/quickbooks_online/operation/find.rb +23 -0
- data/lib/ledger_sync/quickbooks_online/operation/full_update.rb +40 -0
- data/lib/ledger_sync/quickbooks_online/operation/sparse_update.rb +27 -0
- data/lib/ledger_sync/quickbooks_online/payment/deserializer.rb +40 -0
- data/lib/ledger_sync/quickbooks_online/payment/operations/create.rb +28 -0
- data/lib/ledger_sync/quickbooks_online/payment/operations/find.rb +28 -0
- data/lib/ledger_sync/quickbooks_online/payment/operations/update.rb +28 -0
- data/lib/ledger_sync/quickbooks_online/payment/serializer.rb +40 -0
- data/lib/ledger_sync/quickbooks_online/payment_line/deserializer.rb +15 -0
- data/lib/ledger_sync/quickbooks_online/payment_line/serializer.rb +15 -0
- data/lib/ledger_sync/quickbooks_online/preferences/deserializer.rb +22 -0
- data/lib/ledger_sync/quickbooks_online/preferences/operations/find.rb +28 -0
- data/lib/ledger_sync/quickbooks_online/preferences/serializer.rb +22 -0
- data/lib/ledger_sync/quickbooks_online/primary_email_addr/deserializer.rb +11 -0
- data/lib/ledger_sync/quickbooks_online/primary_email_addr/serializer.rb +11 -0
- data/lib/ledger_sync/quickbooks_online/primary_phone/deserializer.rb +11 -0
- data/lib/ledger_sync/quickbooks_online/primary_phone/serializer.rb +11 -0
- data/lib/ledger_sync/quickbooks_online/reference/deserializer.rb +11 -0
- data/lib/ledger_sync/quickbooks_online/reference/serializer.rb +11 -0
- data/lib/ledger_sync/quickbooks_online/request.rb +96 -0
- data/lib/ledger_sync/quickbooks_online/resource.rb +8 -0
- data/lib/ledger_sync/quickbooks_online/resources/account.rb +357 -0
- data/lib/ledger_sync/quickbooks_online/resources/account_based_expense_line_detail.rb +17 -0
- data/lib/ledger_sync/quickbooks_online/resources/bill.rb +29 -0
- data/lib/ledger_sync/quickbooks_online/resources/bill_line.rb +17 -0
- data/lib/ledger_sync/quickbooks_online/resources/bill_payment.rb +42 -0
- data/lib/ledger_sync/quickbooks_online/resources/bill_payment_line.rb +17 -0
- data/lib/ledger_sync/quickbooks_online/resources/check_payment.rb +11 -0
- data/lib/ledger_sync/quickbooks_online/resources/credit_card_payment.rb +11 -0
- data/lib/ledger_sync/quickbooks_online/resources/currency.rb +15 -0
- data/lib/ledger_sync/quickbooks_online/resources/customer.rb +22 -0
- data/lib/ledger_sync/quickbooks_online/resources/department.rb +20 -0
- data/lib/ledger_sync/quickbooks_online/resources/deposit.rb +26 -0
- data/lib/ledger_sync/quickbooks_online/resources/deposit_line.rb +17 -0
- data/lib/ledger_sync/quickbooks_online/resources/deposit_line_detail.rb +20 -0
- data/lib/ledger_sync/quickbooks_online/resources/expense.rb +38 -0
- data/lib/ledger_sync/quickbooks_online/resources/expense_line.rb +17 -0
- data/lib/ledger_sync/quickbooks_online/resources/invoice.rb +26 -0
- data/lib/ledger_sync/quickbooks_online/resources/invoice_line.rb +17 -0
- data/lib/ledger_sync/quickbooks_online/resources/item.rb +9 -0
- data/lib/ledger_sync/quickbooks_online/resources/journal_entry.rb +22 -0
- data/lib/ledger_sync/quickbooks_online/resources/journal_entry_line.rb +18 -0
- data/lib/ledger_sync/quickbooks_online/resources/journal_entry_line_detail.rb +25 -0
- data/lib/ledger_sync/quickbooks_online/resources/ledger_class.rb +18 -0
- data/lib/ledger_sync/quickbooks_online/resources/payment.rb +29 -0
- data/lib/ledger_sync/quickbooks_online/resources/payment_line.rb +17 -0
- data/lib/ledger_sync/quickbooks_online/resources/preferences.rb +22 -0
- data/lib/ledger_sync/quickbooks_online/resources/primary_email_addr.rb +9 -0
- data/lib/ledger_sync/quickbooks_online/resources/primary_phone.rb +9 -0
- data/lib/ledger_sync/quickbooks_online/resources/sales_item_line_detail.rb +17 -0
- data/lib/ledger_sync/quickbooks_online/resources/transfer.rb +22 -0
- data/lib/ledger_sync/quickbooks_online/resources/vendor.rb +23 -0
- data/lib/ledger_sync/quickbooks_online/sales_item_line_detail/deserializer.rb +19 -0
- data/lib/ledger_sync/quickbooks_online/sales_item_line_detail/serializer.rb +19 -0
- data/lib/ledger_sync/quickbooks_online/searcher.rb +58 -0
- data/lib/ledger_sync/quickbooks_online/serialization/type/amount_float_to_integer_type.rb +19 -0
- data/lib/ledger_sync/quickbooks_online/serialization/type/deserialize_transaction_reference_type.rb +28 -0
- data/lib/ledger_sync/quickbooks_online/serialization/type/integer_to_amount_float_type.rb +19 -0
- data/lib/ledger_sync/quickbooks_online/serialization/type/serialize_transaction_reference_type.rb +28 -0
- data/lib/ledger_sync/quickbooks_online/serializer.rb +69 -0
- data/lib/ledger_sync/quickbooks_online/serialziation/type/mapping_type.rb +27 -0
- data/lib/ledger_sync/quickbooks_online/transfer/deserializer.rb +29 -0
- data/lib/ledger_sync/quickbooks_online/transfer/operations/create.rb +24 -0
- data/lib/ledger_sync/quickbooks_online/transfer/operations/find.rb +24 -0
- data/lib/ledger_sync/quickbooks_online/transfer/operations/update.rb +24 -0
- data/lib/ledger_sync/quickbooks_online/transfer/serializer.rb +29 -0
- data/lib/ledger_sync/quickbooks_online/util/error_matcher.rb +68 -0
- data/lib/ledger_sync/quickbooks_online/util/error_parser.rb +25 -0
- data/lib/ledger_sync/quickbooks_online/util/ledger_error_parser.rb +101 -0
- data/lib/ledger_sync/quickbooks_online/util/operation_error_parser.rb +97 -0
- data/lib/ledger_sync/quickbooks_online/vendor/deserializer.rb +25 -0
- data/lib/ledger_sync/quickbooks_online/vendor/operations/create.rb +25 -0
- data/lib/ledger_sync/quickbooks_online/vendor/operations/find.rb +25 -0
- data/lib/ledger_sync/quickbooks_online/vendor/operations/update.rb +25 -0
- data/lib/ledger_sync/quickbooks_online/vendor/searcher.rb +13 -0
- data/lib/ledger_sync/quickbooks_online/vendor/serializer.rb +25 -0
- data/lib/ledger_sync/quickbooks_online/version.rb +19 -0
- data/lib/ledger_sync/quickbooks_online/webhook.rb +56 -0
- data/lib/ledger_sync/quickbooks_online/webhook_event.rb +79 -0
- data/lib/ledger_sync/quickbooks_online/webhook_notification.rb +41 -0
- data/license.txt +4 -0
- metadata +456 -0
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'account'
|
4
|
+
require_relative 'ledger_class'
|
5
|
+
|
6
|
+
module LedgerSync
|
7
|
+
module QuickBooksOnline
|
8
|
+
class AccountBasedExpenseLineDetail < QuickBooksOnline::Resource
|
9
|
+
references_one :Account, to: Account
|
10
|
+
references_one :Class, to: LedgerClass
|
11
|
+
|
12
|
+
def name
|
13
|
+
"#{self.Account.try(:name)} - #{self.Class.try(:name)}"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'account'
|
4
|
+
require_relative 'bill_line'
|
5
|
+
require_relative 'currency'
|
6
|
+
require_relative 'department'
|
7
|
+
require_relative 'vendor'
|
8
|
+
|
9
|
+
module LedgerSync
|
10
|
+
module QuickBooksOnline
|
11
|
+
class Bill < QuickBooksOnline::Resource
|
12
|
+
attribute :PrivateNote, type: Type::String
|
13
|
+
attribute :TxnDate, type: Type::Date
|
14
|
+
attribute :DueDate, type: Type::Date
|
15
|
+
attribute :DocNumber, type: Type::String
|
16
|
+
|
17
|
+
references_one :Vendor, to: Vendor
|
18
|
+
references_one :APAccount, to: Account
|
19
|
+
references_one :Department, to: Department
|
20
|
+
references_one :Currency, to: Currency
|
21
|
+
|
22
|
+
references_many :Line, to: BillLine
|
23
|
+
|
24
|
+
def name
|
25
|
+
"Bill: #{self.TxnDate}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'account_based_expense_line_detail'
|
4
|
+
|
5
|
+
module LedgerSync
|
6
|
+
module QuickBooksOnline
|
7
|
+
class BillLine < QuickBooksOnline::Resource
|
8
|
+
references_one :AccountBasedExpenseLineDetail, to: AccountBasedExpenseLineDetail
|
9
|
+
attribute :Amount, type: Type::Integer
|
10
|
+
attribute :Description, type: Type::String
|
11
|
+
|
12
|
+
def name
|
13
|
+
self.Description
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'account'
|
4
|
+
require_relative 'currency'
|
5
|
+
require_relative 'department'
|
6
|
+
require_relative 'vendor'
|
7
|
+
require_relative 'bill_payment_line'
|
8
|
+
require_relative 'check_payment'
|
9
|
+
require_relative 'credit_card_payment'
|
10
|
+
|
11
|
+
module LedgerSync
|
12
|
+
module QuickBooksOnline
|
13
|
+
class BillPayment < QuickBooksOnline::Resource
|
14
|
+
PAYMENT_TYPES = {
|
15
|
+
'cash' => 'Cash',
|
16
|
+
'check' => 'Check',
|
17
|
+
'credit_card' => 'CreditCard'
|
18
|
+
}.freeze
|
19
|
+
|
20
|
+
attribute :TotalAmt, type: Type::Integer
|
21
|
+
attribute :PrivateNote, type: Type::String
|
22
|
+
attribute :TxnDate, type: Type::Date
|
23
|
+
attribute :ExchangeRate, type: Type::Float
|
24
|
+
attribute :DocNumber, type: Type::String
|
25
|
+
attribute :PayType, type: Type::StringFromSet.new(values: PAYMENT_TYPES.keys)
|
26
|
+
|
27
|
+
references_one :APAccount, to: Account
|
28
|
+
references_one :Currency, to: Currency
|
29
|
+
references_one :Department, to: Department
|
30
|
+
references_one :Vendor, to: Vendor
|
31
|
+
|
32
|
+
references_one :CheckPayment, to: CheckPayment
|
33
|
+
references_one :CreditCardPayment, to: CreditCardPayment
|
34
|
+
|
35
|
+
references_many :Line, to: BillPaymentLine
|
36
|
+
|
37
|
+
def name
|
38
|
+
"Bill Payment: #{self.DocNumber}"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'bill'
|
4
|
+
|
5
|
+
module LedgerSync
|
6
|
+
module QuickBooksOnline
|
7
|
+
class BillPaymentLine < QuickBooksOnline::Resource
|
8
|
+
attribute :Amount, type: Type::Integer
|
9
|
+
|
10
|
+
references_many :LinkedTxn, to: [Bill]
|
11
|
+
|
12
|
+
def name
|
13
|
+
self.Amount
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module LedgerSync
|
4
|
+
module QuickBooksOnline
|
5
|
+
class Currency < QuickBooksOnline::Resource
|
6
|
+
attribute :ExchangeRate, type: Type::Float
|
7
|
+
attribute :Name, type: Type::String
|
8
|
+
attribute :Symbol, type: Type::String
|
9
|
+
|
10
|
+
def ledger_id
|
11
|
+
self.Symbol
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'primary_phone'
|
4
|
+
require_relative 'primary_email_addr'
|
5
|
+
|
6
|
+
module LedgerSync
|
7
|
+
module QuickBooksOnline
|
8
|
+
class Customer < QuickBooksOnline::Resource
|
9
|
+
attribute :DisplayName, type: LedgerSync::Type::String
|
10
|
+
attribute :GivenName, type: LedgerSync::Type::String
|
11
|
+
attribute :FamilyName, type: LedgerSync::Type::String
|
12
|
+
attribute :MiddleName, type: LedgerSync::Type::String
|
13
|
+
|
14
|
+
references_one :PrimaryPhone, to: PrimaryPhone
|
15
|
+
references_one :PrimaryEmailAddr, to: PrimaryEmailAddr
|
16
|
+
|
17
|
+
def name
|
18
|
+
self.DisplayName || [self.GivenName, self.FamilyName].join(' ')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'department'
|
4
|
+
|
5
|
+
module LedgerSync
|
6
|
+
module QuickBooksOnline
|
7
|
+
class Department < QuickBooksOnline::Resource
|
8
|
+
attribute :Name, type: Type::String
|
9
|
+
attribute :FullyQualifiedName, type: Type::String
|
10
|
+
attribute :Active, type: Type::Boolean
|
11
|
+
attribute :SubDepartment, type: Type::Boolean
|
12
|
+
|
13
|
+
references_one :Parent, to: Department
|
14
|
+
|
15
|
+
def name
|
16
|
+
self.Name
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'account'
|
4
|
+
require_relative 'currency'
|
5
|
+
require_relative 'department'
|
6
|
+
require_relative 'deposit_line'
|
7
|
+
|
8
|
+
module LedgerSync
|
9
|
+
module QuickBooksOnline
|
10
|
+
class Deposit < QuickBooksOnline::Resource
|
11
|
+
attribute :PrivateNote, type: Type::String
|
12
|
+
attribute :TxnDate, type: Type::Date
|
13
|
+
attribute :ExchangeRate, type: Type::Float
|
14
|
+
|
15
|
+
references_one :DepositToAccount, to: Account
|
16
|
+
references_one :Department, to: Department
|
17
|
+
references_one :Currency, to: Currency
|
18
|
+
|
19
|
+
references_many :Line, to: DepositLine
|
20
|
+
|
21
|
+
def name
|
22
|
+
"Deposit: #{self.Currency.try(:symbol)}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'deposit_line_detail'
|
4
|
+
|
5
|
+
module LedgerSync
|
6
|
+
module QuickBooksOnline
|
7
|
+
class DepositLine < QuickBooksOnline::Resource
|
8
|
+
references_one :DepositLineDetail, to: DepositLineDetail
|
9
|
+
attribute :Amount, type: Type::Integer
|
10
|
+
attribute :Description, type: Type::String
|
11
|
+
|
12
|
+
def name
|
13
|
+
self.Description
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'account'
|
4
|
+
require_relative 'customer'
|
5
|
+
require_relative 'ledger_class'
|
6
|
+
require_relative 'vendor'
|
7
|
+
|
8
|
+
module LedgerSync
|
9
|
+
module QuickBooksOnline
|
10
|
+
class DepositLineDetail < QuickBooksOnline::Resource
|
11
|
+
references_one :Account, to: Account
|
12
|
+
references_one :Class, to: LedgerClass
|
13
|
+
references_one :Entity, to: [Customer, Vendor]
|
14
|
+
|
15
|
+
def name
|
16
|
+
"#{self.Account.try(:name)} - #{self.Class.try(:name)}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'account'
|
4
|
+
require_relative 'currency'
|
5
|
+
require_relative 'customer'
|
6
|
+
require_relative 'department'
|
7
|
+
require_relative 'expense_line'
|
8
|
+
require_relative 'vendor'
|
9
|
+
require_relative 'bill_payment'
|
10
|
+
|
11
|
+
module LedgerSync
|
12
|
+
module QuickBooksOnline
|
13
|
+
class Expense < QuickBooksOnline::Resource
|
14
|
+
PAYMENT_TYPES = BillPayment::PAYMENT_TYPES
|
15
|
+
|
16
|
+
attribute :PrivateNote, type: Type::String
|
17
|
+
attribute :PaymentType, type: Type::StringFromSet.new(values: PAYMENT_TYPES.keys)
|
18
|
+
attribute :TxnDate, type: Type::Date
|
19
|
+
attribute :ExchangeRate, type: Type::Float
|
20
|
+
attribute :DocNumber, type: Type::String
|
21
|
+
|
22
|
+
references_one :Entity, to: [Customer, Vendor]
|
23
|
+
references_one :Account, to: Account
|
24
|
+
references_one :Department, to: Department
|
25
|
+
references_one :Currency, to: Currency
|
26
|
+
|
27
|
+
references_many :Line, to: ExpenseLine
|
28
|
+
|
29
|
+
def amount
|
30
|
+
line_items.inject(0) { |sum, li| sum + li.Amount }
|
31
|
+
end
|
32
|
+
|
33
|
+
def name
|
34
|
+
"Purchase: #{amount} #{self.Currency.try(:symbol)}"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'account_based_expense_line_detail'
|
4
|
+
|
5
|
+
module LedgerSync
|
6
|
+
module QuickBooksOnline
|
7
|
+
class ExpenseLine < QuickBooksOnline::Resource
|
8
|
+
references_one :AccountBasedExpenseLineDetail, to: AccountBasedExpenseLineDetail
|
9
|
+
attribute :Amount, type: Type::Integer
|
10
|
+
attribute :Description, type: Type::String
|
11
|
+
|
12
|
+
def name
|
13
|
+
self.Description
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'account'
|
4
|
+
require_relative 'currency'
|
5
|
+
require_relative 'customer'
|
6
|
+
require_relative 'invoice_line'
|
7
|
+
|
8
|
+
module LedgerSync
|
9
|
+
module QuickBooksOnline
|
10
|
+
class Invoice < QuickBooksOnline::Resource
|
11
|
+
attribute :PrivateNote, type: Type::String
|
12
|
+
attribute :TxnDate, type: Type::Date
|
13
|
+
attribute :Deposit, type: Type::Integer
|
14
|
+
|
15
|
+
references_one :Customer, to: Customer
|
16
|
+
references_one :DepositToAccount, to: Account
|
17
|
+
references_one :Currency, to: Currency
|
18
|
+
|
19
|
+
references_many :Line, to: InvoiceLine
|
20
|
+
|
21
|
+
def name
|
22
|
+
"Invoice: #{transaction_date}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'sales_item_line_detail'
|
4
|
+
|
5
|
+
module LedgerSync
|
6
|
+
module QuickBooksOnline
|
7
|
+
class InvoiceLine < QuickBooksOnline::Resource
|
8
|
+
references_one :SalesItemLineDetail, to: SalesItemLineDetail
|
9
|
+
attribute :Amount, type: Type::Integer
|
10
|
+
attribute :Description, type: Type::String
|
11
|
+
|
12
|
+
def name
|
13
|
+
self.Description
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'currency'
|
4
|
+
require_relative 'journal_entry_line'
|
5
|
+
|
6
|
+
module LedgerSync
|
7
|
+
module QuickBooksOnline
|
8
|
+
class JournalEntry < QuickBooksOnline::Resource
|
9
|
+
attribute :PrivateNote, type: Type::String
|
10
|
+
attribute :TxnDate, type: Type::Date
|
11
|
+
attribute :DocNumber, type: Type::String
|
12
|
+
|
13
|
+
references_one :Currency, to: Currency
|
14
|
+
|
15
|
+
references_many :Line, to: JournalEntryLine
|
16
|
+
|
17
|
+
def name
|
18
|
+
"JournalEntry: #{self.TxnDate}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'journal_entry_line_detail'
|
4
|
+
|
5
|
+
module LedgerSync
|
6
|
+
module QuickBooksOnline
|
7
|
+
class JournalEntryLine < QuickBooksOnline::Resource
|
8
|
+
attribute :Amount, type: Type::Integer
|
9
|
+
attribute :Description, type: Type::String
|
10
|
+
|
11
|
+
references_one :JournalEntryLineDetail, to: JournalEntryLineDetail
|
12
|
+
|
13
|
+
def name
|
14
|
+
self.Description
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|