ledger_sync-quickbooks_online 0.2.5 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b5a2f6fae3ba434cb7b4bcb7cb825cd61f905af61b91bc5fd982f04d379df003
4
- data.tar.gz: 43970c4ede08f3d78cc042a07669bd144041907c0c9db3fc250e2642f5d7eec9
3
+ metadata.gz: 8b4c74f346bfa37b73076cd0063d9d54fc72079df70fd5ea513edd043f60ddba
4
+ data.tar.gz: 847975f5b2229b34712e03707baa874513e6aa168e47821aa352486f188c5b70
5
5
  SHA512:
6
- metadata.gz: 3b9086fefe691baf7dceeeb59fa1239c321b552ab7f0063ad2f1b0198317fddbab76992823ffa2e7a57ecbdec79ba3725a86385596c9dbbd1b4217e59da79c12
7
- data.tar.gz: '0970d549a7c7dd80d47643d9db36dea9c1a4aae7f72948e4da55fb4c65b6895b2e0e18cf19d8409ca90a7a05d1a8f9b8650710e92e040d1f2f002bc31ccb9891'
6
+ metadata.gz: 6d633f14fe6b9613ea3caa49ec6e5a6a5b6916c05d7dff7fd1a68aa53685f5016d2a0fa68e6d9ea113b7fed8c402dd41ee25c810f557d39c0ce142bdc08d85f8
7
+ data.tar.gz: e5f9d7899ff6ce87f53a0f3500392a235bd250a38676878ebb9a61d01474dffe9d6b6e60b2115d1cc2c6df72be45db00ff48ba1610f0ad1ffc763a6ac2eb4dee
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ledger_sync-quickbooks_online (0.2.5)
4
+ ledger_sync-quickbooks_online (0.4.0)
5
5
  dotenv
6
- ledger_sync (>= 2.0.1)
6
+ ledger_sync (>= 2.0.2)
7
7
  oauth2
8
8
 
9
9
  GEM
@@ -38,16 +38,16 @@ GEM
38
38
  diff-lcs (1.4.4)
39
39
  docile (1.4.0)
40
40
  dotenv (2.7.6)
41
- dry-configurable (0.12.1)
41
+ dry-configurable (0.13.0)
42
42
  concurrent-ruby (~> 1.0)
43
- dry-core (~> 0.5, >= 0.5.0)
44
- dry-container (0.7.2)
43
+ dry-core (~> 0.6)
44
+ dry-container (0.9.0)
45
45
  concurrent-ruby (~> 1.0)
46
- dry-configurable (~> 0.1, >= 0.1.3)
47
- dry-core (0.6.0)
46
+ dry-configurable (~> 0.13, >= 0.13.0)
47
+ dry-core (0.7.1)
48
48
  concurrent-ruby (~> 1.0)
49
49
  dry-equalizer (0.3.0)
50
- dry-inflector (0.2.0)
50
+ dry-inflector (0.2.1)
51
51
  dry-initializer (3.0.4)
52
52
  dry-logic (1.2.0)
53
53
  concurrent-ruby (~> 1.0)
@@ -75,12 +75,15 @@ GEM
75
75
  dry-schema (~> 1.5, >= 1.5.2)
76
76
  factory_bot (6.1.0)
77
77
  activesupport (>= 5.0.0)
78
- faraday (1.4.2)
78
+ faraday (1.8.0)
79
79
  faraday-em_http (~> 1.0)
80
80
  faraday-em_synchrony (~> 1.0)
81
81
  faraday-excon (~> 1.1)
82
+ faraday-httpclient (~> 1.0.1)
82
83
  faraday-net_http (~> 1.0)
83
84
  faraday-net_http_persistent (~> 1.1)
85
+ faraday-patron (~> 1.0)
86
+ faraday-rack (~> 1.0)
84
87
  multipart-post (>= 1.2, < 3)
85
88
  ruby2_keywords (>= 0.0.4)
86
89
  faraday-detailed_logger (2.3.0)
@@ -88,9 +91,12 @@ GEM
88
91
  faraday-em_http (1.0.0)
89
92
  faraday-em_synchrony (1.0.0)
90
93
  faraday-excon (1.1.0)
94
+ faraday-httpclient (1.0.1)
91
95
  faraday-net_http (1.0.1)
92
- faraday-net_http_persistent (1.1.0)
93
- faraday_middleware (1.0.0)
96
+ faraday-net_http_persistent (1.2.0)
97
+ faraday-patron (1.0.0)
98
+ faraday-rack (1.0.0)
99
+ faraday_middleware (1.1.0)
94
100
  faraday (~> 1.0)
95
101
  fingerprintable (1.2.1)
96
102
  colorize
@@ -100,7 +106,7 @@ GEM
100
106
  iniparse (1.5.0)
101
107
  json (2.5.1)
102
108
  jwt (2.2.3)
103
- ledger_sync (2.0.1)
109
+ ledger_sync (2.2.0)
104
110
  activemodel
105
111
  colorize
106
112
  dry-schema (~> 1.5.4)
@@ -115,11 +121,13 @@ GEM
115
121
  rack (~> 2.2.3)
116
122
  resonad
117
123
  simply_serializable (>= 1.5.1)
124
+ mini_portile2 (2.6.1)
118
125
  minitest (5.14.4)
119
126
  multi_json (1.15.0)
120
127
  multi_xml (0.6.0)
121
128
  multipart-post (2.1.1)
122
- nokogiri (1.11.7-x86_64-darwin)
129
+ nokogiri (1.12.5)
130
+ mini_portile2 (~> 2.6.1)
123
131
  racc (~> 1.4)
124
132
  oauth2 (1.4.7)
125
133
  faraday (>= 0.8, < 2.0)
@@ -169,12 +177,13 @@ GEM
169
177
  rubocop-ast (1.6.0)
170
178
  parser (>= 3.0.1.1)
171
179
  ruby-progressbar (1.11.0)
172
- ruby2_keywords (0.0.4)
180
+ ruby2_keywords (0.0.5)
173
181
  simplecov (0.16.1)
174
182
  docile (~> 1.1)
175
183
  json (>= 1.8, < 3)
176
184
  simplecov-html (~> 0.10.0)
177
185
  simplecov-html (0.10.2)
186
+ simplecov-lcov (0.8.0)
178
187
  simply_serializable (1.5.1)
179
188
  fingerprintable (>= 1.2.1)
180
189
  sync (0.5.0)
@@ -209,6 +218,7 @@ DEPENDENCIES
209
218
  rake (~> 13.0)
210
219
  rspec (~> 3.2)
211
220
  rubocop
221
+ simplecov-lcov
212
222
  vcr
213
223
  webmock
214
224
 
data/README.md CHANGED
@@ -1,19 +1,217 @@
1
- # LedgerSync::QuickBooksOnline
1
+ <a name="ledger-sync--quick-books-online" />
2
+
3
+ # LedgerSync for QuickBooksOnline
2
4
 
3
5
  [![Build Status](https://travis-ci.org/LedgerSync/ledger_sync-quickbooks_online.svg?branch=master)](https://travis-ci.org/LedgerSync/ledger_sync-quickbooks_online)
4
6
  [![Gem Version](https://badge.fury.io/rb/ledger_sync-quickbooks_online.svg)](https://badge.fury.io/rb/ledger_sync-quickbooks_online)
5
7
  [![Coverage Status](https://coveralls.io/repos/github/LedgerSync/ledger_sync-quickbooks_online/badge.svg?branch=master)](https://coveralls.io/github/LedgerSync/ledger_sync-quickbooks_online?branch=master)
6
8
 
7
- [ledgersync.dev](www.ledgersync.dev)
8
9
 
9
- ## Usage
10
+ <a name="ledger-sync--quick-books-online--join-the-conversation" />
11
+
12
+ ## Join the Conversation
13
+
14
+ [Click here](https://join.slack.com/t/ledger-sync/shared_invite/zt-e5nbl8qc-eOA~5k7bg3p16_l3J7OS~Q) to join our public Slack group.
15
+
16
+
17
+ <a name="architecture" />
18
+
19
+ ## Architecture
20
+
21
+ This gem is built on top of the core [LedgerSync](https://github.com/LedgerSync/ledger_sync) gem. If you are unfamiliar with the LedgerSync architecture, it is recommended to first read through the [LedgerSync documentation](https://github.com/LedgerSync/ledger_sync).
22
+
23
+ <a name="getting-started" />
24
+
25
+ ## Installation
26
+
27
+ <a name="getting-started--installation--gemfile" />
28
+
29
+ ### Gemfile
30
+
31
+ Add this line to your application’s Gemfile:
32
+
33
+ ```
34
+ gem 'ledger_sync-quickbooks_online'
35
+ ```
36
+
37
+ And then execute:
38
+ ```
39
+ bundle
40
+ ```
41
+
42
+ <a name="getting-started--installation--directly" />
43
+
44
+ ### Directly
45
+
46
+ Or install it yourself as:
47
+
48
+ ```
49
+ gem install ledger_sync-quickbooks_online
50
+ ```
51
+
52
+ <a name="getting-started--oauth" />
53
+
54
+ ## OAuth
55
+
56
+ QuickBooks Online utilizes OAuth 2.0, which requires frequent refreshing of the access and refresh token. The client will handle this automatically, attempting a single token refresh on any single request authentication failure due to an expired access token.
57
+
58
+ The `LedgerSync::QuickBooksOnline::Client` implements a `ledger_attributes_to_save` class method, which is an array of attributes that may change as the client is used (e.g. `access_token`). You can also call the instance method `ledger_attributes_to_save` which will be a hash of these current values. It is a best practice to always store these attributes
59
+ if you are saving access tokens in your database.
60
+
61
+ Should you fail to save the current `refresh_token`, you will have to ask your user to reconnect to QuickBooks Online again.
62
+
63
+ <a name="getting-started--oauth--retrieveAccessToken" />
64
+
65
+ ### Retrieve Access Token
66
+
67
+ The library contains a lightweight script that is helpful in retrieving and refreshing access tokens. It is particularly useful during development, when you do not have an application to handle the redirects and OAuth code exchange. To use, do the following:
68
+
69
+ 1. Create a `.env.local` file in the library root.
70
+ 2. Add values for `QUICKBOOKS_ONLINE_CLIENT_ID` and `QUICKBOOKS_ONLINE_CLIENT_SECRET` (you can copy `.env.test` as a template).
71
+ 3. Ensure your developer application in [the QuickBooks Online developer portal](https://developer.intuit.com) contains this redirect URI: `http://localhost:5678` (note: no trailing slash and port configurable with `PORT` environment variable)
72
+ 4. Run `ruby bin/quickbooks_online_oauth_server.rb` from the library root (note: it must run from the root in order to update `.env.local`).
73
+ 5. Visit the URL output in the terminal.
74
+ 6. Upon redirect back to `http://localhost:5678`, the new values will be printed to the console and saved back to your `.env.local`
75
+
76
+ <a name="getting-started--oauth--ledger-helper-methods" />
77
+
78
+ ### Ledger Helper Methods
79
+
80
+ The client also implements some helper methods for getting tokens. For example, you can set up a client using the following:
81
+
82
+ ```ruby
83
+ # Retrieve the following values from Intuit app settings
84
+ client_id = ENV['QUICKBOOKS_ONLINE_CLIENT_ID']
85
+ client_secret = ENV['QUICKBOOKS_ONLINE_CLIENT_SECRET']
86
+ redirect_uri = 'http://localhost:3000'
87
+
88
+ oauth_client = LedgerSync::QuickBooksOnline::OAuthClientHelper.new(
89
+ client_id: client_id,
90
+ client_secret: client_secret
91
+ )
92
+
93
+ puts oauth_client.authorization_url(redirect_uri: redirect_uri)
94
+
95
+ # Visit on the output URL and authorize a company.
96
+ # You will be redirected back to the redirect_uri.
97
+ # Copy the full url from your browser:
98
+
99
+ uri = 'https://localhost:3000/?code=FOO&state=BAR&realm_id=BAZ'
100
+
101
+ client = LedgerSync::QuickBooksOnline::Client.new_from_oauth_client_uri(
102
+ oauth_client: oauth_client,
103
+ uri: uri
104
+ )
105
+
106
+ # You can test that the auth works:
107
+
108
+ client.refresh!
109
+ ```
110
+
111
+ **Note: If you have a `.env.local` file storing your secrets, the client will automatically update the variables and record previous values whenever values change*
112
+
113
+ <a name="client" />
114
+
115
+ # Client
116
+
117
+ You can instantiate a client like so:
118
+
119
+ ```ruby
120
+ client = LedgerSync::Ledgers::QuickBooksOnline::Client.new(
121
+ access_token: access_token, # assuming this is defined
122
+ client_id: ENV['QUICKBOOKS_ONLINE_CLIENT_ID'],
123
+ client_secret: ENV['QUICKBOOKS_ONLINE_CLIENT_SECRET'],
124
+ realm_id: ENV['QUICKBOOKS_ONLINE_REALM_ID'],
125
+ refresh_token: refresh_token, # assuming this is defined
126
+ update_dotenv: true # Optional: defaults to true
127
+ )
128
+ ```
129
+
130
+ ## `update_dotenv`
131
+
132
+ When `update_dotenv` is `true`, the library will automatically update your `.env.local` (or otherwise configured `.env` file).
133
+
134
+ When `update_dotenv` is `false`, you will need to manually save the refreshed attributes after each operation call. The `result` is the output of calling `operation.perform` and gives you access to the updated `client`. You can access the new values by doing the following:
135
+
136
+ ```ruby
137
+ result.operation.client.ledger_attributes_to_save.each do |key, value|
138
+ # save values
139
+ end
140
+ ```
141
+
142
+ <a name="resources" />
143
+
144
+ # Resources
145
+
146
+ To see all the available resources, you can call `LedgerSync::QuickBooksOnline::Client.resources`, which will give you a hash of keys and resource classes.
147
+
148
+ ## Resource Attributes
149
+
150
+
151
+ To see all the available attributes of a resource you can call the `resource_attributes` class method. For example, you can call `LedgerSync::QuickBooksOnline::Customer.resource_attributes`, which will return a `LedgerSync::ResourceAttributeSet`. This object allows you to see the attributes and the type of each attribute. For example, you can see the attribute `DisplayName` and its type by typing the following:
152
+
153
+ ```bash
154
+ > LedgerSync::QuickBooksOnline::Customer.resource_attributes.attributes[:DisplayName]
155
+ => #<LedgerSync::ResourceAttribute:0x00007fef3dafe568 @name=:DisplayName, @resource_class=LedgerSync::QuickBooksOnline::Customer, @type=#<LedgerSync::Type::String:0x00007fef3dafe540 @true="t", @false="f", @precision=nil, @scale=nil, @limit=nil>, @value=nil>
156
+ ```
157
+ ## Resource Operations
158
+
159
+
160
+ To see all the available operations for a given resource you can call the `operations` class method. For example, you can call `LedgerSync::QuickBooksOnline::Customer.operations`, which will return a hash of keys mapped to operation classes. For example, you can try the following:
161
+
162
+ ```bash
163
+ > LedgerSync::QuickBooksOnline::Customer.operations
164
+ => {:find=>LedgerSync::QuickBooksOnline::Customer::Operations::Find, :create=>LedgerSync::QuickBooksOnline::Customer::Operations::Create, :update=>LedgerSync::QuickBooksOnline::Customer::Operations::Update}
165
+ ```
166
+
167
+ <a name="examples" />
168
+
169
+ # Examples
170
+
171
+ ## Create a Customer
172
+
173
+ ```ruby
174
+ client = LedgerSync::Ledgers::QuickBooksOnline::Client.new(
175
+ access_token: access_token, # assuming this is defined
176
+ client_id: ENV['QUICKBOOKS_ONLINE_CLIENT_ID'],
177
+ client_secret: ENV['QUICKBOOKS_ONLINE_CLIENT_SECRET'],
178
+ realm_id: ENV['QUICKBOOKS_ONLINE_REALM_ID'],
179
+ refresh_token: refresh_token # assuming this is defined
180
+ )
181
+
182
+ resource = LedgerSync::Ledgers::QuickBooksOnline::Customer.new(
183
+ DisplayName: 'Sample Customer',
184
+ external_id: customer_external_id # A unique ID from your platform
185
+ )
186
+
187
+ operation = LedgerSync::Ledgers::QuickBooksOnline::Customer::Operations::Create.new(
188
+ client: client,
189
+ resource: resource
190
+ )
191
+
192
+ result = operation.perform # Returns a LedgerSync::OperationResult
193
+
194
+ if result.success?
195
+ resource = result.operation.resource
196
+ # Do something with resource
197
+ else # result.failure?
198
+ raise result.error
199
+ end
200
+
201
+ ```
202
+
203
+ <a name="errors" />
204
+
205
+ # Errors
206
+
207
+ While LedgerSync tries to catch and translate errors, not all errors will be caught (e.g. new errors from the QuickBooks Online API). In these cases, you can rescue a generic `LedgerSync::OperationError` and determine what to do based on the response body.
208
+
209
+ [QuickBooks Online Error Documentation](https://developer.intuit.com/app/developer/qbo/docs/develop/troubleshooting/error-codes)
210
+
211
+
212
+
213
+ <a name="ledger-sync--quick-books-online--license" />
10
214
 
11
- This template ledger enables you to easily create your own ledger for public or private use. Although this is not an
12
- exhaustive list, a good place to start assuming your ledger name is `NewLedger`:
215
+ ## License
13
216
 
14
- 1. Find and replace all `QUICK_BOOKS_ONLINE` with `NEW_LEDGER`
15
- 2. Find and replace all `QuickBooksOnline` with `NewLedger`
16
- 3. Find and replace all `quickbooks_online` with `new_ledger`
17
- 4. Find and replace all `QuickBooks Online` with `New Ledger`
18
- 5. Find and replace all `quickbooks_online` directories and files with `new_ledger`
19
- 6. Remove `SampleResource` example files.
217
+ This gem and all code contained in the repository is licensed under the same license as the core [LedgerSync](https://github.com/LedgerSync/ledger_sync) license. You can view all license details in the [LedgerSync](https://github.com/LedgerSync/ledger_sync) repo.
@@ -37,10 +37,11 @@ Gem::Specification.new do |spec|
37
37
  spec.add_development_dependency('rake', '~> 13.0')
38
38
  spec.add_development_dependency('rspec', '~> 3.2')
39
39
  spec.add_development_dependency('rubocop', '>= 0')
40
+ spec.add_development_dependency('simplecov-lcov')
40
41
  spec.add_development_dependency('vcr', '>= 0')
41
42
  spec.add_development_dependency('webmock', '>= 0')
42
43
  spec.add_runtime_dependency('dotenv')
43
- spec.add_runtime_dependency('ledger_sync', '>= 2.0.1')
44
+ spec.add_runtime_dependency('ledger_sync', '>= 2.0.2')
44
45
  # spec.add_runtime_dependency('nokogiri', '>= 0')
45
46
  spec.add_runtime_dependency('oauth2', '>= 0')
46
47
  end
@@ -10,13 +10,12 @@ module LedgerSync
10
10
 
11
11
  attribute :Name
12
12
  attribute :AcctNum
13
+ attribute :AccountSubType
13
14
  attribute :Description
14
15
  attribute :Active
15
16
 
16
17
  mapping :AccountType,
17
18
  hash: Account::TYPES.invert
18
- mapping :AccountSubType,
19
- hash: Account::SUB_TYPES.invert
20
19
  mapping :Classification,
21
20
  hash: Account::CLASSIFICATIONS.invert
22
21
 
@@ -10,13 +10,12 @@ module LedgerSync
10
10
 
11
11
  attribute :Name
12
12
  attribute :AcctNum
13
+ attribute :AccountSubType
13
14
  attribute :Description
14
15
  attribute :Active
15
16
 
16
17
  mapping :AccountType,
17
18
  hash: Account::TYPES
18
- mapping :AccountSubType,
19
- hash: Account::SUB_TYPES
20
19
  mapping :Classification,
21
20
  hash: Account::CLASSIFICATIONS
22
21
 
@@ -34,6 +34,8 @@ module LedgerSync
34
34
  client_secret:,
35
35
  realm_id:,
36
36
  refresh_token:,
37
+ expires_at: nil,
38
+ refresh_token_expires_at: nil,
37
39
  test: false,
38
40
  update_dotenv: true
39
41
  )
@@ -42,6 +44,8 @@ module LedgerSync
42
44
  @client_secret = client_secret
43
45
  @realm_id = realm_id
44
46
  @refresh_token = refresh_token
47
+ @expires_at = expires_at
48
+ @refresh_token_expires_at = refresh_token_expires_at
45
49
  @test = test
46
50
  @update_dotenv = update_dotenv
47
51
 
@@ -5,296 +5,6 @@ require_relative 'currency'
5
5
  module LedgerSync
6
6
  module QuickBooksOnline
7
7
  class Account < QuickBooksOnline::Resource
8
- SUB_TYPES = {
9
- # Bank
10
- 'cash_and_cash_equivalents' => 'CashAndCashEquivalents',
11
- 'cash_on_hand' => 'CashOnHand',
12
- 'checking' => 'Checking',
13
- 'money_market' => 'MoneyMarket',
14
- 'other_ear_marked_bank_accounts' => 'OtherEarMarkedBankAccounts',
15
- 'rents_held_in_trust' => 'RentsHeldInTrust',
16
- 'savings' => 'Savings',
17
- 'trust_accounts' => 'TrustAccounts',
18
- # Other Current Asset
19
- 'allowance_for_bad_debts' => 'AllowanceForBadDebts',
20
- 'assets_available_for_sale' => 'AssetsAvailableForSale',
21
- 'bal_with_govt_authorities' => 'BalWithGovtAuthorities',
22
- 'called_up_share_capital_not_paid' => 'CalledUpShareCapitalNotPaid',
23
- 'development_costs' => 'DevelopmentCosts',
24
- 'employee_cash_advances' => 'EmployeeCashAdvances',
25
- 'expenditure_authorisations_and_letters_of_credit' => 'ExpenditureAuthorisationsAndLettersOfCredit',
26
- 'global_tax_deferred' => 'GlobalTaxDeferred',
27
- 'global_tax_refund' => 'GlobalTaxRefund',
28
- 'internal_transfers' => 'InternalTransfers',
29
- 'inventory' => 'Inventory',
30
- 'investment_mortgage_real_estate_loans' => 'Investment_MortgageRealEstateLoans',
31
- 'investment_other' => 'Investment_Other',
32
- 'investment_tax_exempt_securities' => 'Investment_TaxExemptSecurities',
33
- 'investment_us_government_obligations' => 'Investment_USGovernmentObligations',
34
- 'loans_to_officers' => 'LoansToOfficers',
35
- 'loans_to_others' => 'LoansToOthers',
36
- 'loans_to_stockholders' => 'LoansToStockholders',
37
- 'other_consumables' => 'OtherConsumables',
38
- 'other_current_assets' => 'OtherCurrentAssets',
39
- 'prepaid_expenses' => 'PrepaidExpenses',
40
- 'provisions_current_assets' => 'ProvisionsCurrentAssets',
41
- 'retainage' => 'Retainage',
42
- 'short_term_investments_in_related_parties' => 'ShortTermInvestmentsInRelatedParties',
43
- 'short_term_loans_and_advances_to_related_parties' => 'ShortTermLoansAndAdvancesToRelatedParties',
44
- 'trade_and_other_receivables' => 'TradeAndOtherReceivables',
45
- 'undeposited_funds' => 'UndepositedFunds',
46
- # Fixed Asset
47
- 'accumulated_amortization' => 'AccumulatedAmortization',
48
- 'accumulated_depletion' => 'AccumulatedDepletion',
49
- 'accumulated_depreciation' => 'AccumulatedDepreciation',
50
- 'assets_in_course_of_construction' => 'AssetsInCourseOfConstruction',
51
- 'buildings' => 'Buildings',
52
- 'capital_wip' => 'CapitalWip',
53
- 'cumulative_depreciation_on_intangible_assets' => 'CumulativeDepreciationOnIntangibleAssets',
54
- 'depletable_assets' => 'DepletableAssets',
55
- 'fixed_asset_computers' => 'FixedAssetComputers',
56
- 'fixed_asset_copiers' => 'FixedAssetCopiers',
57
- 'fixed_asset_furniture' => 'FixedAssetFurniture',
58
- 'fixed_asset_other_tools_equipment' => 'FixedAssetOtherToolsEquipment',
59
- 'fixed_asset_phone' => 'FixedAssetPhone',
60
- 'fixed_asset_photo_video' => 'FixedAssetPhotoVideo',
61
- 'fixed_asset_software' => 'FixedAssetSoftware',
62
- 'furniture_and_fixtures' => 'FurnitureAndFixtures',
63
- 'intangible_assets_under_development' => 'IntangibleAssetsUnderDevelopment',
64
- 'intangible_assets' => 'IntangibleAssets',
65
- 'land_asset' => 'LandAsset',
66
- 'land' => 'Land',
67
- 'leasehold_improvements' => 'LeaseholdImprovements',
68
- 'machinery_and_equipment' => 'MachineryAndEquipment',
69
- 'non_current_assets' => 'NonCurrentAssets',
70
- 'other_fixed_assets' => 'OtherFixedAssets',
71
- 'participating_interests' => 'ParticipatingInterests',
72
- 'provisions_fixed_assets' => 'ProvisionsFixedAssets',
73
- 'vehicles' => 'Vehicles',
74
- # Other Asset
75
- 'accumulated_amortization_of_other_assets' => 'AccumulatedAmortizationOfOtherAssets',
76
- 'assets_held_for_sale' => 'AssetsHeldForSale',
77
- 'available_for_sale_financial_assets' => 'AvailableForSaleFinancialAssets',
78
- 'deferred_tax' => 'DeferredTax',
79
- 'goodwill' => 'Goodwill',
80
- 'investments' => 'Investments',
81
- 'lease_buyout' => 'LeaseBuyout',
82
- 'licenses' => 'Licenses',
83
- 'long_term_investments' => 'LongTermInvestments',
84
- 'long_term_loans_and_advances_to_related_parties' => 'LongTermLoansAndAdvancesToRelatedParties',
85
- 'organizational_costs' => 'OrganizationalCosts',
86
- 'other_intangible_assets' => 'OtherIntangibleAssets',
87
- 'other_long_term_assets' => 'OtherLongTermAssets',
88
- 'other_long_term_investments' => 'OtherLongTermInvestments',
89
- 'other_long_term_loans_and_advances' => 'OtherLongTermLoansAndAdvances',
90
- 'prepayments_and_accrued_income' => 'PrepaymentsAndAccruedIncome',
91
- 'provisions_non_current_assets' => 'ProvisionsNonCurrentAssets',
92
- 'accounts_receivable' => 'AccountsReceivable',
93
- 'security_deposits' => 'SecurityDeposits',
94
- # Equity
95
- 'accumulated_adjustment' => 'AccumulatedAdjustment',
96
- 'accumulated_other_comprehensive_income' => 'AccumulatedOtherComprehensiveIncome',
97
- 'called_up_share_capital' => 'CalledUpShareCapital',
98
- 'capital_reserves' => 'CapitalReserves',
99
- 'common_stock' => 'CommonStock',
100
- 'dividend_disbursed' => 'DividendDisbursed',
101
- 'equity_in_earnings_of_subsiduaries' => 'EquityInEarningsOfSubsiduaries',
102
- 'estimated_taxes' => 'EstimatedTaxes',
103
- 'funds' => 'Funds',
104
- 'healthcare' => 'Healthcare',
105
- 'investment_grants' => 'InvestmentGrants',
106
- 'money_received_against_share_warrants' => 'MoneyReceivedAgainstShareWarrants',
107
- 'opening_balance_equity' => 'OpeningBalanceEquity',
108
- 'other_free_reserves' => 'OtherFreeReserves',
109
- 'owners_equity' => 'OwnersEquity',
110
- 'paid_in_capital_or_surplus' => 'PaidInCapitalOrSurplus',
111
- 'partner_contributions' => 'PartnerContributions',
112
- 'partner_distributions' => 'PartnerDistributions',
113
- 'partners_equity' => 'PartnersEquity',
114
- 'personal_expense' => 'PersonalExpense',
115
- 'personal_income' => 'PersonalIncome',
116
- 'preferred_stock' => 'PreferredStock',
117
- 'retained_earnings' => 'RetainedEarnings',
118
- 'share_application_money_pending_allotment' => 'ShareApplicationMoneyPendingAllotment',
119
- 'share_capital' => 'ShareCapital',
120
- 'treasury_stock' => 'TreasuryStock',
121
- # Expense
122
- 'advertising_promotional' => 'AdvertisingPromotional',
123
- 'amortization_expense' => 'AmortizationExpense',
124
- 'appropriations_to_depreciation' => 'AppropriationsToDepreciation',
125
- 'auto' => 'Auto',
126
- 'bad_debts' => 'BadDebts',
127
- 'bank_charges' => 'BankCharges',
128
- 'borrowing_cost' => 'BorrowingCost',
129
- 'charitable_contributions' => 'CharitableContributions',
130
- 'commissions_and_fees' => 'CommissionsAndFees',
131
- 'cost_of_labor' => 'CostOfLabor',
132
- 'distribution_costs' => 'DistributionCosts',
133
- 'dues_subscriptions' => 'DuesSubscriptions',
134
- 'entertainment_meals' => 'EntertainmentMeals',
135
- 'entertainment' => 'Entertainment',
136
- 'equipment_rental' => 'EquipmentRental',
137
- 'external_services' => 'ExternalServices',
138
- 'extraordinary_charges' => 'ExtraordinaryCharges',
139
- 'finance_costs' => 'FinanceCosts',
140
- 'global_tax_expense' => 'GlobalTaxExpense',
141
- 'income_tax_expense' => 'IncomeTaxExpense',
142
- 'insurance' => 'Insurance',
143
- 'interest_paid' => 'InterestPaid',
144
- 'legal_professional_fees' => 'LegalProfessionalFees',
145
- 'loss_on_discontinued_operations_net_of_tax' => 'LossOnDiscontinuedOperationsNetOfTax',
146
- 'management_compensation' => 'ManagementCompensation',
147
- 'office_expenses' => 'OfficeExpenses',
148
- 'office_general_administrative_expenses' => 'OfficeGeneralAdministrativeExpenses',
149
- 'other_business_expenses' => 'OtherBusinessExpenses',
150
- 'other_current_operating_charges' => 'OtherCurrentOperatingCharges',
151
- 'other_external_services' => 'OtherExternalServices',
152
- 'other_miscellaneous_service_cost' => 'OtherMiscellaneousServiceCost',
153
- 'other_rental_costs' => 'OtherRentalCosts',
154
- 'other_selling_expenses' => 'OtherSellingExpenses',
155
- 'payroll_expenses' => 'PayrollExpenses',
156
- 'project_studies_surveys_assessments' => 'ProjectStudiesSurveysAssessments',
157
- 'promotional_meals' => 'PromotionalMeals',
158
- 'purchases_rebates' => 'PurchasesRebates',
159
- 'rent_or_lease_of_buildings' => 'RentOrLeaseOfBuildings',
160
- 'repair_maintenance' => 'RepairMaintenance',
161
- 'shipping_and_delivery_expense' => 'ShippingAndDeliveryExpense',
162
- 'shipping_freight_delivery' => 'ShippingFreightDelivery',
163
- 'staff_costs' => 'StaffCosts',
164
- 'sundry' => 'Sundry',
165
- 'supplies_materials' => 'SuppliesMaterials',
166
- 'taxes_paid' => 'TaxesPaid',
167
- 'travel_expenses_general_and_admin_expenses' => 'TravelExpensesGeneralAndAdminExpenses',
168
- 'travel_expenses_selling_expense' => 'TravelExpensesSellingExpense',
169
- 'travel_meals' => 'TravelMeals',
170
- 'travel' => 'Travel',
171
- 'unapplied_cash_bill_payment_expense' => 'UnappliedCashBillPaymentExpense',
172
- # Other Expense
173
- 'amortization' => 'Amortization',
174
- 'deferred_tax_expense' => 'DeferredTaxExpense',
175
- 'depletion' => 'Depletion',
176
- 'depreciation' => 'Depreciation',
177
- 'exceptional_items' => 'ExceptionalItems',
178
- 'exchange_gain_or_loss' => 'ExchangeGainOrLoss',
179
- 'extraordinary_items' => 'ExtraordinaryItems',
180
- 'gas_and_fuel' => 'GasAndFuel',
181
- 'home_office' => 'HomeOffice',
182
- 'home_owner_rental_insurance' => 'HomeOwnerRentalInsurance',
183
- 'income_tax_other_expense' => 'IncomeTaxOtherExpense',
184
- 'mat_credit' => 'MatCredit',
185
- 'mortgage_interest' => 'MortgageInterest',
186
- 'other_home_office_expenses' => 'OtherHomeOfficeExpenses',
187
- 'other_miscellaneous_expense' => 'OtherMiscellaneousExpense',
188
- 'other_vehicle_expenses' => 'OtherVehicleExpenses',
189
- 'parking_and_tolls' => 'ParkingAndTolls',
190
- 'penalties_settlements' => 'PenaltiesSettlements',
191
- 'prior_period_items' => 'PriorPeriodItems',
192
- 'rent_and_lease' => 'RentAndLease',
193
- 'repairs_and_maintenance' => 'RepairsAndMaintenance',
194
- 'tax_roundoff_gain_or_loss' => 'TaxRoundoffGainOrLoss',
195
- 'utilities' => 'Utilities',
196
- 'vehicle_insurance' => 'VehicleInsurance',
197
- 'vehicle_lease' => 'VehicleLease',
198
- 'vehicle_loan_interest' => 'VehicleLoanInterest',
199
- 'vehicle_loan' => 'VehicleLoan',
200
- 'vehicle_registration' => 'VehicleRegistration',
201
- 'vehicle_repairs' => 'VehicleRepairs',
202
- 'vehicle' => 'Vehicle',
203
- 'wash_and_road_services' => 'WashAndRoadServices',
204
- # Cost of Goods Sold
205
- 'cost_of_labor_cos' => 'CostOfLaborCos',
206
- 'cost_of_sales' => 'CostOfSales',
207
- 'equipment_rental_cos' => 'EquipmentRentalCos',
208
- 'freight_and_delivery_cost' => 'FreightAndDeliveryCost',
209
- 'other_costs_of_service_cos' => 'OtherCostsOfServiceCos',
210
- 'shipping_freight_delivery_cos' => 'ShippingFreightDeliveryCos',
211
- 'supplies_materials_cogs' => 'SuppliesMaterialsCogs',
212
- # Accounts Payable
213
- 'accounts_payable' => 'AccountsPayable',
214
- 'outstanding_dues_micro_small_enterprise' => 'OutstandingDuesMicroSmallEnterprise',
215
- 'outstanding_dues_other_than_micro_small_enterprise' => 'OutstandingDuesOtherThanMicroSmallEnterprise',
216
- # Credit Card
217
- 'credit_card' => 'CreditCard',
218
- # Long Term Liability
219
- 'accruals_and_deferred_income' => 'AccrualsAndDeferredIncome',
220
- 'accrued_long_lerm_liabilities' => 'AccruedLongLermLiabilities',
221
- 'accrued_vacation_payable' => 'AccruedVacationPayable',
222
- 'bank_loans' => 'BankLoans',
223
- 'debts_related_to_participating_interests' => 'DebtsRelatedToParticipatingInterests',
224
- 'deferred_tax_liabilities' => 'DeferredTaxLiabilities',
225
- 'government_and_other_public_authorities' => 'GovernmentAndOtherPublicAuthorities',
226
- 'group_and_associates' => 'GroupAndAssociates',
227
- 'liabilities_related_to_assets_held_for_sale' => 'LiabilitiesRelatedToAssetsHeldForSale',
228
- 'long_term_borrowings' => 'LongTermBorrowings',
229
- 'long_term_debit' => 'LongTermDebit',
230
- 'long_term_employee_benefit_obligations' => 'LongTermEmployeeBenefitObligations',
231
- 'notes_payable' => 'NotesPayable',
232
- 'obligations_under_finance_leases' => 'ObligationsUnderFinanceLeases',
233
- 'other_long_term_liabilities' => 'OtherLongTermLiabilities',
234
- 'other_long_term_provisions' => 'OtherLongTermProvisions',
235
- 'provision_for_liabilities' => 'ProvisionForLiabilities',
236
- 'provisions_non_current_liabilities' => 'ProvisionsNonCurrentLiabilities',
237
- 'shareholder_notes_payable' => 'ShareholderNotesPayable',
238
- 'staff_and_related_long_term_liability_accounts' => 'StaffAndRelatedLongTermLiabilityAccounts',
239
- # Other Current Liability
240
- 'accrued_liabilities' => 'AccruedLiabilities',
241
- 'current_liabilities' => 'CurrentLiabilities',
242
- 'current_portion_employee_benefits_obligations' => 'CurrentPortionEmployeeBenefitsObligations',
243
- 'current_portion_of_obligations_under_finance_leases' => 'CurrentPortionOfObligationsUnderFinanceLeases',
244
- 'current_tax_liability' => 'CurrentTaxLiability',
245
- 'direct_deposit_payable' => 'DirectDepositPayable',
246
- 'dividends_payable' => 'DividendsPayable',
247
- 'duties_and_taxes' => 'DutiesAndTaxes',
248
- 'federal_income_tax_payable' => 'FederalIncomeTaxPayable',
249
- 'global_tax_payable' => 'GlobalTaxPayable',
250
- 'global_tax_suspense' => 'GlobalTaxSuspense',
251
- 'insurance_payable' => 'InsurancePayable',
252
- 'interest_payables' => 'InterestPayables',
253
- 'line_of_credit' => 'LineOfCredit',
254
- 'loan_payable' => 'LoanPayable',
255
- 'other_current_liabilities' => 'OtherCurrentLiabilities',
256
- 'payroll_clearing' => 'PayrollClearing',
257
- 'payroll_tax_payable' => 'PayrollTaxPayable',
258
- 'prepaid_expenses_payable' => 'PrepaidExpensesPayable',
259
- 'provision_for_warranty_obligations' => 'ProvisionForWarrantyObligations',
260
- 'provisions_current_liabilities' => 'ProvisionsCurrentLiabilities',
261
- 'rents_in_trust_liability' => 'RentsInTrustLiability',
262
- 'sales_tax_payable' => 'SalesTaxPayable',
263
- 'short_term_borrowings' => 'ShortTermBorrowings',
264
- 'social_security_agencies' => 'SocialSecurityAgencies',
265
- 'staff_and_related_liability_accounts' => 'StaffAndRelatedLiabilityAccounts',
266
- 'state_local_income_tax_payable' => 'StateLocalIncomeTaxPayable',
267
- 'sundry_debtors_and_creditors' => 'SundryDebtorsAndCreditors',
268
- 'trade_and_other_payables' => 'TradeAndOtherPayables',
269
- 'trust_accounts_liabilities' => 'TrustAccountsLiabilities',
270
- # Income
271
- 'cash_receipt_income' => 'CashReceiptIncome',
272
- 'discounts_refunds_given' => 'DiscountsRefundsGiven',
273
- 'non_profit_income' => 'NonProfitIncome',
274
- 'operating_grants' => 'OperatingGrants',
275
- 'other_current_operating_income' => 'OtherCurrentOperatingIncome',
276
- 'other_primary_income' => 'OtherPrimaryIncome',
277
- 'own_work_capitalized' => 'OwnWorkCapitalized',
278
- 'revenue_general' => 'RevenueGeneral',
279
- 'sales_of_product_income' => 'SalesOfProductIncome',
280
- 'sales_retail' => 'SalesRetail',
281
- 'sales_wholesale' => 'SalesWholesale',
282
- 'savings_by_tax_scheme' => 'SavingsByTaxScheme',
283
- 'service_fee_income' => 'ServiceFeeIncome',
284
- 'unapplied_cash_payment_income' => 'UnappliedCashPaymentIncome',
285
- # Other Income
286
- 'dividend_income' => 'DividendIncome',
287
- 'gain_loss_on_sale_of_fixed_assets' => 'GainLossOnSaleOfFixedAssets',
288
- 'gain_loss_on_sale_of_investments' => 'GainLossOnSaleOfInvestments',
289
- 'interest_earned' => 'InterestEarned',
290
- 'loss_on_disposal_of_assets' => 'LossOnDisposalOfAssets',
291
- 'other_investment_income' => 'OtherInvestmentIncome',
292
- 'other_miscellaneous_income' => 'OtherMiscellaneousIncome',
293
- 'other_operating_income' => 'OtherOperatingIncome',
294
- 'tax_exempt_interest' => 'TaxExemptInterest',
295
- 'unrealised_loss_on_securities_net_of_tax' => 'UnrealisedLossOnSecuritiesNetOfTax'
296
- }.freeze
297
-
298
8
  TYPES = {
299
9
  'bank' => 'Bank',
300
10
  'other_current_assets' => 'Other Current Asset',
@@ -32,8 +32,10 @@ module LedgerSync
32
32
 
33
33
  def match?
34
34
  code == 3200 ||
35
- message.include?('authenticationfailed') ||
36
- message.include?('errorcode=003200')
35
+ code == '3200' ||
36
+ message.downcase.include?('statuscode=401') ||
37
+ message.downcase.include?('authenticationfailed') ||
38
+ message.downcase.include?('errorcode=003200')
37
39
  end
38
40
  end
39
41
 
@@ -48,8 +50,9 @@ module LedgerSync
48
50
 
49
51
  def match?
50
52
  code == 3100 ||
51
- message.include?('authorizationfailed') ||
52
- message.include?('errorcode=003100')
53
+ code == '3100' ||
54
+ message.downcase.include?('authorizationfailed') ||
55
+ message.downcase.include?('errorcode=003100')
53
56
  end
54
57
  end
55
58
 
@@ -3,7 +3,7 @@
3
3
  # :nocov:
4
4
  module LedgerSync
5
5
  module QuickBooksOnline
6
- VERSION = '0.2.5'
6
+ VERSION = '0.4.0'
7
7
 
8
8
  def self.version(args = {})
9
9
  pre = args.fetch(:pre, false)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ledger_sync-quickbooks_online
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Modern Treasury
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-04 00:00:00.000000000 Z
11
+ date: 2021-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print
@@ -164,6 +164,20 @@ dependencies:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: simplecov-lcov
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
167
181
  - !ruby/object:Gem::Dependency
168
182
  name: vcr
169
183
  requirement: !ruby/object:Gem::Requirement
@@ -212,14 +226,14 @@ dependencies:
212
226
  requirements:
213
227
  - - ">="
214
228
  - !ruby/object:Gem::Version
215
- version: 2.0.1
229
+ version: 2.0.2
216
230
  type: :runtime
217
231
  prerelease: false
218
232
  version_requirements: !ruby/object:Gem::Requirement
219
233
  requirements:
220
234
  - - ">="
221
235
  - !ruby/object:Gem::Version
222
- version: 2.0.1
236
+ version: 2.0.2
223
237
  - !ruby/object:Gem::Dependency
224
238
  name: oauth2
225
239
  requirement: !ruby/object:Gem::Requirement
@@ -434,7 +448,7 @@ files:
434
448
  homepage: https://www.ledgersync.dev
435
449
  licenses: []
436
450
  metadata: {}
437
- post_install_message:
451
+ post_install_message:
438
452
  rdoc_options: []
439
453
  require_paths:
440
454
  - lib
@@ -449,8 +463,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
449
463
  - !ruby/object:Gem::Version
450
464
  version: '0'
451
465
  requirements: []
452
- rubygems_version: 3.1.6
453
- signing_key:
466
+ rubygems_version: 3.0.3
467
+ signing_key:
454
468
  specification_version: 4
455
469
  summary: Sync common objects to accounting software.
456
470
  test_files: []