quickbooks-ruby-base 1.6.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/HISTORY.md +4 -0
- data/README.md +3 -3
- data/lib/quickbooks/base.rb +3 -3
- data/lib/quickbooks/base/configuration.rb +1 -1
- data/quickbooks-ruby-base.gemspec +3 -2
- data/spec/quickbooks_ruby_base_spec.rb +10 -10
- data/spec/spec_helper.rb +10 -1
- metadata +31 -17
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
MWVjMmE3ODlmMDZhZWUyMzUyMWNjZDNjYjgyZDYzMjY4MGViY2RjYg==
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 927a2ed1e8c6ac7e3afefb37316610a89ffd2371881a25271ff791fde7b3ade9
|
4
|
+
data.tar.gz: e3808bdc6326a0dd1107d22062980a46dc075ec797a204941d934cc51d2e59fd
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
ZGM4OGY4ZjIzYjg4MjIwZmVlZDY3OWVlZWU1MmFiMWYzMTA4M2Y4NjEzMDA1
|
11
|
-
ZmJlZWE0NmJlMTYyYTRlZGE2NGU2NmMyNWFhNzhhOWQ0OTdiM2E=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NTc3NDI0NmUyNjkxZjM1MTA1ODE5OTdmNzQ3NzA0MzU1Nzc5MWVlZDAwYmQw
|
14
|
-
OTJiNWQ1YjEyNmYxMThkYjljY2U3MmVkY2FiZjBiZWUxMDEyM2I1ZTdhZDAw
|
15
|
-
ZDBlZTJhM2U5YTg2Nzg4N2E4NmQ0MDFiZTRhMGFhOWM0YTY4Njc=
|
6
|
+
metadata.gz: 10f3e7d96d370329214f5b3c654d5af071fd019bd4d55d919f9c079b89d6dc219b99f8c1b793190861ac6dd050bf7450369ad86c8843b161f7935d5463030a74
|
7
|
+
data.tar.gz: 0e70e56ba9783fe87e13a1347826a99b44e64ba252e2105e8bcf3dca90159d50e50091dfca4a7c3079f33342bf51c6bc1a7c324eb82951d2bc2ebd963666d06e
|
data/HISTORY.md
ADDED
data/README.md
CHANGED
@@ -104,10 +104,10 @@ base = Quickbooks::Base.new(account)
|
|
104
104
|
|
105
105
|
As the first argument, the `Quickbooks::Base` class expects a persistent object that holds OAuth connection information.
|
106
106
|
|
107
|
-
For example, if an account's
|
107
|
+
For example, if an account's OAuth2 information is stored like this:
|
108
108
|
```
|
109
109
|
account.qb_token
|
110
|
-
account.
|
110
|
+
account.qb_refresh_token
|
111
111
|
account.qb_company_id
|
112
112
|
```
|
113
113
|
|
@@ -127,7 +127,7 @@ $qb_oauth_consumer = OAuth::Consumer.new(QB_KEY, QB_SECRET, {
|
|
127
127
|
|
128
128
|
Quickbooks::Base.configure do |c|
|
129
129
|
c.persistent_token = 'qb_token'
|
130
|
-
c.
|
130
|
+
c.persistent_refresh_token = 'qb_refresh_token'
|
131
131
|
c.persistent_company_id = 'qb_company_id'
|
132
132
|
end
|
133
133
|
|
data/lib/quickbooks/base.rb
CHANGED
@@ -33,7 +33,7 @@ module Quickbooks
|
|
33
33
|
alias_method :qr_service, :quickbooks_ruby_service
|
34
34
|
|
35
35
|
def oauth_client
|
36
|
-
@oauth_client ||=
|
36
|
+
@oauth_client ||= OAuth2::AccessToken.new(Quickbooks::Base.oauth_consumer, token, refresh_token: refresh_token)
|
37
37
|
end
|
38
38
|
|
39
39
|
def show(options = {})
|
@@ -74,8 +74,8 @@ module Quickbooks
|
|
74
74
|
retrieve(:token)
|
75
75
|
end
|
76
76
|
|
77
|
-
def
|
78
|
-
retrieve(:
|
77
|
+
def refresh_token
|
78
|
+
retrieve(:refresh_token)
|
79
79
|
end
|
80
80
|
|
81
81
|
def company_id
|
@@ -13,7 +13,7 @@ module Quickbooks
|
|
13
13
|
@oauth_consumer ||= $qb_oauth_consumer
|
14
14
|
end
|
15
15
|
|
16
|
-
%w(token
|
16
|
+
%w(token refresh_token company_id).each do |type|
|
17
17
|
class_eval <<-eos
|
18
18
|
def persistent_#{type}=(location)
|
19
19
|
@persistent_#{type} = location
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'quickbooks-ruby-base'
|
7
|
-
spec.version = '1.
|
7
|
+
spec.version = '2.1.0'
|
8
8
|
spec.authors = ["Christian"]
|
9
9
|
spec.email = ["christian@minimul.com"]
|
10
10
|
spec.summary = %q{Base class to provide common methods for the quickbooks-ruby gem}
|
@@ -15,7 +15,8 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.test_files = spec.files.grep %r{^spec/}
|
16
16
|
spec.require_paths = ["lib"]
|
17
17
|
|
18
|
-
spec.add_dependency 'quickbooks-ruby'
|
18
|
+
spec.add_dependency 'quickbooks-ruby', ">= 1.0.3"
|
19
|
+
spec.add_dependency 'oauth2', '~>1.4'
|
19
20
|
spec.add_development_dependency "bundler", "~> 1.5"
|
20
21
|
spec.add_development_dependency "rake"
|
21
22
|
spec.add_development_dependency "rspec"
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Quickbooks::Base do
|
4
4
|
let(:account) { double }
|
5
|
-
let(:full_account) { account = double(settings: double( qb_token: 'tttttttttt',
|
5
|
+
let(:full_account) { account = double(settings: double( qb_token: 'tttttttttt', qb_refresh_token: 'ssssssss', qb_company_id: '1234567')) }
|
6
6
|
let(:qr_base) { Quickbooks::Base.new(account) }
|
7
7
|
|
8
8
|
describe ".quickbooks_ruby_namespace" do
|
@@ -78,7 +78,7 @@ describe Quickbooks::Base do
|
|
78
78
|
|
79
79
|
describe ".retrieve" do
|
80
80
|
after do
|
81
|
-
Quickbooks::Base.configure { |c| c.persistent_token = nil; c.
|
81
|
+
Quickbooks::Base.configure { |c| c.persistent_token = nil; c.persistent_refresh_token = nil; c.persistent_company_id = nil }
|
82
82
|
end
|
83
83
|
|
84
84
|
it "should set the persistence token location" do
|
@@ -121,16 +121,16 @@ describe Quickbooks::Base do
|
|
121
121
|
xml = read_fixture('invoice')
|
122
122
|
stub_response(xml)
|
123
123
|
qr = Quickbooks::Base.new(full_account, :invoice)
|
124
|
-
result = qr.find_by_id(28)
|
125
|
-
expect(result.id).to eq 156
|
124
|
+
result = qr.find_by_id('28')
|
125
|
+
expect(result.id).to eq '156'
|
126
126
|
end
|
127
127
|
|
128
128
|
it 'grabs object from different entity' do
|
129
129
|
xml = read_fixture('item_5')
|
130
130
|
stub_response(xml)
|
131
131
|
qr = Quickbooks::Base.new(full_account)
|
132
|
-
result = qr.find_by_id(5, :item)
|
133
|
-
expect(result.id).to eq 5
|
132
|
+
result = qr.find_by_id('5', :item)
|
133
|
+
expect(result.id).to eq '5'
|
134
134
|
end
|
135
135
|
end
|
136
136
|
|
@@ -153,7 +153,7 @@ describe Quickbooks::Base do
|
|
153
153
|
stub_response(xml)
|
154
154
|
qr = Quickbooks::Base.new(full_account, :employee)
|
155
155
|
result = qr.find_by_display_name("Emily Platt")
|
156
|
-
expect(result.first.id).to eq 55
|
156
|
+
expect(result.first.id).to eq '55'
|
157
157
|
end
|
158
158
|
|
159
159
|
it 'passing in the entity' do
|
@@ -161,7 +161,7 @@ describe Quickbooks::Base do
|
|
161
161
|
stub_response(xml)
|
162
162
|
qr = Quickbooks::Base.new(full_account)
|
163
163
|
result = qr.find_by_display_name("Bill's Windsurf Shop", entity: :customer)
|
164
|
-
expect(result.first.id).to eq 2
|
164
|
+
expect(result.first.id).to eq '2'
|
165
165
|
end
|
166
166
|
end
|
167
167
|
|
@@ -170,7 +170,7 @@ describe Quickbooks::Base do
|
|
170
170
|
end
|
171
171
|
|
172
172
|
def stub_response(xml)
|
173
|
-
response = Struct.new(:
|
174
|
-
allow_any_instance_of(
|
173
|
+
response = Struct.new(:body, :status).new(xml, 200)
|
174
|
+
allow_any_instance_of(OAuth2::AccessToken).to receive(:get).and_return(response)
|
175
175
|
end
|
176
176
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -2,5 +2,14 @@ require 'quickbooks/base'
|
|
2
2
|
require 'quickbooks-ruby'
|
3
3
|
|
4
4
|
RSpec.configure do |c|
|
5
|
-
|
5
|
+
#config.failure_color = :magenta
|
6
|
+
#config.tty = true
|
7
|
+
c.color = true
|
6
8
|
end
|
9
|
+
|
10
|
+
$qb_oauth_consumer = OAuth2::Client.new("app_key", "app_secret", {
|
11
|
+
:site => "https://appcenter.intuit.com/connect/oauth2",
|
12
|
+
:authorize_url => "https://appcenter.intuit.com/connect/oauth2",
|
13
|
+
:token_url => "https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer",
|
14
|
+
:connection_opts => {}
|
15
|
+
})
|
metadata
CHANGED
@@ -1,69 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quickbooks-ruby-base
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: quickbooks-ruby
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.0.3
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.0.3
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: oauth2
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.4'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.4'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
|
-
- - ~>
|
45
|
+
- - "~>"
|
32
46
|
- !ruby/object:Gem::Version
|
33
47
|
version: '1.5'
|
34
48
|
type: :development
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
|
-
- - ~>
|
52
|
+
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '1.5'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- -
|
59
|
+
- - ">="
|
46
60
|
- !ruby/object:Gem::Version
|
47
61
|
version: '0'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- -
|
66
|
+
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rspec
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- -
|
73
|
+
- - ">="
|
60
74
|
- !ruby/object:Gem::Version
|
61
75
|
version: '0'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- -
|
80
|
+
- - ">="
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
69
83
|
description: ''
|
@@ -73,8 +87,9 @@ executables: []
|
|
73
87
|
extensions: []
|
74
88
|
extra_rdoc_files: []
|
75
89
|
files:
|
76
|
-
- .gitignore
|
90
|
+
- ".gitignore"
|
77
91
|
- Gemfile
|
92
|
+
- HISTORY.md
|
78
93
|
- LICENSE.txt
|
79
94
|
- README.md
|
80
95
|
- Rakefile
|
@@ -104,17 +119,16 @@ require_paths:
|
|
104
119
|
- lib
|
105
120
|
required_ruby_version: !ruby/object:Gem::Requirement
|
106
121
|
requirements:
|
107
|
-
- -
|
122
|
+
- - ">="
|
108
123
|
- !ruby/object:Gem::Version
|
109
124
|
version: '0'
|
110
125
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
126
|
requirements:
|
112
|
-
- -
|
127
|
+
- - ">="
|
113
128
|
- !ruby/object:Gem::Version
|
114
129
|
version: '0'
|
115
130
|
requirements: []
|
116
|
-
|
117
|
-
rubygems_version: 2.4.6
|
131
|
+
rubygems_version: 3.0.0
|
118
132
|
signing_key:
|
119
133
|
specification_version: 4
|
120
134
|
summary: Base class to provide common methods for the quickbooks-ruby gem
|