qbo_api 1.6.1 → 1.6.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 +4 -4
- data/lib/qbo_api.rb +6 -7
- data/lib/qbo_api/builder.rb +21 -0
- data/lib/qbo_api/setter.rb +18 -0
- data/lib/qbo_api/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0ccc44f499b0c5078b99f8eea04d58ee52f8094
|
4
|
+
data.tar.gz: 87980a9894552ed9bae5ffbe320d63f2ab2e96bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e57bc51406e94051033b1d01baba6e70eb9c56ff96e9cfd7677adc5826f70d69fd48641e159fd7ba0f1094822eb44e0733c54fd9aee0f64d4a60a19315648345
|
7
|
+
data.tar.gz: cea01f2127b4974417dffa7f95a4fdcf134d144b228642fa2c327e359f74df191114902ff8e78f5b880fdc772e3b24f70f83d70d1256c57469f87b92bff3b69d
|
data/lib/qbo_api.rb
CHANGED
@@ -13,6 +13,8 @@ require_relative 'qbo_api/raise_http_exception'
|
|
13
13
|
require_relative 'qbo_api/entity'
|
14
14
|
require_relative 'qbo_api/util'
|
15
15
|
require_relative 'qbo_api/attachment'
|
16
|
+
require_relative 'qbo_api/setter'
|
17
|
+
require_relative 'qbo_api/builder'
|
16
18
|
|
17
19
|
class QboApi
|
18
20
|
extend Configuration
|
@@ -20,6 +22,9 @@ class QboApi
|
|
20
22
|
include Entity
|
21
23
|
include Util
|
22
24
|
include Attachment
|
25
|
+
include Setter
|
26
|
+
include Builder
|
27
|
+
|
23
28
|
attr_reader :realm_id
|
24
29
|
|
25
30
|
REQUEST_TOKEN_URL = 'https://oauth.intuit.com/oauth/v1/get_request_token'
|
@@ -90,11 +95,10 @@ class QboApi
|
|
90
95
|
def deactivate(entity, id:)
|
91
96
|
err_msg = "Deactivate is only for name list entities. Use .delete instead"
|
92
97
|
raise QboApi::NotImplementedError.new, err_msg unless is_name_list_entity?(entity)
|
93
|
-
payload =
|
98
|
+
payload = set_deactivate(entity, id)
|
94
99
|
request(:post, entity: entity, path: entity_path(entity), payload: payload)
|
95
100
|
end
|
96
101
|
|
97
|
-
# TODO: Need specs for disconnect and reconnect
|
98
102
|
# https://developer.intuit.com/docs/0100_quickbooks_online/0100_essentials/0085_develop_quickbooks_apps/0004_authentication_and_authorization/oauth_management_api#/Reconnect
|
99
103
|
def disconnect
|
100
104
|
path = "#{APP_CONNECTION_URL}/disconnect"
|
@@ -177,11 +181,6 @@ class QboApi
|
|
177
181
|
}
|
178
182
|
end
|
179
183
|
|
180
|
-
def set_update(entity, id)
|
181
|
-
resp = get(entity, id)
|
182
|
-
{ Id: resp['Id'], SyncToken: resp['SyncToken'] }
|
183
|
-
end
|
184
|
-
|
185
184
|
def get_endpoint
|
186
185
|
prod = self.class.production
|
187
186
|
case @endpoint
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class QboApi
|
2
|
+
module Builder
|
3
|
+
|
4
|
+
private
|
5
|
+
|
6
|
+
def build_update(resp)
|
7
|
+
{ Id: resp['Id'], SyncToken: resp['SyncToken'] }
|
8
|
+
end
|
9
|
+
|
10
|
+
def build_deactivate(entity, resp)
|
11
|
+
payload = build_update(resp).merge('sparse': true, 'Active': false)
|
12
|
+
|
13
|
+
case singular(entity)
|
14
|
+
when 'Account'
|
15
|
+
payload['Name'] = resp['Name']
|
16
|
+
end
|
17
|
+
payload
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class QboApi
|
2
|
+
module Setter
|
3
|
+
|
4
|
+
private
|
5
|
+
|
6
|
+
def set_update(entity, id)
|
7
|
+
resp = get(entity, id)
|
8
|
+
build_update(resp)
|
9
|
+
end
|
10
|
+
|
11
|
+
def set_deactivate(entity, id)
|
12
|
+
resp = get(entity, id)
|
13
|
+
build_deactivate(entity, resp)
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
data/lib/qbo_api/version.rb
CHANGED
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: 1.6.
|
4
|
+
version: 1.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Pelczarski
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -270,10 +270,12 @@ files:
|
|
270
270
|
- example/views/oauth2_redirect.erb
|
271
271
|
- lib/qbo_api.rb
|
272
272
|
- lib/qbo_api/attachment.rb
|
273
|
+
- lib/qbo_api/builder.rb
|
273
274
|
- lib/qbo_api/configuration.rb
|
274
275
|
- lib/qbo_api/entity.rb
|
275
276
|
- lib/qbo_api/error.rb
|
276
277
|
- lib/qbo_api/raise_http_exception.rb
|
278
|
+
- lib/qbo_api/setter.rb
|
277
279
|
- lib/qbo_api/supporting.rb
|
278
280
|
- lib/qbo_api/util.rb
|
279
281
|
- lib/qbo_api/version.rb
|