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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8aeb1fb1722b3457692a3a513ecd3dc419a3a489d00a24aa2839dfae6e5f203f
|
4
|
+
data.tar.gz: 66e5e8415a1c2bfb6c1c04f8210e046f3510390a0bf0768932d6120a1453bf8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87bc80cc850ac858e3d448098d2acd8b1f7a502ec7e51126c1d9a52560aedc02dcd968069fbf9a9de0a86ebbc7b6c52f64ccf0a6c3cdc4fbe5bf390fdd4373af
|
7
|
+
data.tar.gz: 3b5e0d36361a0910acd74c4ae3de805c09ad14838cfc02eb458c8fc93069190f0633f4738fb549d1e3de0f92e1f6dd74110317f20d36c718d1352e3c1ba5f861
|
data/.env.template
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
NETSUITE_QA=0 # Set to 1 to run NETSUITE tests
|
2
|
+
NETSUITE_ACCOUNT_ID=
|
3
|
+
NETSUITE_CONSUMER_KEY=
|
4
|
+
NETSUITE_CONSUMER_SECRET=
|
5
|
+
NETSUITE_TOKEN_ID=
|
6
|
+
NETSUITE_TOKEN_SECRET=
|
7
|
+
|
8
|
+
NETSUITE_SOAP_QA=0 # Set to 1 to run NETSUITE_SOAP tests
|
9
|
+
NETSUITE_SOAP_ACCOUNT_ID=
|
10
|
+
NETSUITE_SOAP_API_VERSION=
|
11
|
+
NETSUITE_SOAP_APPLICATION_ID=
|
12
|
+
NETSUITE_SOAP_CONSUMER_KEY=
|
13
|
+
NETSUITE_SOAP_CONSUMER_SECRET=
|
14
|
+
NETSUITE_SOAP_TOKEN_ID=
|
15
|
+
NETSUITE_SOAP_TOKEN_SECRET=
|
16
|
+
|
17
|
+
QUICKBOOKS_ONLINE_QA=0 # Set to 1 to run QUICKBOOKS_ONLINE tests
|
18
|
+
QUICKBOOKS_ONLINE_ACCESS_TOKEN=
|
19
|
+
QUICKBOOKS_ONLINE_CLIENT_ID=
|
20
|
+
QUICKBOOKS_ONLINE_CLIENT_SECRET=
|
21
|
+
QUICKBOOKS_ONLINE_REALM_ID=
|
22
|
+
QUICKBOOKS_ONLINE_REFRESH_TOKEN=
|
23
|
+
|
24
|
+
STRIPE_QA=0 # Set to 1 to run STRIPE tests
|
25
|
+
STRIPE_API_KEY=
|
data/.gitignore
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -12,7 +12,7 @@ Metrics/AbcSize:
|
|
12
12
|
Metrics/BlockLength:
|
13
13
|
Enabled: False
|
14
14
|
|
15
|
-
|
15
|
+
Metrics/ClassLength:
|
16
16
|
Enabled: False
|
17
17
|
|
18
18
|
Metrics/LineLength:
|
@@ -23,3 +23,6 @@ Metrics/MethodLength:
|
|
23
23
|
|
24
24
|
Metrics/ParameterLists:
|
25
25
|
Enabled: False
|
26
|
+
|
27
|
+
Style/Documentation:
|
28
|
+
Enabled: False
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,36 +1,43 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ledger_sync (1.1
|
4
|
+
ledger_sync (1.3.1)
|
5
5
|
activemodel
|
6
6
|
colorize
|
7
7
|
coveralls
|
8
|
+
dotenv
|
8
9
|
dry-schema
|
9
10
|
dry-validation
|
10
11
|
faraday
|
11
12
|
faraday-detailed_logger
|
12
13
|
faraday_middleware
|
13
14
|
fingerprintable (>= 1.2.1)
|
15
|
+
netsuite
|
14
16
|
nokogiri
|
15
17
|
oauth2
|
16
18
|
resonad
|
17
19
|
simply_serializable (>= 1.3.0)
|
20
|
+
stripe
|
18
21
|
|
19
22
|
GEM
|
20
23
|
remote: https://rubygems.org/
|
21
24
|
specs:
|
22
|
-
activemodel (6.0.
|
23
|
-
activesupport (= 6.0.
|
24
|
-
activesupport (6.0.
|
25
|
+
activemodel (6.0.1)
|
26
|
+
activesupport (= 6.0.1)
|
27
|
+
activesupport (6.0.1)
|
25
28
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
26
29
|
i18n (>= 0.7, < 2)
|
27
30
|
minitest (~> 5.1)
|
28
31
|
tzinfo (~> 1.1)
|
29
|
-
zeitwerk (~> 2.
|
32
|
+
zeitwerk (~> 2.2)
|
30
33
|
addressable (2.7.0)
|
31
34
|
public_suffix (>= 2.0.2, < 5.0)
|
35
|
+
akami (1.3.1)
|
36
|
+
gyoku (>= 0.4.0)
|
37
|
+
nokogiri
|
32
38
|
ast (2.4.0)
|
33
39
|
awesome_print (1.8.0)
|
40
|
+
builder (3.2.4)
|
34
41
|
bump (0.8.0)
|
35
42
|
byebug (11.0.1)
|
36
43
|
colorize (0.8.1)
|
@@ -45,7 +52,8 @@ GEM
|
|
45
52
|
safe_yaml (~> 1.0.0)
|
46
53
|
diff-lcs (1.3)
|
47
54
|
docile (1.3.2)
|
48
|
-
|
55
|
+
dotenv (2.7.5)
|
56
|
+
dry-configurable (0.9.0)
|
49
57
|
concurrent-ruby (~> 1.0)
|
50
58
|
dry-core (~> 0.4, >= 0.4.7)
|
51
59
|
dry-container (0.7.2)
|
@@ -53,14 +61,14 @@ GEM
|
|
53
61
|
dry-configurable (~> 0.1, >= 0.1.3)
|
54
62
|
dry-core (0.4.9)
|
55
63
|
concurrent-ruby (~> 1.0)
|
56
|
-
dry-equalizer (0.
|
64
|
+
dry-equalizer (0.3.0)
|
57
65
|
dry-inflector (0.2.0)
|
58
|
-
dry-initializer (3.0.
|
59
|
-
dry-logic (1.0.
|
66
|
+
dry-initializer (3.0.3)
|
67
|
+
dry-logic (1.0.5)
|
60
68
|
concurrent-ruby (~> 1.0)
|
61
69
|
dry-core (~> 0.2)
|
62
70
|
dry-equalizer (~> 0.2)
|
63
|
-
dry-schema (1.4.
|
71
|
+
dry-schema (1.4.3)
|
64
72
|
concurrent-ruby (~> 1.0)
|
65
73
|
dry-configurable (~> 0.8, >= 0.8.3)
|
66
74
|
dry-core (~> 0.4)
|
@@ -68,41 +76,51 @@ GEM
|
|
68
76
|
dry-initializer (~> 3.0)
|
69
77
|
dry-logic (~> 1.0)
|
70
78
|
dry-types (~> 1.2)
|
71
|
-
dry-types (1.2.
|
79
|
+
dry-types (1.2.2)
|
72
80
|
concurrent-ruby (~> 1.0)
|
73
81
|
dry-container (~> 0.3)
|
74
82
|
dry-core (~> 0.4, >= 0.4.4)
|
75
|
-
dry-equalizer (~> 0.
|
83
|
+
dry-equalizer (~> 0.3)
|
76
84
|
dry-inflector (~> 0.1, >= 0.1.2)
|
77
85
|
dry-logic (~> 1.0, >= 1.0.2)
|
78
|
-
dry-validation (1.
|
86
|
+
dry-validation (1.4.2)
|
79
87
|
concurrent-ruby (~> 1.0)
|
80
88
|
dry-container (~> 0.7, >= 0.7.1)
|
81
89
|
dry-core (~> 0.4)
|
82
90
|
dry-equalizer (~> 0.2)
|
83
91
|
dry-initializer (~> 3.0)
|
84
|
-
dry-schema (~> 1.
|
85
|
-
|
92
|
+
dry-schema (~> 1.4, >= 1.4.3)
|
93
|
+
factory_bot (4.11.1)
|
94
|
+
activesupport (>= 3.0.0)
|
95
|
+
faraday (0.17.3)
|
86
96
|
multipart-post (>= 1.2, < 3)
|
87
|
-
faraday-detailed_logger (2.
|
88
|
-
faraday (
|
89
|
-
faraday_middleware (0.
|
97
|
+
faraday-detailed_logger (2.2.0)
|
98
|
+
faraday (>= 0.8, < 2)
|
99
|
+
faraday_middleware (0.14.0)
|
90
100
|
faraday (>= 0.7.4, < 1.0)
|
91
101
|
fingerprintable (1.2.1)
|
92
102
|
colorize
|
103
|
+
gyoku (1.3.1)
|
104
|
+
builder (>= 2.1.2)
|
93
105
|
hashdiff (1.0.0)
|
106
|
+
httpi (2.4.4)
|
107
|
+
rack
|
108
|
+
socksify
|
94
109
|
i18n (1.7.0)
|
95
110
|
concurrent-ruby (~> 1.0)
|
96
111
|
jaro_winkler (1.5.3)
|
97
|
-
json (2.
|
112
|
+
json (2.3.0)
|
98
113
|
jwt (2.2.1)
|
99
114
|
mini_portile2 (2.4.0)
|
100
|
-
minitest (5.
|
115
|
+
minitest (5.13.0)
|
101
116
|
multi_json (1.14.1)
|
102
117
|
multi_xml (0.6.0)
|
103
118
|
multipart-post (2.1.1)
|
104
|
-
|
119
|
+
netsuite (0.8.5)
|
120
|
+
savon (>= 2.3.0)
|
121
|
+
nokogiri (1.10.7)
|
105
122
|
mini_portile2 (~> 2.4.0)
|
123
|
+
nori (2.6.0)
|
106
124
|
oauth2 (1.4.2)
|
107
125
|
faraday (>= 0.8, < 2.0)
|
108
126
|
jwt (>= 1.0, < 3.0)
|
@@ -113,7 +131,7 @@ GEM
|
|
113
131
|
parser (2.6.4.1)
|
114
132
|
ast (~> 2.4.0)
|
115
133
|
public_suffix (4.0.1)
|
116
|
-
rack (2.
|
134
|
+
rack (2.1.1)
|
117
135
|
rainbow (3.0.0)
|
118
136
|
rake (10.5.0)
|
119
137
|
resonad (1.2.0)
|
@@ -139,6 +157,14 @@ GEM
|
|
139
157
|
unicode-display_width (>= 1.4.0, < 1.7)
|
140
158
|
ruby-progressbar (1.10.1)
|
141
159
|
safe_yaml (1.0.5)
|
160
|
+
savon (2.12.0)
|
161
|
+
akami (~> 1.2)
|
162
|
+
builder (>= 2.1.2)
|
163
|
+
gyoku (~> 1.2)
|
164
|
+
httpi (~> 2.3)
|
165
|
+
nokogiri (>= 1.8.1)
|
166
|
+
nori (~> 2.4)
|
167
|
+
wasabi (~> 3.4)
|
142
168
|
simplecov (0.16.1)
|
143
169
|
docile (~> 1.1)
|
144
170
|
json (>= 1.8, < 3)
|
@@ -146,20 +172,27 @@ GEM
|
|
146
172
|
simplecov-html (0.10.2)
|
147
173
|
simply_serializable (1.4.2)
|
148
174
|
fingerprintable (>= 1.2.1)
|
175
|
+
socksify (1.7.1)
|
176
|
+
stripe (5.14.0)
|
177
|
+
sync (0.5.0)
|
149
178
|
term-ansicolor (1.7.1)
|
150
179
|
tins (~> 1.0)
|
151
|
-
thor (0.
|
180
|
+
thor (1.0.1)
|
152
181
|
thread_safe (0.3.6)
|
153
|
-
tins (1.
|
182
|
+
tins (1.24.0)
|
183
|
+
sync
|
154
184
|
tzinfo (1.2.5)
|
155
185
|
thread_safe (~> 0.1)
|
156
186
|
unicode-display_width (1.6.0)
|
157
187
|
vcr (5.0.0)
|
188
|
+
wasabi (3.5.0)
|
189
|
+
httpi (~> 2.0)
|
190
|
+
nokogiri (>= 1.4.2)
|
158
191
|
webmock (3.7.5)
|
159
192
|
addressable (>= 2.3.6)
|
160
193
|
crack (>= 0.3.2)
|
161
194
|
hashdiff (>= 0.4.0, < 2.0.0)
|
162
|
-
zeitwerk (2.2.
|
195
|
+
zeitwerk (2.2.2)
|
163
196
|
|
164
197
|
PLATFORMS
|
165
198
|
ruby
|
@@ -169,6 +202,7 @@ DEPENDENCIES
|
|
169
202
|
bump
|
170
203
|
bundler (~> 1.16)
|
171
204
|
byebug
|
205
|
+
factory_bot
|
172
206
|
ledger_sync!
|
173
207
|
rake (~> 10.0)
|
174
208
|
rspec (~> 3.2)
|
data/README.md
CHANGED
@@ -14,11 +14,15 @@ gem 'ledger_sync'
|
|
14
14
|
|
15
15
|
And then execute:
|
16
16
|
|
17
|
-
|
17
|
+
```bash
|
18
|
+
$ bundle
|
19
|
+
```
|
18
20
|
|
19
21
|
Or install it yourself as:
|
20
22
|
|
21
|
-
|
23
|
+
```bash
|
24
|
+
$ gem install ledger_sync
|
25
|
+
```
|
22
26
|
|
23
27
|
## Usage
|
24
28
|
|
@@ -138,13 +142,122 @@ next_searcher = searcher.next_searcher
|
|
138
142
|
previous_searcher = searcher.previous_searcher
|
139
143
|
```
|
140
144
|
|
145
|
+
## NetSuite
|
146
|
+
|
147
|
+
The NetSuite adaptor leverages NetSuite's REST API.
|
148
|
+
|
149
|
+
### Resource Metadata and Schemas
|
150
|
+
|
151
|
+
Due to NetSuites granular user permissions and custom attributes, resources and methods for those resources can vary from one user (a.k.a. token) to another. Because of this variance, there are some helper classes that allow you to retrieve NetSuite records, allowed methods, attributes/parameters, etc.
|
152
|
+
|
153
|
+
To retrieve the metadata for a record:
|
154
|
+
|
155
|
+
```ruby
|
156
|
+
metadata = LedgerSync::Adaptors::NetSuite::Record::Metadata.new(
|
157
|
+
adaptor: netsuite_adaptor, # Assuming this is previous defined
|
158
|
+
record: :customer
|
159
|
+
)
|
160
|
+
|
161
|
+
puts metadata.http_methods # Returns a list of LedgerSync::Adaptors::NetSuite::Record::HTTPMethod objects
|
162
|
+
puts metadata.properties # Returns a list of LedgerSync::Adaptors::NetSuite::Record::Property objects
|
163
|
+
```
|
164
|
+
|
165
|
+
### Reference
|
166
|
+
|
167
|
+
- [NetSuite REST API Documentation](https://docs.oracle.com/cloud/latest/netsuitecs_gs/NSTRW/NSTRW.pdf)
|
168
|
+
|
169
|
+
## NetSuite SOAP
|
170
|
+
|
171
|
+
LedgerSync supports the NetSuite SOAP adaptor, leveraging [the NetSuite gem](https://github.com/NetSweet/netsuite). The adaptor and sample operations are provided, though the main NetSuite adaptor uses the REST API.
|
172
|
+
|
173
|
+
### Reference
|
174
|
+
|
175
|
+
- [NetSuite SOAP API Documentation](https://docs.oracle.com/cloud/latest/netsuitecs_gs/NSTWR/NSTWR.pdf)
|
176
|
+
|
177
|
+
|
141
178
|
## QuickBooks Online
|
142
179
|
|
180
|
+
### OAuth
|
181
|
+
|
182
|
+
QuickBooks Online utilizes OAuth 2.0, which requires frequent refreshing of the access token. The adaptor will handle this automatically, attempting a single token refresh on any single request authentication failure. Depending on how you use the library, every adaptor has implements a class method `ledger_attributes_to_save`, which is an array of attributes that may change as the adaptor is used. You can also call the instance method `ledger_attributes_to_save` which will be a hash of these values. It is a good practice to always store these attributes if you are saving access tokens in your database.
|
183
|
+
|
184
|
+
The adaptor also implements some helper methods for getting tokens. For example, you can set up an adaptor using the following:
|
185
|
+
|
186
|
+
```ruby
|
187
|
+
# Retrieve the following values from Intuit app settings
|
188
|
+
client_id = 'ID'
|
189
|
+
client_secret = 'SECRET'
|
190
|
+
redirect_uri = 'http://localhost:3000'
|
191
|
+
|
192
|
+
oauth_client = LedgerSync::Adaptors::QuickBooksOnline::OAuthClientHelper.new(
|
193
|
+
client_id: client_id,
|
194
|
+
client_secret: client_secret
|
195
|
+
)
|
196
|
+
|
197
|
+
puts oauth_client.authorization_url(redirect_uri: redirect_uri)
|
198
|
+
|
199
|
+
# Visit on the output URL and authorize a company.
|
200
|
+
# You will be redirected back to the redirect_uri.
|
201
|
+
# Copy the full url from your browser:
|
202
|
+
|
203
|
+
uri = 'https://localhost:3000/?code=FOO&state=BAR&realm_id=BAZ'
|
204
|
+
|
205
|
+
adaptor = LedgerSync::Adaptors::QuickBooksOnline::Adaptor.new_from_oauth_client_uri(
|
206
|
+
oauth_client: oauth_client,
|
207
|
+
uri: uri
|
208
|
+
)
|
209
|
+
|
210
|
+
# You can test that the auth works:
|
211
|
+
|
212
|
+
adaptor.refresh!
|
213
|
+
```
|
214
|
+
|
215
|
+
**Note: If you have a `.env` file storing your secrets, the adaptor will automatically update the variables and record previous values whenever values change**
|
216
|
+
|
217
|
+
### Webhooks
|
218
|
+
|
219
|
+
Reference: [QuickBooks Online Webhook Documentation](https://developer.intuit.com/app/developer/qbo/docs/develop/webhooks/managing-webhooks-notifications#validating-the-notification)
|
220
|
+
|
221
|
+
LedgerSync offers an easy way to validate and parse webhook payloads. It also allows you to easily fetch the resources referenced. You can create and use a webhook with the following:
|
222
|
+
|
223
|
+
```ruby
|
224
|
+
# Assuming `request` is the webhook request received from Quickbooks Online
|
225
|
+
webhook = LedgerSync::Adaptors::QuickBooksOnline::Webhook.new(
|
226
|
+
payload: request.body.read # It accepts a JSON string or hash
|
227
|
+
)
|
228
|
+
|
229
|
+
verification_token = WEBHOOK_VERIFICATION_TOKEN # You get this token when you create webhooks in the QuickBooks Online dashboard
|
230
|
+
signature = request.headers['intuit-signature']
|
231
|
+
raise 'Not valid' unless webhook.valid?(signature: signature, verification_token: verification_token)
|
232
|
+
|
233
|
+
# Although not yet used, webhooks may include notifications for multiple realms
|
234
|
+
webhook.notifications.each do |notification|
|
235
|
+
puts notification.realm_id
|
236
|
+
|
237
|
+
# Multiple events may be referenced.
|
238
|
+
notification.events.each do |event|
|
239
|
+
puts event.resource # Returns a LedgerSync resource with the `ledger_id` set
|
240
|
+
|
241
|
+
# Other helpful methods
|
242
|
+
notification.find_operation_class(adaptor: your_quickbooks_adaptor_instance) # The respective Find class
|
243
|
+
notification.find_operation(adaptor: your_quickbooks_adaptor_instance) # The initialized respective Find operation
|
244
|
+
notification.find(adaptor: your_quickbooks_adaptor_instance) # Performs a Find operation for the resource retrieving the latest version from QuickBooks Online
|
245
|
+
end
|
246
|
+
|
247
|
+
# Other helpful methods
|
248
|
+
notification.resources # All resources for a given webhook across all events
|
249
|
+
end
|
250
|
+
|
251
|
+
# Other helpful methods
|
252
|
+
webhook.events # All events for a given webhook across all realms
|
253
|
+
webhook.resources # All events for a given webhook across all realms and events
|
254
|
+
```
|
255
|
+
|
143
256
|
### Errors
|
144
257
|
|
145
|
-
https://developer.intuit.com/app/developer/qbo/docs/develop/troubleshooting/error-codes
|
258
|
+
- [QuickBooks Online Error Documentation](https://developer.intuit.com/app/developer/qbo/docs/develop/troubleshooting/error-codes)
|
146
259
|
|
147
|
-
## Tips and More
|
260
|
+
## Tips and More
|
148
261
|
|
149
262
|
### Keyword Arguments
|
150
263
|
|
@@ -217,7 +330,7 @@ The serialization of any object follows the same structure. There is a `:root`
|
|
217
330
|
}
|
218
331
|
```
|
219
332
|
|
220
|
-
##
|
333
|
+
## Test Adaptor
|
221
334
|
|
222
335
|
LedgerSync offers a test adaptor `LedgerSync::Adaptors::Test::Adaptor` that you can easily use and stub without requiring API requests. For example:
|
223
336
|
|
@@ -239,11 +352,42 @@ expect { operation.perform }.to raise_error(PerformedOperationError)
|
|
239
352
|
|
240
353
|
## Development
|
241
354
|
|
242
|
-
After checking out the repo, run `bin/setup` to install dependencies.
|
355
|
+
After checking out the repo, run `bin/setup` to install dependencies.
|
243
356
|
|
244
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org)
|
357
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org)
|
245
358
|
|
246
|
-
|
359
|
+
### Testing
|
360
|
+
|
361
|
+
Run `bundle exec rspec` to run all unit, feature, and integration tests. Unlike QA Tests, all external HTTP requests and responses are stubbed.
|
362
|
+
|
363
|
+
### QA Testing
|
364
|
+
|
365
|
+
**BE SURE TO USE A TEST ENVIRONMENT ON YOUR LEDGER.**
|
366
|
+
|
367
|
+
To fully test the library against the actual ledgers, you can run `bin/qa` which will run all tests in the `qa/` directory. QA Tests are written in RSpec. Unlike tests in the `spec/` directory, QA tests allow external HTTP requests.
|
368
|
+
|
369
|
+
As these interact with real ledgers, you will need to provide secrets. You can do so in a `.env` file in the root directory. Copy the `.env.template` file to get started.
|
370
|
+
|
371
|
+
**WARNINGS:**
|
372
|
+
|
373
|
+
- **BE SURE TO USE A TEST ENVIRONMENT ON YOUR LEDGER.**
|
374
|
+
- **NEVER CHECK IN YOUR SECRETS (e.g. the `.env` file).**
|
375
|
+
- Because these tests actually create and modify resources, they attempt to do "cleanup" by deleting any newly created resources. This process could fail, and you may need to delete these resources manually.
|
376
|
+
|
377
|
+
### Console
|
378
|
+
|
379
|
+
Run `bundle console` to start and interactive console with the library already loaded. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
380
|
+
|
381
|
+
## Deployment
|
382
|
+
|
383
|
+
To deploy a new version of the gem to RubyGems, you can use the `release.sh` script in the root. The script takes advantage of [the bump gem](https://github.com/gregorym/bump). So you may call the script using any of the following:
|
384
|
+
|
385
|
+
```bash
|
386
|
+
# Version Format: MAJOR.MINOR.PATCH
|
387
|
+
./release.sh patch # to bump X in 1.1.X
|
388
|
+
./release.sh minor # to bump X in 1.X.1
|
389
|
+
./release.sh major # to bump X in X.1.1
|
390
|
+
```
|
247
391
|
|
248
392
|
### Contributing
|
249
393
|
|
@@ -256,3 +400,11 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
256
400
|
### Code of Conduct
|
257
401
|
|
258
402
|
Everyone interacting in the LedgerSync project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/LedgerSync/ledger_sync/blob/master/CODE_OF_CONDUCT.md).
|
403
|
+
|
404
|
+
# Maintainers
|
405
|
+
|
406
|
+
A big thank you to our maintainers:
|
407
|
+
|
408
|
+
- [@ryanwjackson](https://github.com/ryanwjackson)
|
409
|
+
- [@jozefvaclavik](https://github.com/jozefvaclavik)
|
410
|
+
- And the whole [Modern Treasury](https://www.moderntreasury.com) team
|