qbo_api 3.0.0 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ccab347179fd3c5d7ec6ae6ab5099be4c7732418f220f30f6dd593e2b670b3e8
4
- data.tar.gz: 461041430eaaf924ce437df17173137fe3975cd6849cac73caf7270a66e84885
3
+ metadata.gz: 5332ce0a487a0012e3cb020426155b5d8a1775497e32e3f43883c8da46417684
4
+ data.tar.gz: 4bc7672f4a4e5b3ef937cd1ba23940da15343da38401243b2665b8b9bf910455
5
5
  SHA512:
6
- metadata.gz: 7c78fdb98214a4a0c0eaee625ee7fb2215396bc296cabf2788414716b15137bf2aef79fd213328ddd9e9dfb249aa38ab04c962737126c9667d2ed4cbfcc1c82f
7
- data.tar.gz: 4a9bc0e915eff633eeaa89d6fea2ea45c979ad162e8188ebb0458380e9b146668b74af24dc0cbcd44e72b203794c87e82e2116761d9e3919015a5aa6481f2ac1
6
+ metadata.gz: 93b46a7ec5c979914e5e7046304bea8df3504e1c60e0168acf4ba8b3f756f7816b292ccc92fd57cce03629febfa6ac957124dfd2da3cc9854e8fa8e90c20d534
7
+ data.tar.gz: '04531594e0155c2cec1306e4c19ce53eb0f7b15f25e56ba860702ae773afcffa9942e0d26fdfc538b5ed831e4a1007e99b718437f9e15096bb95a9a597aeb6c1'
@@ -0,0 +1,10 @@
1
+ # Set update schedule for GitHub Actions
2
+
3
+ version: 2
4
+ updates:
5
+
6
+ - package-ecosystem: "github-actions"
7
+ directory: "/"
8
+ schedule:
9
+ # Check for updates to GitHub Actions every weekday
10
+ interval: "daily"
@@ -0,0 +1,29 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [ master ]
7
+
8
+ jobs:
9
+ rspec:
10
+ runs-on: ubuntu-latest
11
+ env:
12
+ RUBYOPT: "-W:deprecated" # show warnings, deprecations only
13
+ FARADAY_VERSION: ${{ matrix.faraday }}
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ ruby: [ '2.7', '3.0', '3.1', '3.2' ]
18
+ faraday: [ '~> 1.0', '~> 2.0' ]
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - name: Set up Ruby
22
+ uses: ruby/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby }}
25
+ bundler-cache: true
26
+ - name: Run RSpec
27
+ run: |
28
+ cp .env.test .env
29
+ bundle exec rspec spec/
data/README.md CHANGED
@@ -81,7 +81,7 @@ QboApi.request_id = true
81
81
  resp = qbo_api.create(:bill, payload: bill_hash, params: { requestid: qbo_api.uuid })
82
82
  # Works with .get, .create, .update, .query methods
83
83
  ```
84
- - To run all requests with a [Minor version](https://developer.intuit.com/docs/0100_quickbooks_online/0200_dev_guides/accounting/minor_versions).
84
+ - By default, this client runs against the current "base" or major version of the QBO API. This client does not run against the latest QBO API [minor version](https://developer.intuit.com/app/developer/qbo/docs/learn/explore-the-quickbooks-online-api/minor-versions) by default. To run all requests with a specific minor version, you must specify it:
85
85
  ```ruby
86
86
  QboApi.minor_version = 8
87
87
  ```
@@ -132,6 +132,12 @@ QboApi.minor_version = 8
132
132
  p response['status'] # => "Deleted"
133
133
  ```
134
134
 
135
+ NOTE: If you are deleting a journal entry you have to use the following syntax with the underscore, even though this is inconsistent with how you create journal entries.
136
+ ```ruby
137
+ response = qbo_api.delete(:journal_entry, id: 145)
138
+ p response['status'] # => "Deleted"
139
+ ```
140
+
135
141
  ### Deactivate (only works for name list entities)
136
142
  ```ruby
137
143
  response = qbo_api.deactivate(:employee, id: 55)
@@ -329,29 +335,46 @@ See [docs](https://developer.intuit.com/docs/0100_quickbooks_online/0100_essenti
329
335
  p qbo_api.is_transaction_entity?(:customer) # => false
330
336
  p qbo_api.is_name_list_entity?(:vendors) # => true
331
337
  ```
332
- ## <a name='OAuth2-example'>Spin up an example</a>
338
+ ## Spin up an example
333
339
  - <a href="http://minimul.com/access-the-quickbooks-online-api-with-oauth2.html" target="_blank">Check out this article on spinning up the example</a>.
334
- - `git clone git://github.com/minimul/qbo_api && cd qbo_api`
335
- - `bundle`
340
+
341
+ - Create a Intuit developer account at [https://developer.intuit.com](https://developer.intuit.com)
342
+ - Create an app in the intuit developer backend
343
+ - Go to [myapps](https://developer.intuit.com/app/developer/myapps)
344
+ - Create an app with both the `Accounting` & `Payments` selected.
345
+
346
+ - Setup the app and gather credentials
347
+ - Go to the [Development Dashboard](https://developer.intuit.com/app/developer/dashboard)
348
+ - Click on your App name
349
+ - Click "Keys & credentials" under Development Settings in left menu
350
+ - Copy the 'Client ID' and the 'Client Secret'
351
+ - Add a Redirect URI: `http://localhost:9393/oauth2-redirect` (or whatever PORT= is in your .env)
352
+ - Create a new Sandbox Company by clicking on "View Sandbox companies"
353
+ Don't use it for anything else besides testing this app.
354
+ - Copy the 'Company ID' for use later
355
+ 1. Within 'Sandbox Company_US_1' click on the COG -> Additional info
356
+ 2. Copy the 'Company ID'
357
+
358
+ - Setup qbo_api
359
+ - `git clone git://github.com/minimul/qbo_api && cd qbo_api`
360
+ - `bundle`
361
+
336
362
  - Create a `.env` file
337
363
  - `cp .env.example_app.oauth2 .env`
338
- - If needed create an account at [https://developer.intuit.com](https://developer.intuit.com)
339
- - Click `Get started coding`
340
- - Create an app with both the `Accounting` & `Payments` selected.
341
- - Go to the [`Development` tab](https://developer.intuit.com/v2/ui#/app/dashboard)
342
- and copy the 'Client ID' and the 'Client 'Secret' to your .env
343
- as QBO_API_CLIENT_ID and QBO_API_CLIENT_SECRET respectively
344
- - Add a Redirect URI: `http://localhost:9393/oauth2-redirect` (or whatever PORT= is in your .env)
345
- - Create a new Company ([from the manage sandboxes page](https://developer.intuit.com/v2/ui#/sandbox))
346
- Don't use it for anything else besides testing this app.
347
- -. Copy the 'Company ID' to your .env as QBO_API_COMPANY_ID
348
- - Start up the example app
364
+ - Edit your .env and enter the following
365
+ ```
366
+ export QBO_API_CLIENT_ID=[YOUR CLIENT ID]
367
+ export QBO_API_CLIENT_SECRET=[YOUR CLIENT SECRET]
368
+ export QBO_API_COMPANY_ID=[YOUR COMPANY ID]
369
+ ```
370
+
371
+ - Start up the example app and test
349
372
  - `ruby example/oauth2.rb`
350
- - Go to `http://localhost:9393/oauth2`
351
- - Use the `Connect to QuickBooks` button to connect to your QuickBooks sandbox, which you receive when signing up at [https://developer.intuit.com](https://developer.intuit.com).
352
- - After successfully connecting to your sandbox go to :
353
- - `http://localhost:9393/oauth2/customer/5`
373
+ - Go to `http://localhost:9393/oauth2`
374
+ - Use the `Connect to QuickBooks` button to connect to your QuickBooks sandbox, which you receive when signing up at [https://developer.intuit.com](https://developer.intuit.com).
375
+ - After successfully connecting to your sandbox go to `http://localhost:9393/oauth2/customer/5`
354
376
  - You should see "Dukes Basketball Camp" displayed
377
+
355
378
  - Checkout [`example/oauth2.rb`](https://github.com/minimul/qbo_api/blob/master/example/oauth2.rb)
356
379
  to see what is going on under the hood.
357
380
 
@@ -104,7 +104,7 @@ class QboApi
104
104
  # now part of Faraday itself, and :authorization can be used to pass
105
105
  # the Bearer token.
106
106
  def add_authorization_middleware(conn)
107
- conn.request :authorization, access_token, token_type: 'bearer'
107
+ conn.request :authorization, 'Bearer', access_token
108
108
  end
109
109
 
110
110
  def entity_name(entity)
data/lib/qbo_api/error.rb CHANGED
@@ -13,11 +13,25 @@ class QboApi
13
13
  class Error < StandardError
14
14
  attr_reader :fault
15
15
 
16
- def initialize(errors = nil)
17
- if errors
18
- @fault = errors
19
- super(errors[:error_body])
20
- end
16
+ def initialize(errors = {})
17
+ @fault = errors
18
+ super(errors[:error_body])
19
+ end
20
+
21
+ def fault_type
22
+ fault.dig(:error_body, 0, :fault_type)
23
+ end
24
+
25
+ def error_code
26
+ fault.dig(:error_body, 0, :error_code)
27
+ end
28
+
29
+ def error_message
30
+ fault.dig(:error_body, 0, :error_message)
31
+ end
32
+
33
+ def error_detail
34
+ fault.dig(:error_body, 0, :error_detail)
21
35
  end
22
36
  end
23
37
 
@@ -1,3 +1,3 @@
1
1
  class QboApi
2
- VERSION = "3.0.0"
2
+ VERSION = "3.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qbo_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Pelczarski
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-03 00:00:00.000000000 Z
11
+ date: 2024-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -164,7 +164,7 @@ dependencies:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
- description:
167
+ description:
168
168
  email:
169
169
  - christian@minimul.com
170
170
  executables: []
@@ -173,6 +173,8 @@ extra_rdoc_files: []
173
173
  files:
174
174
  - ".env.example_app.oauth2"
175
175
  - ".env.test"
176
+ - ".github/dependabot.yml"
177
+ - ".github/workflows/ci.yaml"
176
178
  - ".gitignore"
177
179
  - ".travis.yml"
178
180
  - Gemfile
@@ -204,7 +206,7 @@ homepage: https://github.com/minimul/qbo_api
204
206
  licenses:
205
207
  - MIT
206
208
  metadata: {}
207
- post_install_message:
209
+ post_install_message:
208
210
  rdoc_options: []
209
211
  require_paths:
210
212
  - lib
@@ -219,8 +221,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
219
221
  - !ruby/object:Gem::Version
220
222
  version: '0'
221
223
  requirements: []
222
- rubygems_version: 3.2.22
223
- signing_key:
224
+ rubygems_version: 3.3.26
225
+ signing_key:
224
226
  specification_version: 4
225
227
  summary: Ruby JSON-only client for QuickBooks Online API v3. Built on top of the Faraday
226
228
  gem.