ledger_sync 1.1.3 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.env.template +25 -0
- data/.gitignore +3 -1
- data/.rubocop_todo.yml +4 -1
- data/.travis.yml +1 -1
- data/Gemfile.lock +59 -25
- data/README.md +160 -8
- data/_config.yml +1 -0
- data/bin/qa +3 -0
- data/ledger_sync.gemspec +4 -0
- data/lib/ledger_sync.rb +40 -30
- data/lib/ledger_sync/adaptor_configuration.rb +17 -11
- data/lib/ledger_sync/adaptor_configuration_store.rb +13 -9
- data/lib/ledger_sync/adaptors/adaptor.rb +9 -1
- data/lib/ledger_sync/adaptors/ledger_serializer.rb +3 -6
- data/lib/ledger_sync/adaptors/ledger_serializer_attribute_set.rb +1 -1
- data/lib/ledger_sync/adaptors/ledger_serializer_type/references_many_type.rb +1 -1
- data/lib/ledger_sync/adaptors/mixins/infer_adaptor_class_mixin.rb +24 -0
- data/lib/ledger_sync/adaptors/mixins/infer_ledger_serializer_mixin.rb +31 -0
- data/lib/ledger_sync/adaptors/mixins/infer_resource_class_mixin.rb +22 -0
- data/lib/ledger_sync/adaptors/mixins/offset_and_limit_pagination_searcher_mixin.rb +37 -0
- data/lib/ledger_sync/adaptors/netsuite/account/ledger_deserializer.rb +24 -0
- data/lib/ledger_sync/adaptors/netsuite/account/ledger_serializer.rb +22 -0
- data/lib/ledger_sync/adaptors/netsuite/account/operations/create.rb +28 -0
- data/lib/ledger_sync/adaptors/netsuite/account/operations/find.rb +28 -0
- data/lib/ledger_sync/adaptors/netsuite/account/searcher.rb +28 -0
- data/lib/ledger_sync/adaptors/netsuite/adaptor.rb +145 -0
- data/lib/ledger_sync/adaptors/netsuite/config.rb +6 -0
- data/lib/ledger_sync/adaptors/netsuite/currency/deledger_serializer.rb +28 -0
- data/lib/ledger_sync/adaptors/netsuite/currency/ledger_serializer.rb +25 -0
- data/lib/ledger_sync/adaptors/netsuite/currency/operations/create.rb +25 -0
- data/lib/ledger_sync/adaptors/netsuite/currency/operations/delete.rb +23 -0
- data/lib/ledger_sync/adaptors/netsuite/currency/operations/find.rb +23 -0
- data/lib/ledger_sync/adaptors/netsuite/currency/operations/update.rb +23 -0
- data/lib/ledger_sync/adaptors/netsuite/customer/ledger_deserializer.rb +27 -0
- data/lib/ledger_sync/adaptors/netsuite/customer/ledger_serializer.rb +38 -0
- data/lib/ledger_sync/adaptors/netsuite/customer/operations/create.rb +24 -0
- data/lib/ledger_sync/adaptors/netsuite/customer/operations/delete.rb +24 -0
- data/lib/ledger_sync/adaptors/netsuite/customer/operations/find.rb +24 -0
- data/lib/ledger_sync/adaptors/netsuite/customer/operations/update.rb +24 -0
- data/lib/ledger_sync/adaptors/netsuite/ledger_serializer.rb +30 -0
- data/lib/ledger_sync/adaptors/netsuite/ledger_serializer_type/reference_type.rb +24 -0
- data/lib/ledger_sync/adaptors/netsuite/ledger_serializer_type/subsidiary_type.rb +22 -0
- data/lib/ledger_sync/adaptors/netsuite/operation.rb +25 -0
- data/lib/ledger_sync/adaptors/netsuite/operation/create.rb +65 -0
- data/lib/ledger_sync/adaptors/netsuite/operation/delete.rb +49 -0
- data/lib/ledger_sync/adaptors/netsuite/operation/find.rb +56 -0
- data/lib/ledger_sync/adaptors/netsuite/operation/update.rb +68 -0
- data/lib/ledger_sync/adaptors/netsuite/record/http_method.rb +38 -0
- data/lib/ledger_sync/adaptors/netsuite/record/metadata.rb +75 -0
- data/lib/ledger_sync/adaptors/netsuite/record/property.rb +45 -0
- data/lib/ledger_sync/adaptors/netsuite/searcher.rb +17 -0
- data/lib/ledger_sync/adaptors/netsuite/token.rb +162 -0
- data/lib/ledger_sync/adaptors/netsuite/vendor/ledger_deserializer.rb +32 -0
- data/lib/ledger_sync/adaptors/netsuite/vendor/ledger_serializer.rb +35 -0
- data/lib/ledger_sync/adaptors/netsuite/vendor/operations/create.rb +27 -0
- data/lib/ledger_sync/adaptors/netsuite/vendor/operations/delete.rb +27 -0
- data/lib/ledger_sync/adaptors/netsuite/vendor/operations/find.rb +27 -0
- data/lib/ledger_sync/adaptors/netsuite/vendor/operations/update.rb +27 -0
- data/lib/ledger_sync/adaptors/netsuite_soap/adaptor.rb +92 -0
- data/lib/ledger_sync/adaptors/netsuite_soap/config.rb +5 -0
- data/lib/ledger_sync/adaptors/netsuite_soap/customer/ledger_serializer.rb +13 -0
- data/lib/ledger_sync/adaptors/netsuite_soap/customer/operations/create.rb +64 -0
- data/lib/ledger_sync/adaptors/netsuite_soap/customer/operations/find.rb +49 -0
- data/lib/ledger_sync/adaptors/netsuite_soap/ledger_serializer.rb +25 -0
- data/lib/ledger_sync/adaptors/netsuite_soap/operation.rb +40 -0
- data/lib/ledger_sync/adaptors/netsuite_soap/operation/create.rb +29 -0
- data/lib/ledger_sync/adaptors/netsuite_soap/operation/find.rb +15 -0
- data/lib/ledger_sync/adaptors/netsuite_soap/subsidiary/operations/create.rb +42 -0
- data/lib/ledger_sync/adaptors/netsuite_soap/subsidiary/operations/find.rb +38 -0
- data/lib/ledger_sync/adaptors/operation.rb +7 -11
- data/lib/ledger_sync/adaptors/quickbooks_online/account/searcher.rb +2 -13
- data/lib/ledger_sync/adaptors/quickbooks_online/adaptor.rb +158 -109
- data/lib/ledger_sync/adaptors/quickbooks_online/bill/searcher.rb +1 -15
- data/lib/ledger_sync/adaptors/quickbooks_online/config.rb +3 -2
- data/lib/ledger_sync/adaptors/quickbooks_online/customer/operations/create.rb +1 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/customer/operations/find.rb +1 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/customer/operations/update.rb +1 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/customer/searcher.rb +2 -16
- data/lib/ledger_sync/adaptors/quickbooks_online/dashboard_url_helper.rb +57 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/department/ledger_serializer.rb +38 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/department/operations/create.rb +23 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/department/operations/find.rb +23 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/department/operations/update.rb +25 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/department/searcher.rb +17 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/deposit/ledger_serializer.rb +3 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/deposit/operations/create.rb +1 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/deposit/operations/find.rb +1 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/deposit/operations/update.rb +1 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/deposit/searcher.rb +0 -15
- data/lib/ledger_sync/adaptors/quickbooks_online/expense/ledger_serializer.rb +0 -2
- data/lib/ledger_sync/adaptors/quickbooks_online/expense/searcher.rb +1 -15
- data/lib/ledger_sync/adaptors/quickbooks_online/invoice/ledger_serializer.rb +35 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/invoice/operations/create.rb +27 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/invoice/operations/find.rb +25 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/invoice/operations/update.rb +25 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/invoice_sales_line_item/ledger_serializer.rb +30 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/item/ledger_serializer.rb +13 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/journal_entry/searcher.rb +1 -15
- data/lib/ledger_sync/adaptors/quickbooks_online/ledger_class/ledger_serializer.rb +25 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/ledger_class/operations/create.rb +23 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/ledger_class/operations/find.rb +23 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/ledger_class/operations/update.rb +25 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/ledger_class/searcher.rb +15 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer.rb +8 -5
- data/lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer_type/entity_reference_type.rb +4 -14
- data/lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer_type/transaction_reference_type.rb +49 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/oauth_client.rb +93 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/operation.rb +42 -7
- data/lib/ledger_sync/adaptors/quickbooks_online/operation/create.rb +5 -8
- data/lib/ledger_sync/adaptors/quickbooks_online/operation/find.rb +9 -9
- data/lib/ledger_sync/adaptors/quickbooks_online/operation/full_update.rb +17 -15
- data/lib/ledger_sync/adaptors/quickbooks_online/payment/ledger_serializer.rb +25 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/payment/operations/create.rb +9 -6
- data/lib/ledger_sync/adaptors/quickbooks_online/payment/operations/find.rb +9 -2
- data/lib/ledger_sync/adaptors/quickbooks_online/payment/operations/update.rb +8 -1
- data/lib/ledger_sync/adaptors/quickbooks_online/payment_line_item/ledger_serializer.rb +19 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/request.rb +98 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/searcher.rb +29 -13
- data/lib/ledger_sync/adaptors/quickbooks_online/util/operation_error_parser.rb +1 -1
- data/lib/ledger_sync/adaptors/quickbooks_online/vendor/operations/create.rb +3 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/vendor/operations/find.rb +3 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/vendor/operations/update.rb +3 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/vendor/searcher.rb +5 -54
- data/lib/ledger_sync/adaptors/quickbooks_online/webhook.rb +58 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/webhook_event.rb +79 -0
- data/lib/ledger_sync/adaptors/quickbooks_online/webhook_notification.rb +42 -0
- data/lib/ledger_sync/adaptors/request.rb +53 -0
- data/lib/ledger_sync/adaptors/response.rb +55 -0
- data/lib/ledger_sync/adaptors/searcher.rb +3 -1
- data/lib/ledger_sync/adaptors/stripe/adaptor.rb +45 -0
- data/lib/ledger_sync/adaptors/stripe/config.rb +6 -0
- data/lib/ledger_sync/adaptors/stripe/customer/operations/create.rb +44 -0
- data/lib/ledger_sync/adaptors/stripe/customer/operations/delete.rb +35 -0
- data/lib/ledger_sync/adaptors/stripe/customer/operations/find.rb +44 -0
- data/lib/ledger_sync/adaptors/stripe/customer/operations/update.rb +43 -0
- data/lib/ledger_sync/adaptors/stripe/operation.rb +35 -0
- data/lib/ledger_sync/adaptors/stripe/operation/create.rb +17 -0
- data/lib/ledger_sync/adaptors/stripe/operation/delete.rb +17 -0
- data/lib/ledger_sync/adaptors/stripe/operation/find.rb +15 -0
- data/lib/ledger_sync/adaptors/stripe/operation/update.rb +17 -0
- data/lib/ledger_sync/adaptors/test/config.rb +0 -1
- data/lib/ledger_sync/adaptors/test/customer/operations/create.rb +1 -0
- data/lib/ledger_sync/adaptors/test/customer/operations/find.rb +1 -0
- data/lib/ledger_sync/adaptors/test/customer/operations/invalid.rb +1 -0
- data/lib/ledger_sync/adaptors/test/customer/operations/update.rb +1 -0
- data/lib/ledger_sync/adaptors/test/customer/operations/valid.rb +1 -0
- data/lib/ledger_sync/adaptors/test/payment/operations/create.rb +8 -1
- data/lib/ledger_sync/adaptors/test/payment/operations/find.rb +9 -2
- data/lib/ledger_sync/adaptors/test/payment/operations/update.rb +9 -5
- data/lib/ledger_sync/adaptors/test/vendor/operations/create.rb +5 -0
- data/lib/ledger_sync/adaptors/test/vendor/operations/find.rb +3 -0
- data/lib/ledger_sync/adaptors/test/vendor/operations/invalid.rb +5 -0
- data/lib/ledger_sync/adaptors/test/vendor/operations/update.rb +5 -0
- data/lib/ledger_sync/adaptors/test/vendor/operations/valid.rb +5 -0
- data/lib/ledger_sync/error/adaptor_errors.rb +18 -5
- data/lib/ledger_sync/error/operation_errors.rb +13 -4
- data/lib/ledger_sync/resource.rb +6 -0
- data/lib/ledger_sync/resource_attribute/dirty_mixin.rb +16 -15
- data/lib/ledger_sync/resources/bill.rb +7 -1
- data/lib/ledger_sync/resources/bill_line_item.rb +2 -0
- data/lib/ledger_sync/resources/currency.rb +9 -0
- data/lib/ledger_sync/resources/customer.rb +16 -0
- data/lib/ledger_sync/resources/department.rb +14 -0
- data/lib/ledger_sync/resources/deposit.rb +7 -0
- data/lib/ledger_sync/resources/deposit_line_item.rb +6 -0
- data/lib/ledger_sync/resources/expense.rb +5 -0
- data/lib/ledger_sync/resources/expense_line_item.rb +2 -0
- data/lib/ledger_sync/resources/invoice.rb +23 -0
- data/lib/ledger_sync/resources/invoice_sales_line_item.rb +17 -0
- data/lib/ledger_sync/resources/item.rb +5 -0
- data/lib/ledger_sync/resources/journal_entry.rb +5 -1
- data/lib/ledger_sync/resources/journal_entry_line_item.rb +4 -0
- data/lib/ledger_sync/resources/ledger_class.rb +14 -0
- data/lib/ledger_sync/resources/payment.rb +13 -0
- data/lib/ledger_sync/resources/payment_line_item.rb +15 -0
- data/lib/ledger_sync/resources/subsidiary.rb +8 -0
- data/lib/ledger_sync/resources/transfer.rb +4 -0
- data/lib/ledger_sync/resources/vendor.rb +9 -2
- data/lib/ledger_sync/type/reference_many.rb +12 -1
- data/lib/ledger_sync/type/reference_one.rb +1 -1
- data/lib/ledger_sync/util/resonad.rb +18 -0
- data/lib/ledger_sync/util/signer.rb +36 -0
- data/lib/ledger_sync/util/string_helpers.rb +12 -12
- data/lib/ledger_sync/version.rb +1 -1
- data/qa/env_spec.rb +5 -0
- data/qa/netsuite/account_spec.rb +20 -0
- data/qa/netsuite/currency_spec.rb +16 -0
- data/qa/netsuite/customer.rb +76 -0
- data/qa/netsuite/customer_spec.rb +21 -0
- data/qa/netsuite/vendor.rb +76 -0
- data/qa/netsuite/vendor_spec.rb +23 -0
- data/qa/netsuite_soap/customer_spec.rb +21 -0
- data/qa/netsuite_soap/subsidiary_spec.rb +0 -0
- data/qa/netsuite_test.rb +42 -0
- data/qa/qa_helper.rb +58 -0
- data/qa/quickbooks_online/account_spec.rb +14 -0
- data/qa/quickbooks_online/customer_spec.rb +13 -0
- data/qa/quickbooks_online/expense_spec.rb +31 -0
- data/qa/quickbooks_online/vendor_spec.rb +13 -0
- data/qa/stripe/customers_spec.rb +15 -0
- data/qa/support/adaptor_helpers.rb +99 -0
- data/qa/support/adaptor_support_setup.rb +23 -0
- data/qa/support/netsuite_helpers.rb +33 -0
- data/qa/support/netsuite_shared_examples.rb +30 -0
- data/qa/support/netsuite_soap_helpers.rb +33 -0
- data/qa/support/netsuite_soap_shared_examples.rb +10 -0
- data/qa/support/quickbooks_online_helpers.rb +42 -0
- data/qa/support/quickbooks_online_shared_examples.rb +82 -0
- data/qa/support/shared_examples.rb +127 -0
- data/qa/support/stripe_helpers.rb +22 -0
- data/qa/support/stripe_shared_examples.rb +10 -0
- data/qa/test.rb +67 -0
- data/release.sh +13 -1
- metadata +189 -3
- data/qa.rb +0 -142
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require_relative '../searcher'
|
3
4
|
|
4
5
|
module LedgerSync
|
@@ -6,21 +7,6 @@ module LedgerSync
|
|
6
7
|
module QuickBooksOnline
|
7
8
|
module Bill
|
8
9
|
class Searcher < QuickBooksOnline::Searcher
|
9
|
-
def resources
|
10
|
-
@resources ||= begin
|
11
|
-
adaptor
|
12
|
-
.query(
|
13
|
-
resource: 'bill',
|
14
|
-
limit: limit,
|
15
|
-
offset: offset
|
16
|
-
)
|
17
|
-
.map do |c|
|
18
|
-
LedgerSync::Bill.new(
|
19
|
-
ledger_id: c.fetch('Id')
|
20
|
-
)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
10
|
end
|
25
11
|
end
|
26
12
|
end
|
@@ -1,7 +1,8 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
LedgerSync.register_adaptor(:quickbooks_online, module_string: 'QuickBooksOnline') do |config|
|
2
4
|
config.name = 'QuickBooks Online'
|
3
5
|
config.add_alias :qbo
|
4
6
|
config.add_alias :quick_books_online
|
5
|
-
config.module = 'QuickBooksOnline'
|
6
7
|
config.rate_limiting_wait_in_seconds = 60
|
7
8
|
end
|
@@ -3,22 +3,8 @@ module LedgerSync
|
|
3
3
|
module QuickBooksOnline
|
4
4
|
module Customer
|
5
5
|
class Searcher < LedgerSync::Adaptors::QuickBooksOnline::Searcher
|
6
|
-
def
|
7
|
-
|
8
|
-
adaptor
|
9
|
-
.query(
|
10
|
-
resource: 'customer',
|
11
|
-
query: "DisplayName LIKE '%#{query}%'",
|
12
|
-
limit: limit,
|
13
|
-
offset: offset
|
14
|
-
)
|
15
|
-
.map do |c|
|
16
|
-
LedgerSync::Customer.new(
|
17
|
-
ledger_id: c.fetch('Id'),
|
18
|
-
name: c.dig('FullyQualifiedName')
|
19
|
-
)
|
20
|
-
end
|
21
|
-
end
|
6
|
+
def query_string
|
7
|
+
"DisplayName LIKE '%#{query}%'"
|
22
8
|
end
|
23
9
|
end
|
24
10
|
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module LedgerSync
|
4
|
+
module Adaptors
|
5
|
+
module QuickBooksOnline
|
6
|
+
class DashboardURLHelper
|
7
|
+
PRODUCTION_APP_URL_BASE = 'https://qbo.intuit.com/app'
|
8
|
+
SANDBOX_APP_URL_BASE = 'https://app.sandbox.qbo.intuit.com/app'
|
9
|
+
|
10
|
+
attr_reader :resource,
|
11
|
+
:test
|
12
|
+
|
13
|
+
def initialize(resource:, test:)
|
14
|
+
@resource = resource
|
15
|
+
@test = test
|
16
|
+
end
|
17
|
+
|
18
|
+
def production_url
|
19
|
+
@production_url ||= PRODUCTION_APP_URL_BASE + resource_path
|
20
|
+
end
|
21
|
+
|
22
|
+
def resource_path
|
23
|
+
@resource_path = case resource
|
24
|
+
when LedgerSync::Account
|
25
|
+
"/register?accountId=#{resource.ledger_id}"
|
26
|
+
when LedgerSync::Bill
|
27
|
+
"/bill?txnId=#{resource.ledger_id}"
|
28
|
+
when LedgerSync::Customer
|
29
|
+
"/customerdetail?nameId=#{resource.ledger_id}"
|
30
|
+
when LedgerSync::Deposit
|
31
|
+
"/deposit?txnId=#{resource.ledger_id}"
|
32
|
+
when LedgerSync::Expense
|
33
|
+
"/expense?txnId=#{resource.ledger_id}"
|
34
|
+
when LedgerSync::JournalEntry
|
35
|
+
"/journal?txnId=#{resource.ledger_id}"
|
36
|
+
when LedgerSync::Payment
|
37
|
+
"/recvpayment?txnId=#{resource.ledger_id}"
|
38
|
+
when LedgerSync::Transfer
|
39
|
+
"/transfer?txnId=#{resource.ledger_id}"
|
40
|
+
when LedgerSync::Vendor
|
41
|
+
"/vendordetail?nameId=#{resource.ledger_id}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def sandbox_url
|
46
|
+
@sandbox_url ||= SANDBOX_APP_URL_BASE + resource_path
|
47
|
+
end
|
48
|
+
|
49
|
+
def url
|
50
|
+
return production_url unless test
|
51
|
+
|
52
|
+
sandbox_url
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module LedgerSync
|
4
|
+
module Adaptors
|
5
|
+
module QuickBooksOnline
|
6
|
+
module Department
|
7
|
+
class LedgerSerializer < QuickBooksOnline::LedgerSerializer
|
8
|
+
id
|
9
|
+
|
10
|
+
attribute ledger_attribute: 'Name',
|
11
|
+
resource_attribute: :name
|
12
|
+
attribute ledger_attribute: 'Active',
|
13
|
+
resource_attribute: :active
|
14
|
+
attribute ledger_attribute: 'SubDepartment',
|
15
|
+
resource_attribute: :sub_department
|
16
|
+
attribute ledger_attribute: 'FullyQualifiedName',
|
17
|
+
resource_attribute: :fully_qualified_name
|
18
|
+
|
19
|
+
attribute ledger_attribute: 'ParentRef.value',
|
20
|
+
resource_attribute: 'parent.ledger_id'
|
21
|
+
|
22
|
+
# Sending "ParentRef": {"value": null} results in QBO API crash
|
23
|
+
# This patches serialized hash to exclude it unless we don't set value
|
24
|
+
def to_ledger_hash(deep_merge_unmapped_values: {}, only_changes: false)
|
25
|
+
ret = super(only_changes: only_changes)
|
26
|
+
ret = ret.except('ParentRef') unless resource.parent_changed?
|
27
|
+
return ret unless deep_merge_unmapped_values.any?
|
28
|
+
|
29
|
+
deep_merge_if_not_mapped(
|
30
|
+
current_hash: ret,
|
31
|
+
hash_to_search: deep_merge_unmapped_values
|
32
|
+
)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module LedgerSync
|
2
|
+
module Adaptors
|
3
|
+
module QuickBooksOnline
|
4
|
+
module Department
|
5
|
+
module Operations
|
6
|
+
class Create < QuickBooksOnline::Operation::Create
|
7
|
+
class Contract < LedgerSync::Adaptors::Contract
|
8
|
+
params do
|
9
|
+
required(:external_id).maybe(:string)
|
10
|
+
required(:ledger_id).value(:nil)
|
11
|
+
required(:name).filled(:string)
|
12
|
+
required(:active).filled(:bool?)
|
13
|
+
required(:sub_department).filled(:bool?)
|
14
|
+
optional(:fully_qualified_name).maybe(:string)
|
15
|
+
optional(:parent).maybe(:hash, Types::Reference)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module LedgerSync
|
2
|
+
module Adaptors
|
3
|
+
module QuickBooksOnline
|
4
|
+
module Department
|
5
|
+
module Operations
|
6
|
+
class Find < QuickBooksOnline::Operation::Find
|
7
|
+
class Contract < LedgerSync::Adaptors::Contract
|
8
|
+
params do
|
9
|
+
required(:external_id).maybe(:string)
|
10
|
+
required(:ledger_id).filled(:string)
|
11
|
+
optional(:name).maybe(:string)
|
12
|
+
optional(:active).maybe(:bool?)
|
13
|
+
optional(:sub_department).maybe(:bool?)
|
14
|
+
optional(:fully_qualified_name).maybe(:string)
|
15
|
+
optional(:parent).maybe(:hash, Types::Reference)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module LedgerSync
|
4
|
+
module Adaptors
|
5
|
+
module QuickBooksOnline
|
6
|
+
module Department
|
7
|
+
module Operations
|
8
|
+
class Update < QuickBooksOnline::Operation::FullUpdate
|
9
|
+
class Contract < LedgerSync::Adaptors::Contract
|
10
|
+
params do
|
11
|
+
required(:external_id).maybe(:string)
|
12
|
+
required(:ledger_id).filled(:string)
|
13
|
+
required(:name).filled(:string)
|
14
|
+
required(:active).filled(:bool?)
|
15
|
+
required(:sub_department).filled(:bool?)
|
16
|
+
optional(:fully_qualified_name).maybe(:string)
|
17
|
+
optional(:parent).maybe(:hash, Types::Reference)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module LedgerSync
|
4
|
+
module Adaptors
|
5
|
+
module QuickBooksOnline
|
6
|
+
module Department
|
7
|
+
class Searcher < LedgerSync::Adaptors::QuickBooksOnline::Searcher
|
8
|
+
private
|
9
|
+
|
10
|
+
def query_string
|
11
|
+
@query_string ||= "Name LIKE '%#{query}%'"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -25,6 +25,9 @@ module LedgerSync
|
|
25
25
|
attribute ledger_attribute: 'DepositToAccountRef.value',
|
26
26
|
resource_attribute: 'account.ledger_id'
|
27
27
|
|
28
|
+
attribute ledger_attribute: 'DepartmentRef.value',
|
29
|
+
resource_attribute: 'department.ledger_id'
|
30
|
+
|
28
31
|
references_many ledger_attribute: 'Line',
|
29
32
|
resource_attribute: :line_items,
|
30
33
|
serializer: DepositLineItem::LedgerSerializer
|
@@ -10,6 +10,7 @@ module LedgerSync
|
|
10
10
|
required(:ledger_id).value(:nil)
|
11
11
|
required(:account).hash(Types::Reference)
|
12
12
|
required(:currency).filled(:string)
|
13
|
+
required(:department).hash(Types::Reference)
|
13
14
|
required(:memo).filled(:string)
|
14
15
|
required(:transaction_date).filled(:date?)
|
15
16
|
required(:exchange_rate).maybe(:float)
|
@@ -10,6 +10,7 @@ module LedgerSync
|
|
10
10
|
required(:ledger_id).filled(:string)
|
11
11
|
required(:account).hash(Types::Reference)
|
12
12
|
required(:currency).maybe(:string)
|
13
|
+
required(:department).hash(Types::Reference)
|
13
14
|
required(:memo).maybe(:string)
|
14
15
|
required(:transaction_date).filled(:date?)
|
15
16
|
required(:exchange_rate).maybe(:float)
|
@@ -12,6 +12,7 @@ module LedgerSync
|
|
12
12
|
required(:ledger_id).filled(:string)
|
13
13
|
required(:account).hash(Types::Reference)
|
14
14
|
required(:currency).filled(:string)
|
15
|
+
required(:department).hash(Types::Reference)
|
15
16
|
required(:memo).filled(:string)
|
16
17
|
required(:transaction_date).filled(:date?)
|
17
18
|
required(:exchange_rate).maybe(:float)
|
@@ -6,21 +6,6 @@ module LedgerSync
|
|
6
6
|
module QuickBooksOnline
|
7
7
|
module Deposit
|
8
8
|
class Searcher < QuickBooksOnline::Searcher
|
9
|
-
def resources
|
10
|
-
@resources ||= begin
|
11
|
-
adaptor
|
12
|
-
.query(
|
13
|
-
resource: 'deposit',
|
14
|
-
limit: limit,
|
15
|
-
offset: offset
|
16
|
-
)
|
17
|
-
.map do |c|
|
18
|
-
LedgerSync::Deposit.new(
|
19
|
-
ledger_id: c.fetch('Id')
|
20
|
-
)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
9
|
end
|
25
10
|
end
|
26
11
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require_relative '../searcher'
|
3
4
|
|
4
5
|
module LedgerSync
|
@@ -6,21 +7,6 @@ module LedgerSync
|
|
6
7
|
module QuickBooksOnline
|
7
8
|
module Expense
|
8
9
|
class Searcher < QuickBooksOnline::Searcher
|
9
|
-
def resources
|
10
|
-
@resources ||= begin
|
11
|
-
adaptor
|
12
|
-
.query(
|
13
|
-
resource: 'purchase',
|
14
|
-
limit: limit,
|
15
|
-
offset: offset
|
16
|
-
)
|
17
|
-
.map do |c|
|
18
|
-
LedgerSync::Expense.new(
|
19
|
-
ledger_id: c.fetch('Id')
|
20
|
-
)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
10
|
end
|
25
11
|
end
|
26
12
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../invoice_sales_line_item/ledger_serializer'
|
4
|
+
|
5
|
+
module LedgerSync
|
6
|
+
module Adaptors
|
7
|
+
module QuickBooksOnline
|
8
|
+
module Invoice
|
9
|
+
class LedgerSerializer < QuickBooksOnline::LedgerSerializer
|
10
|
+
id
|
11
|
+
|
12
|
+
attribute ledger_attribute: 'CurrencyRef.value',
|
13
|
+
resource_attribute: :currency
|
14
|
+
|
15
|
+
attribute ledger_attribute: 'TxnDate',
|
16
|
+
resource_attribute: :transaction_date,
|
17
|
+
type: LedgerSerializerType::DateType
|
18
|
+
|
19
|
+
attribute ledger_attribute: 'PrivateNote',
|
20
|
+
resource_attribute: :memo
|
21
|
+
|
22
|
+
attribute ledger_attribute: 'CustomerRef.value',
|
23
|
+
resource_attribute: 'customer.ledger_id'
|
24
|
+
|
25
|
+
attribute ledger_attribute: 'DepositToAccountRef.value',
|
26
|
+
resource_attribute: 'account.ledger_id'
|
27
|
+
|
28
|
+
references_many ledger_attribute: 'Line',
|
29
|
+
resource_attribute: :line_items,
|
30
|
+
serializer: InvoiceSalesLineItem::LedgerSerializer
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module LedgerSync
|
4
|
+
module Adaptors
|
5
|
+
module QuickBooksOnline
|
6
|
+
module Invoice
|
7
|
+
module Operations
|
8
|
+
class Create < Operation::Create
|
9
|
+
class Contract < LedgerSync::Adaptors::Contract
|
10
|
+
params do
|
11
|
+
required(:external_id).maybe(:string)
|
12
|
+
optional(:account).hash(Types::Reference)
|
13
|
+
required(:currency).filled(:string)
|
14
|
+
required(:customer).hash(Types::Reference)
|
15
|
+
optional(:deposit).maybe(:integer)
|
16
|
+
required(:ledger_id).value(:nil)
|
17
|
+
required(:line_items).array(Types::Reference)
|
18
|
+
optional(:memo).filled(:string)
|
19
|
+
optional(:transaction_date).filled(:date?)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|