qbo_api 2.1.0 → 2.1.1

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: bdae2e1e7049a7b71c286a5e3b36056a100c89c8fad4a85690b174457f9b1072
4
- data.tar.gz: 36baaf4f27090e11b630a620c0b08fe2f531ccd25436a7ea4d5f4156f2d53c12
3
+ metadata.gz: a9e249e7e48339a74b585f7afd97711407c8b814c0670e417b4792b465e59515
4
+ data.tar.gz: ef17013bf8fd40513f0f4ddb7ffa9653baa2b686f7091a1ba82a8f0cfb79e9ed
5
5
  SHA512:
6
- metadata.gz: c7402792bd0691b386469c65543c729799a5aedd150a4a06e726c50d382cd7342a4215676cbb13b20898f93f1501525c03ea8481627003fd311d6332d828c03a
7
- data.tar.gz: f3d4d4ba01db6d69dfccb22c5f4225d0b68e91c5e591384516971154b837aa06b370f822a8dc20f5c859ace71fe4c033bec002b44224505773c208459f44a1f4
6
+ metadata.gz: c31a1c1e627e8f1677323d74e959bb377338984c8cd73c49ebdb95253a97986e7634e20ced251a67e18321bda1827d67e759add75dece2bcb052b2411132bcba
7
+ data.tar.gz: b8c46643f89b9be3e285dd4d8e9bf030af7b75b3872e21937afc6d0c5bfbe59c23038e9bc4431f1efa762888f408d240dd0149c4035f9e19a35ee63c1dbf2847
data/README.md CHANGED
@@ -372,8 +372,8 @@ for how to install ngrok and what it is.
372
372
  Add the token to your .env as QBO_API_VERIFIER_TOKEN
373
373
 
374
374
  - In another tab, create a customer via the API:
375
- `bundle exec ruby -rqbo_api -rdotenv -e 'Dotenv.load; p QboApi.new(access_token: ENV.fetch("QBO_API_OAUTH2_ACCESS_TOKEN"), realm_id: ENV.fetch("QBO_API_COMPANY_ID")).create(:customer, payload: { DisplayName: "TestCustomer" })'`
376
- (You'll also need to have added the QBO_API_COMPANY_ID and QBO_API_OAUTH2_ACCESS_TOKEN to your .env)
375
+ `bundle exec ruby -rqbo_api -rdotenv -e 'Dotenv.load; p QboApi.new(access_token: ENV.fetch("QBO_API_ACCESS_TOKEN"), realm_id: ENV.fetch("QBO_API_COMPANY_ID")).create(:customer, payload: { DisplayName: "TestCustomer" })'`
376
+ (You'll also need to have added the QBO_API_COMPANY_ID and QBO_API_ACCESS_TOKEN to your .env)
377
377
 
378
378
  There could be a delay of up to a minute before the webhook fires.
379
379
 
data/example/base.rb CHANGED
@@ -3,6 +3,7 @@ BASE_GEMS = proc do
3
3
  # This app
4
4
  gem 'sinatra'
5
5
  gem 'sinatra-contrib'
6
+ gem 'puma'
6
7
 
7
8
  # Creds from ../.env
8
9
  gem 'dotenv'
@@ -58,6 +58,14 @@ class QboApi
58
58
  request(:post, entity: entity, path: entity_path(entity), payload: payload)
59
59
  end
60
60
 
61
+ def void(entity, id:)
62
+ err_msg = "Void is only for voidable transaction entities. Use .delete or .deactivate instead"
63
+ raise QboApi::NotImplementedError.new, err_msg unless is_voidable_transaction_entity?(entity)
64
+ path = add_params_to_path(path: entity_path(entity), params: { operation: :void })
65
+ payload = set_update(entity, id)
66
+ request(:post, entity: entity, path: path, payload: payload)
67
+ end
68
+
61
69
  private
62
70
 
63
71
  def get_query_str(entity, query_filter_args)
@@ -20,6 +20,19 @@ class QboApi
20
20
  sym.to_s.split('_').collect(&:capitalize).join
21
21
  end
22
22
 
23
+ def is_voidable_transaction_entity?(entity)
24
+ voidable_transaction_entities.include?(singular(entity))
25
+ end
26
+
27
+ def voidable_transaction_entities
28
+ %w{
29
+ BillPayment
30
+ Invoice
31
+ Payment
32
+ SalesReceipt
33
+ }
34
+ end
35
+
23
36
  def is_transaction_entity?(entity)
24
37
  transaction_entities.include?(singular(entity))
25
38
  end
@@ -1,3 +1,3 @@
1
1
  class QboApi
2
- VERSION = "2.1.0"
2
+ VERSION = "2.1.1"
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: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Pelczarski
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-07-12 00:00:00.000000000 Z
11
+ date: 2022-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler