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
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
support :adaptor_helpers,
|
4
|
+
:stripe_shared_examples
|
5
|
+
|
6
|
+
module StripeHelpers
|
7
|
+
include AdaptorHelpers
|
8
|
+
|
9
|
+
def adaptor_class
|
10
|
+
LedgerSync::Adaptors::Stripe::Adaptor
|
11
|
+
end
|
12
|
+
|
13
|
+
def stripe_adaptor
|
14
|
+
@stripe_adaptor ||= LedgerSync.adaptors.stripe.new(
|
15
|
+
api_key: ENV.fetch('STRIPE_API_KEY')
|
16
|
+
)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
RSpec.configure do |config|
|
21
|
+
config.include StripeHelpers, adaptor: :stripe
|
22
|
+
end
|
data/qa/test.rb
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module QA
|
4
|
+
class Test
|
5
|
+
attr_reader :config,
|
6
|
+
:test_run_id
|
7
|
+
|
8
|
+
def initialize(config:)
|
9
|
+
@config = config
|
10
|
+
@test_run_id = (0...8).map { rand(65..90).chr }.join
|
11
|
+
puts "Initialized Test: #{test_run_id}"
|
12
|
+
end
|
13
|
+
|
14
|
+
def cleanup
|
15
|
+
end
|
16
|
+
|
17
|
+
def existing_netsuite_subsidiary
|
18
|
+
LedgerSync::Subsidiary.new(
|
19
|
+
ledger_id: 2,
|
20
|
+
name: "QA Customer #{test_run_id}"
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
def perform(op)
|
25
|
+
if op.valid?
|
26
|
+
result = op.perform
|
27
|
+
if op.failure?
|
28
|
+
byebug
|
29
|
+
raise op.error
|
30
|
+
end
|
31
|
+
return result
|
32
|
+
end
|
33
|
+
|
34
|
+
pdb 'Invalid:'
|
35
|
+
pdb op.errors.messages
|
36
|
+
|
37
|
+
byebug
|
38
|
+
pdb 'Next'
|
39
|
+
end
|
40
|
+
|
41
|
+
def new_customer(**args)
|
42
|
+
LedgerSync::Customer.new(
|
43
|
+
{
|
44
|
+
email: "#{test_run_id}@example.com",
|
45
|
+
name: "Test Customer #{test_run_id}",
|
46
|
+
phone_number: '1234567890'
|
47
|
+
}.merge(args)
|
48
|
+
)
|
49
|
+
end
|
50
|
+
|
51
|
+
def new_vendor(**args)
|
52
|
+
LedgerSync::Vendor.new(
|
53
|
+
{
|
54
|
+
company_name: "#{test_run_id} Company",
|
55
|
+
email: "test-#{test_run_id}-vendor@example.com",
|
56
|
+
first_name: "TestFirst#{test_run_id}",
|
57
|
+
last_name: "TestLast#{test_run_id}",
|
58
|
+
display_name: "Test #{test_run_id} Display Name"
|
59
|
+
}.merge(args)
|
60
|
+
)
|
61
|
+
end
|
62
|
+
|
63
|
+
def run
|
64
|
+
raise NotImplementedError
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
data/release.sh
CHANGED
@@ -1,13 +1,25 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
|
3
3
|
if output=$(git status --porcelain) && [ -z "$output" ]; then
|
4
|
-
|
4
|
+
echo "Checking out master" && \
|
5
|
+
git checkout master && \
|
6
|
+
echo "Pulling latest from github" && \
|
7
|
+
git pull origin master
|
8
|
+
|
9
|
+
if output=$(git status --porcelain) && [ -z "$output" ]; then
|
10
|
+
echo "Bumping version" && \
|
11
|
+
bundle exec bump $1 && \
|
5
12
|
echo "Pushing to github" && \
|
6
13
|
git push && \
|
7
14
|
echo "Building gem" && \
|
8
15
|
bundle exec rake build && \
|
9
16
|
echo "Releasing gem" && \
|
10
17
|
bundle exec rake release
|
18
|
+
else
|
19
|
+
>&2 echo 'PLEASE COMMIT ALL CHANGES BEFORE RELEASING.'
|
20
|
+
exit 1
|
21
|
+
fi
|
22
|
+
|
11
23
|
else
|
12
24
|
>&2 echo 'PLEASE COMMIT ALL CHANGES BEFORE RELEASING.'
|
13
25
|
exit 1
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ledger_sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Jackson
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: factory_bot
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rake
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -178,6 +192,20 @@ dependencies:
|
|
178
192
|
- - ">="
|
179
193
|
- !ruby/object:Gem::Version
|
180
194
|
version: '0'
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: dotenv
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - ">="
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '0'
|
202
|
+
type: :runtime
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - ">="
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '0'
|
181
209
|
- !ruby/object:Gem::Dependency
|
182
210
|
name: dry-schema
|
183
211
|
requirement: !ruby/object:Gem::Requirement
|
@@ -262,6 +290,20 @@ dependencies:
|
|
262
290
|
- - ">="
|
263
291
|
- !ruby/object:Gem::Version
|
264
292
|
version: 1.2.1
|
293
|
+
- !ruby/object:Gem::Dependency
|
294
|
+
name: netsuite
|
295
|
+
requirement: !ruby/object:Gem::Requirement
|
296
|
+
requirements:
|
297
|
+
- - ">="
|
298
|
+
- !ruby/object:Gem::Version
|
299
|
+
version: '0'
|
300
|
+
type: :runtime
|
301
|
+
prerelease: false
|
302
|
+
version_requirements: !ruby/object:Gem::Requirement
|
303
|
+
requirements:
|
304
|
+
- - ">="
|
305
|
+
- !ruby/object:Gem::Version
|
306
|
+
version: '0'
|
265
307
|
- !ruby/object:Gem::Dependency
|
266
308
|
name: nokogiri
|
267
309
|
requirement: !ruby/object:Gem::Requirement
|
@@ -318,6 +360,20 @@ dependencies:
|
|
318
360
|
- - ">="
|
319
361
|
- !ruby/object:Gem::Version
|
320
362
|
version: 1.3.0
|
363
|
+
- !ruby/object:Gem::Dependency
|
364
|
+
name: stripe
|
365
|
+
requirement: !ruby/object:Gem::Requirement
|
366
|
+
requirements:
|
367
|
+
- - ">="
|
368
|
+
- !ruby/object:Gem::Version
|
369
|
+
version: '0'
|
370
|
+
type: :runtime
|
371
|
+
prerelease: false
|
372
|
+
version_requirements: !ruby/object:Gem::Requirement
|
373
|
+
requirements:
|
374
|
+
- - ">="
|
375
|
+
- !ruby/object:Gem::Version
|
376
|
+
version: '0'
|
321
377
|
description: LedgerSync is a simple library that allows you to sync common objects
|
322
378
|
to popular accounting software like QuickBooks Online, Xero, NetSuite, etc.
|
323
379
|
email:
|
@@ -327,6 +383,7 @@ extensions: []
|
|
327
383
|
extra_rdoc_files: []
|
328
384
|
files:
|
329
385
|
- ".coveralls.yml"
|
386
|
+
- ".env.template"
|
330
387
|
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
331
388
|
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
332
389
|
- ".gitignore"
|
@@ -340,7 +397,9 @@ files:
|
|
340
397
|
- LICENSE.txt
|
341
398
|
- README.md
|
342
399
|
- Rakefile
|
400
|
+
- _config.yml
|
343
401
|
- bin/console
|
402
|
+
- bin/qa
|
344
403
|
- bin/setup
|
345
404
|
- docker-compose.yml
|
346
405
|
- ledger_sync.gemspec
|
@@ -355,6 +414,59 @@ files:
|
|
355
414
|
- lib/ledger_sync/adaptors/ledger_serializer_type/mapping_type.rb
|
356
415
|
- lib/ledger_sync/adaptors/ledger_serializer_type/references_many_type.rb
|
357
416
|
- lib/ledger_sync/adaptors/ledger_serializer_type/value_type.rb
|
417
|
+
- lib/ledger_sync/adaptors/mixins/infer_adaptor_class_mixin.rb
|
418
|
+
- lib/ledger_sync/adaptors/mixins/infer_ledger_serializer_mixin.rb
|
419
|
+
- lib/ledger_sync/adaptors/mixins/infer_resource_class_mixin.rb
|
420
|
+
- lib/ledger_sync/adaptors/mixins/offset_and_limit_pagination_searcher_mixin.rb
|
421
|
+
- lib/ledger_sync/adaptors/netsuite/account/ledger_deserializer.rb
|
422
|
+
- lib/ledger_sync/adaptors/netsuite/account/ledger_serializer.rb
|
423
|
+
- lib/ledger_sync/adaptors/netsuite/account/operations/create.rb
|
424
|
+
- lib/ledger_sync/adaptors/netsuite/account/operations/find.rb
|
425
|
+
- lib/ledger_sync/adaptors/netsuite/account/searcher.rb
|
426
|
+
- lib/ledger_sync/adaptors/netsuite/adaptor.rb
|
427
|
+
- lib/ledger_sync/adaptors/netsuite/config.rb
|
428
|
+
- lib/ledger_sync/adaptors/netsuite/currency/deledger_serializer.rb
|
429
|
+
- lib/ledger_sync/adaptors/netsuite/currency/ledger_serializer.rb
|
430
|
+
- lib/ledger_sync/adaptors/netsuite/currency/operations/create.rb
|
431
|
+
- lib/ledger_sync/adaptors/netsuite/currency/operations/delete.rb
|
432
|
+
- lib/ledger_sync/adaptors/netsuite/currency/operations/find.rb
|
433
|
+
- lib/ledger_sync/adaptors/netsuite/currency/operations/update.rb
|
434
|
+
- lib/ledger_sync/adaptors/netsuite/customer/ledger_deserializer.rb
|
435
|
+
- lib/ledger_sync/adaptors/netsuite/customer/ledger_serializer.rb
|
436
|
+
- lib/ledger_sync/adaptors/netsuite/customer/operations/create.rb
|
437
|
+
- lib/ledger_sync/adaptors/netsuite/customer/operations/delete.rb
|
438
|
+
- lib/ledger_sync/adaptors/netsuite/customer/operations/find.rb
|
439
|
+
- lib/ledger_sync/adaptors/netsuite/customer/operations/update.rb
|
440
|
+
- lib/ledger_sync/adaptors/netsuite/ledger_serializer.rb
|
441
|
+
- lib/ledger_sync/adaptors/netsuite/ledger_serializer_type/reference_type.rb
|
442
|
+
- lib/ledger_sync/adaptors/netsuite/ledger_serializer_type/subsidiary_type.rb
|
443
|
+
- lib/ledger_sync/adaptors/netsuite/operation.rb
|
444
|
+
- lib/ledger_sync/adaptors/netsuite/operation/create.rb
|
445
|
+
- lib/ledger_sync/adaptors/netsuite/operation/delete.rb
|
446
|
+
- lib/ledger_sync/adaptors/netsuite/operation/find.rb
|
447
|
+
- lib/ledger_sync/adaptors/netsuite/operation/update.rb
|
448
|
+
- lib/ledger_sync/adaptors/netsuite/record/http_method.rb
|
449
|
+
- lib/ledger_sync/adaptors/netsuite/record/metadata.rb
|
450
|
+
- lib/ledger_sync/adaptors/netsuite/record/property.rb
|
451
|
+
- lib/ledger_sync/adaptors/netsuite/searcher.rb
|
452
|
+
- lib/ledger_sync/adaptors/netsuite/token.rb
|
453
|
+
- lib/ledger_sync/adaptors/netsuite/vendor/ledger_deserializer.rb
|
454
|
+
- lib/ledger_sync/adaptors/netsuite/vendor/ledger_serializer.rb
|
455
|
+
- lib/ledger_sync/adaptors/netsuite/vendor/operations/create.rb
|
456
|
+
- lib/ledger_sync/adaptors/netsuite/vendor/operations/delete.rb
|
457
|
+
- lib/ledger_sync/adaptors/netsuite/vendor/operations/find.rb
|
458
|
+
- lib/ledger_sync/adaptors/netsuite/vendor/operations/update.rb
|
459
|
+
- lib/ledger_sync/adaptors/netsuite_soap/adaptor.rb
|
460
|
+
- lib/ledger_sync/adaptors/netsuite_soap/config.rb
|
461
|
+
- lib/ledger_sync/adaptors/netsuite_soap/customer/ledger_serializer.rb
|
462
|
+
- lib/ledger_sync/adaptors/netsuite_soap/customer/operations/create.rb
|
463
|
+
- lib/ledger_sync/adaptors/netsuite_soap/customer/operations/find.rb
|
464
|
+
- lib/ledger_sync/adaptors/netsuite_soap/ledger_serializer.rb
|
465
|
+
- lib/ledger_sync/adaptors/netsuite_soap/operation.rb
|
466
|
+
- lib/ledger_sync/adaptors/netsuite_soap/operation/create.rb
|
467
|
+
- lib/ledger_sync/adaptors/netsuite_soap/operation/find.rb
|
468
|
+
- lib/ledger_sync/adaptors/netsuite_soap/subsidiary/operations/create.rb
|
469
|
+
- lib/ledger_sync/adaptors/netsuite_soap/subsidiary/operations/find.rb
|
358
470
|
- lib/ledger_sync/adaptors/operation.rb
|
359
471
|
- lib/ledger_sync/adaptors/quickbooks_online/account/ledger_serializer.rb
|
360
472
|
- lib/ledger_sync/adaptors/quickbooks_online/account/operations/create.rb
|
@@ -374,6 +486,12 @@ files:
|
|
374
486
|
- lib/ledger_sync/adaptors/quickbooks_online/customer/operations/find.rb
|
375
487
|
- lib/ledger_sync/adaptors/quickbooks_online/customer/operations/update.rb
|
376
488
|
- lib/ledger_sync/adaptors/quickbooks_online/customer/searcher.rb
|
489
|
+
- lib/ledger_sync/adaptors/quickbooks_online/dashboard_url_helper.rb
|
490
|
+
- lib/ledger_sync/adaptors/quickbooks_online/department/ledger_serializer.rb
|
491
|
+
- lib/ledger_sync/adaptors/quickbooks_online/department/operations/create.rb
|
492
|
+
- lib/ledger_sync/adaptors/quickbooks_online/department/operations/find.rb
|
493
|
+
- lib/ledger_sync/adaptors/quickbooks_online/department/operations/update.rb
|
494
|
+
- lib/ledger_sync/adaptors/quickbooks_online/department/searcher.rb
|
377
495
|
- lib/ledger_sync/adaptors/quickbooks_online/deposit/ledger_serializer.rb
|
378
496
|
- lib/ledger_sync/adaptors/quickbooks_online/deposit/operations/create.rb
|
379
497
|
- lib/ledger_sync/adaptors/quickbooks_online/deposit/operations/find.rb
|
@@ -386,12 +504,23 @@ files:
|
|
386
504
|
- lib/ledger_sync/adaptors/quickbooks_online/expense/operations/update.rb
|
387
505
|
- lib/ledger_sync/adaptors/quickbooks_online/expense/searcher.rb
|
388
506
|
- lib/ledger_sync/adaptors/quickbooks_online/expense_line_item/ledger_serializer.rb
|
507
|
+
- lib/ledger_sync/adaptors/quickbooks_online/invoice/ledger_serializer.rb
|
508
|
+
- lib/ledger_sync/adaptors/quickbooks_online/invoice/operations/create.rb
|
509
|
+
- lib/ledger_sync/adaptors/quickbooks_online/invoice/operations/find.rb
|
510
|
+
- lib/ledger_sync/adaptors/quickbooks_online/invoice/operations/update.rb
|
511
|
+
- lib/ledger_sync/adaptors/quickbooks_online/invoice_sales_line_item/ledger_serializer.rb
|
512
|
+
- lib/ledger_sync/adaptors/quickbooks_online/item/ledger_serializer.rb
|
389
513
|
- lib/ledger_sync/adaptors/quickbooks_online/journal_entry/ledger_serializer.rb
|
390
514
|
- lib/ledger_sync/adaptors/quickbooks_online/journal_entry/operations/create.rb
|
391
515
|
- lib/ledger_sync/adaptors/quickbooks_online/journal_entry/operations/find.rb
|
392
516
|
- lib/ledger_sync/adaptors/quickbooks_online/journal_entry/operations/update.rb
|
393
517
|
- lib/ledger_sync/adaptors/quickbooks_online/journal_entry/searcher.rb
|
394
518
|
- lib/ledger_sync/adaptors/quickbooks_online/journal_entry_line_item/ledger_serializer.rb
|
519
|
+
- lib/ledger_sync/adaptors/quickbooks_online/ledger_class/ledger_serializer.rb
|
520
|
+
- lib/ledger_sync/adaptors/quickbooks_online/ledger_class/operations/create.rb
|
521
|
+
- lib/ledger_sync/adaptors/quickbooks_online/ledger_class/operations/find.rb
|
522
|
+
- lib/ledger_sync/adaptors/quickbooks_online/ledger_class/operations/update.rb
|
523
|
+
- lib/ledger_sync/adaptors/quickbooks_online/ledger_class/searcher.rb
|
395
524
|
- lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer.rb
|
396
525
|
- lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer_type/account_sub_type.rb
|
397
526
|
- lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer_type/account_type.rb
|
@@ -401,6 +530,8 @@ files:
|
|
401
530
|
- lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer_type/entity_reference_type.rb
|
402
531
|
- lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer_type/journal_entry_line_item_type.rb
|
403
532
|
- lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer_type/payment_type.rb
|
533
|
+
- lib/ledger_sync/adaptors/quickbooks_online/ledger_serializer_type/transaction_reference_type.rb
|
534
|
+
- lib/ledger_sync/adaptors/quickbooks_online/oauth_client.rb
|
404
535
|
- lib/ledger_sync/adaptors/quickbooks_online/operation.rb
|
405
536
|
- lib/ledger_sync/adaptors/quickbooks_online/operation/create.rb
|
406
537
|
- lib/ledger_sync/adaptors/quickbooks_online/operation/find.rb
|
@@ -410,6 +541,8 @@ files:
|
|
410
541
|
- lib/ledger_sync/adaptors/quickbooks_online/payment/operations/create.rb
|
411
542
|
- lib/ledger_sync/adaptors/quickbooks_online/payment/operations/find.rb
|
412
543
|
- lib/ledger_sync/adaptors/quickbooks_online/payment/operations/update.rb
|
544
|
+
- lib/ledger_sync/adaptors/quickbooks_online/payment_line_item/ledger_serializer.rb
|
545
|
+
- lib/ledger_sync/adaptors/quickbooks_online/request.rb
|
413
546
|
- lib/ledger_sync/adaptors/quickbooks_online/searcher.rb
|
414
547
|
- lib/ledger_sync/adaptors/quickbooks_online/transfer/ledger_serializer.rb
|
415
548
|
- lib/ledger_sync/adaptors/quickbooks_online/transfer/operations/create.rb
|
@@ -424,7 +557,23 @@ files:
|
|
424
557
|
- lib/ledger_sync/adaptors/quickbooks_online/vendor/operations/find.rb
|
425
558
|
- lib/ledger_sync/adaptors/quickbooks_online/vendor/operations/update.rb
|
426
559
|
- lib/ledger_sync/adaptors/quickbooks_online/vendor/searcher.rb
|
560
|
+
- lib/ledger_sync/adaptors/quickbooks_online/webhook.rb
|
561
|
+
- lib/ledger_sync/adaptors/quickbooks_online/webhook_event.rb
|
562
|
+
- lib/ledger_sync/adaptors/quickbooks_online/webhook_notification.rb
|
563
|
+
- lib/ledger_sync/adaptors/request.rb
|
564
|
+
- lib/ledger_sync/adaptors/response.rb
|
427
565
|
- lib/ledger_sync/adaptors/searcher.rb
|
566
|
+
- lib/ledger_sync/adaptors/stripe/adaptor.rb
|
567
|
+
- lib/ledger_sync/adaptors/stripe/config.rb
|
568
|
+
- lib/ledger_sync/adaptors/stripe/customer/operations/create.rb
|
569
|
+
- lib/ledger_sync/adaptors/stripe/customer/operations/delete.rb
|
570
|
+
- lib/ledger_sync/adaptors/stripe/customer/operations/find.rb
|
571
|
+
- lib/ledger_sync/adaptors/stripe/customer/operations/update.rb
|
572
|
+
- lib/ledger_sync/adaptors/stripe/operation.rb
|
573
|
+
- lib/ledger_sync/adaptors/stripe/operation/create.rb
|
574
|
+
- lib/ledger_sync/adaptors/stripe/operation/delete.rb
|
575
|
+
- lib/ledger_sync/adaptors/stripe/operation/find.rb
|
576
|
+
- lib/ledger_sync/adaptors/stripe/operation/update.rb
|
428
577
|
- lib/ledger_sync/adaptors/test/account/operations/create.rb
|
429
578
|
- lib/ledger_sync/adaptors/test/account/operations/find.rb
|
430
579
|
- lib/ledger_sync/adaptors/test/account/operations/invalid.rb
|
@@ -476,14 +625,22 @@ files:
|
|
476
625
|
- lib/ledger_sync/resources/account.rb
|
477
626
|
- lib/ledger_sync/resources/bill.rb
|
478
627
|
- lib/ledger_sync/resources/bill_line_item.rb
|
628
|
+
- lib/ledger_sync/resources/currency.rb
|
479
629
|
- lib/ledger_sync/resources/customer.rb
|
630
|
+
- lib/ledger_sync/resources/department.rb
|
480
631
|
- lib/ledger_sync/resources/deposit.rb
|
481
632
|
- lib/ledger_sync/resources/deposit_line_item.rb
|
482
633
|
- lib/ledger_sync/resources/expense.rb
|
483
634
|
- lib/ledger_sync/resources/expense_line_item.rb
|
635
|
+
- lib/ledger_sync/resources/invoice.rb
|
636
|
+
- lib/ledger_sync/resources/invoice_sales_line_item.rb
|
637
|
+
- lib/ledger_sync/resources/item.rb
|
484
638
|
- lib/ledger_sync/resources/journal_entry.rb
|
485
639
|
- lib/ledger_sync/resources/journal_entry_line_item.rb
|
640
|
+
- lib/ledger_sync/resources/ledger_class.rb
|
486
641
|
- lib/ledger_sync/resources/payment.rb
|
642
|
+
- lib/ledger_sync/resources/payment_line_item.rb
|
643
|
+
- lib/ledger_sync/resources/subsidiary.rb
|
487
644
|
- lib/ledger_sync/resources/transfer.rb
|
488
645
|
- lib/ledger_sync/resources/vendor.rb
|
489
646
|
- lib/ledger_sync/result.rb
|
@@ -500,11 +657,40 @@ files:
|
|
500
657
|
- lib/ledger_sync/util/debug.rb
|
501
658
|
- lib/ledger_sync/util/hash_helpers.rb
|
502
659
|
- lib/ledger_sync/util/performer.rb
|
660
|
+
- lib/ledger_sync/util/resonad.rb
|
503
661
|
- lib/ledger_sync/util/resources_builder.rb
|
662
|
+
- lib/ledger_sync/util/signer.rb
|
504
663
|
- lib/ledger_sync/util/string_helpers.rb
|
505
664
|
- lib/ledger_sync/util/validator.rb
|
506
665
|
- lib/ledger_sync/version.rb
|
507
|
-
- qa.rb
|
666
|
+
- qa/env_spec.rb
|
667
|
+
- qa/netsuite/account_spec.rb
|
668
|
+
- qa/netsuite/currency_spec.rb
|
669
|
+
- qa/netsuite/customer.rb
|
670
|
+
- qa/netsuite/customer_spec.rb
|
671
|
+
- qa/netsuite/vendor.rb
|
672
|
+
- qa/netsuite/vendor_spec.rb
|
673
|
+
- qa/netsuite_soap/customer_spec.rb
|
674
|
+
- qa/netsuite_soap/subsidiary_spec.rb
|
675
|
+
- qa/netsuite_test.rb
|
676
|
+
- qa/qa_helper.rb
|
677
|
+
- qa/quickbooks_online/account_spec.rb
|
678
|
+
- qa/quickbooks_online/customer_spec.rb
|
679
|
+
- qa/quickbooks_online/expense_spec.rb
|
680
|
+
- qa/quickbooks_online/vendor_spec.rb
|
681
|
+
- qa/stripe/customers_spec.rb
|
682
|
+
- qa/support/adaptor_helpers.rb
|
683
|
+
- qa/support/adaptor_support_setup.rb
|
684
|
+
- qa/support/netsuite_helpers.rb
|
685
|
+
- qa/support/netsuite_shared_examples.rb
|
686
|
+
- qa/support/netsuite_soap_helpers.rb
|
687
|
+
- qa/support/netsuite_soap_shared_examples.rb
|
688
|
+
- qa/support/quickbooks_online_helpers.rb
|
689
|
+
- qa/support/quickbooks_online_shared_examples.rb
|
690
|
+
- qa/support/shared_examples.rb
|
691
|
+
- qa/support/stripe_helpers.rb
|
692
|
+
- qa/support/stripe_shared_examples.rb
|
693
|
+
- qa/test.rb
|
508
694
|
- release.sh
|
509
695
|
homepage: https://github.com/LedgerSync/ledger_sync
|
510
696
|
licenses:
|
@@ -526,7 +712,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
526
712
|
version: '0'
|
527
713
|
requirements: []
|
528
714
|
rubyforge_project:
|
529
|
-
rubygems_version: 2.7.6
|
715
|
+
rubygems_version: 2.7.6.2
|
530
716
|
signing_key:
|
531
717
|
specification_version: 4
|
532
718
|
summary: Sync common objects to accounting software.
|
data/qa.rb
DELETED
@@ -1,142 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require 'bundler/inline'
|
5
|
-
require 'yaml'
|
6
|
-
|
7
|
-
gemfile do
|
8
|
-
source 'https://rubygems.org'
|
9
|
-
gem 'byebug'
|
10
|
-
# gem 'ledger_sync'
|
11
|
-
gem 'ledger_sync', path: '/Users/ryanwjackson/dev/ledger_sync/ledger_sync'
|
12
|
-
gem 'activemodel'
|
13
|
-
end
|
14
|
-
|
15
|
-
config_path = "#{__dir__}/.qa_config.yml"
|
16
|
-
|
17
|
-
unless File.file?(config_path)
|
18
|
-
config_template = {
|
19
|
-
'quickbooks_online' => {
|
20
|
-
'access_token' => 'REQUIRED',
|
21
|
-
'client_id' => 'REQUIRED',
|
22
|
-
'client_secret' => 'REQUIRED',
|
23
|
-
'realm_id' => 'REQUIRED',
|
24
|
-
'refresh_token' => 'REQUIRED'
|
25
|
-
}
|
26
|
-
}
|
27
|
-
File.open(config_path, 'w') { |file| file.write(config_template.to_yaml) }
|
28
|
-
raise "Please fill out secret.yml located here:\n#{config_path}"
|
29
|
-
end
|
30
|
-
|
31
|
-
config = YAML.safe_load(File.read(config_path))
|
32
|
-
|
33
|
-
### START: Shortcuts
|
34
|
-
|
35
|
-
LS = LedgerSync
|
36
|
-
QBO = LS::Adaptors::QuickBooksOnline
|
37
|
-
|
38
|
-
### END: Shortcuts
|
39
|
-
|
40
|
-
### START: Helper Methods
|
41
|
-
|
42
|
-
def perform(op)
|
43
|
-
if op.valid?
|
44
|
-
result = op.perform
|
45
|
-
byebug if op.failure?
|
46
|
-
return result
|
47
|
-
end
|
48
|
-
|
49
|
-
raise op.validate
|
50
|
-
end
|
51
|
-
|
52
|
-
### END: Helper Methods
|
53
|
-
|
54
|
-
# TEST_RUN_ID = "#{Time.now}_#{(0...8).map { rand(65..90).chr }.join}"
|
55
|
-
TEST_RUN_ID = (0...8).map { rand(65..90).chr }.join
|
56
|
-
|
57
|
-
puts "Running Test: #{TEST_RUN_ID}"
|
58
|
-
|
59
|
-
adaptor = LedgerSync.adaptors.qbo.new(
|
60
|
-
access_token: config['quickbooks_online']['access_token'],
|
61
|
-
client_id: config['quickbooks_online']['client_id'],
|
62
|
-
client_secret: config['quickbooks_online']['client_secret'],
|
63
|
-
realm_id: config['quickbooks_online']['realm_id'],
|
64
|
-
refresh_token: config['quickbooks_online']['refresh_token'],
|
65
|
-
test: true
|
66
|
-
)
|
67
|
-
adaptor.refresh!
|
68
|
-
|
69
|
-
account = LS::Account.new(
|
70
|
-
name: "Test Account #{TEST_RUN_ID}",
|
71
|
-
classification: 'asset',
|
72
|
-
account_type: 'bank',
|
73
|
-
account_sub_type: 'cash_on_hand',
|
74
|
-
currency: 'usd',
|
75
|
-
description: "Test #{TEST_RUN_ID} Account description",
|
76
|
-
active: true
|
77
|
-
)
|
78
|
-
|
79
|
-
result = perform(QBO::Account::Operations::Create.new(
|
80
|
-
adaptor: adaptor,
|
81
|
-
resource: account
|
82
|
-
))
|
83
|
-
|
84
|
-
account = result.resource
|
85
|
-
|
86
|
-
vendor = LS::Vendor.new(
|
87
|
-
email: "test-#{TEST_RUN_ID}-vendor@example.com",
|
88
|
-
first_name: "TestFirst#{TEST_RUN_ID}",
|
89
|
-
last_name: "TestLast#{TEST_RUN_ID}",
|
90
|
-
display_name: "Test #{TEST_RUN_ID} Display Name"
|
91
|
-
)
|
92
|
-
|
93
|
-
result = perform(QBO::Vendor::Operations::Create.new(
|
94
|
-
adaptor: adaptor,
|
95
|
-
resource: vendor
|
96
|
-
))
|
97
|
-
|
98
|
-
vendor = result.resource
|
99
|
-
|
100
|
-
expense_line_item_1 = LS::ExpenseLineItem.new(
|
101
|
-
account: account,
|
102
|
-
amount: 12_345,
|
103
|
-
description: "Test #{TEST_RUN_ID} Line Item 1"
|
104
|
-
)
|
105
|
-
|
106
|
-
expense_line_item_2 = LS::ExpenseLineItem.new(
|
107
|
-
account: account,
|
108
|
-
amount: 23_456,
|
109
|
-
description: "Test #{TEST_RUN_ID} Line Item 2"
|
110
|
-
)
|
111
|
-
|
112
|
-
expense = LS::Expense.new(
|
113
|
-
currency: 'usd',
|
114
|
-
memo: 'Testing',
|
115
|
-
payment_type: 'cash',
|
116
|
-
transaction_date: Date.today,
|
117
|
-
exchange_rate: 1.0,
|
118
|
-
vendor: vendor,
|
119
|
-
account: account,
|
120
|
-
line_items: [
|
121
|
-
expense_line_item_1,
|
122
|
-
expense_line_item_2
|
123
|
-
]
|
124
|
-
)
|
125
|
-
operation = QBO::Expense::Operations::Create.new(
|
126
|
-
adaptor: adaptor,
|
127
|
-
resource: expense
|
128
|
-
)
|
129
|
-
|
130
|
-
result = perform(operation)
|
131
|
-
|
132
|
-
pdb result.success?
|
133
|
-
byebug
|
134
|
-
|
135
|
-
puts "Writing secrets to secrets.yml...\n\n"
|
136
|
-
|
137
|
-
config['quickbooks_online']['access_token'] = adaptor.access_token
|
138
|
-
config['quickbooks_online']['refresh_token'] = adaptor.refresh_token
|
139
|
-
|
140
|
-
File.open(config_path, 'w') { |file| file.write(config.to_yaml) }
|
141
|
-
|
142
|
-
puts "BYE!\n\n"
|