quickbooks-ruby-base 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +6 -7
- data/lib/quickbooks/base.rb +0 -4
- data/lib/quickbooks/base/finders.rb +6 -1
- data/quickbooks-ruby-base.gemspec +1 -1
- data/spec/quickbooks_ruby_base_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YTc3MTNmZDU5Yjc1N2U0ODM1YTI0NzI4ZGE2ZDc0ZTYwYTEzYmVjMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YjhkMTZlYzMyNGVmYmMzODA2MGQ0ZDUzNjI0MWNmMmUyZDAyMzlhMw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzkxNTRhMDUwMzRlN2E0Y2ViODdkYTlhY2JlYTlkZTJhNTcyYWYzYjlmMjIx
|
10
|
+
MWM1NDE5ODk4NmZiNTQ4ZGJiOWU4ZTA4NmUwYzcwNjQxZjFjNDc1ZTJjYWI4
|
11
|
+
Mzc5ODAyNGZlMTcyNWJhZmU3Y2M1MzI1ZGJkYmU3YmYwYjI1NTA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTcwMmE1MTJhY2Y0NzcwNmIxMTA4YTI1Yjk0NmNhNDE3YzVhNjRjZjY1Nzdm
|
14
|
+
N2YwZTA2ZDg3ODljODE5ZGU0ZTI1MTA3YTlkNzZiNjE1ODEwMzVjYjlkNjhk
|
15
|
+
ZWE4OWRkODJjZDQzMDEyNWUyZGM2NWFmM2Q3YzBlMDYyMGViZDk=
|
data/README.md
CHANGED
@@ -59,32 +59,31 @@ Returns `quickbooks-ruby` service.
|
|
59
59
|
Returns an array of the QuickBooks' IDs and a "smart" description. Smart, meaning that different services have different identifiers. For a customer, employee, and vendor the `DESC` is `display_name`. For invoice, it is `doc_number`. For item, tax_code, and payment_method it is the `name`.
|
60
60
|
```
|
61
61
|
base = Quickbooks::Base.new(account, :invoice)
|
62
|
-
>> base.service.create(qb_invoice)
|
63
62
|
# Returns an array of payment_methods from QBO account
|
64
63
|
base = Quickbooks::Base.new(account, :payment_method)
|
65
64
|
>> base.show
|
66
65
|
# Returns an array of payment_methods from QBO account
|
67
|
-
>>
|
66
|
+
>> base.show
|
68
67
|
=> ["QBID: 5 DESC: American Express", "QBID: 1 DESC: Cash", "QBID: 2 DESC: Check", "QBID: 6 DESC: Diners Club", "QBID: 7 DESC: Discover", "QBID: 4 DESC: MasterCard", "QBID: 3 DESC: Visa"]
|
69
68
|
# With options
|
70
|
-
>>
|
69
|
+
>> base.show page:1, per_page: 3
|
71
70
|
=> ["QBID: 5 DESC: American Express", "QBID: 1 DESC: Cash", "QBID: 2 DESC: Check"]
|
72
71
|
|
73
72
|
```
|
74
73
|
|
75
|
-
###
|
74
|
+
### find_by_id()
|
76
75
|
Convenience method to fetch an entity by its reference id
|
77
76
|
```
|
78
77
|
base = Quickbooks::Base.new(account, :customer)
|
79
|
-
>> base.
|
78
|
+
>> base.find_by_id(1)
|
80
79
|
```
|
81
80
|
|
82
|
-
###
|
81
|
+
### find_by_display_name()
|
83
82
|
Convenience method to search for a name entity by DisplayName.
|
84
83
|
Note: Leverages proper escaping via the [Quickbooks::Util::QueryBuilder](https://github.com/ruckus/quickbooks-ruby/blob/master/lib/quickbooks/util/query_builder.rb) module.
|
85
84
|
```
|
86
85
|
base = Quickbooks::Base.new(account, :customer)
|
87
|
-
>> base.
|
86
|
+
>> base.find_by_display_name('Chuck Russell')
|
88
87
|
# Generates a query based on the following SQL
|
89
88
|
# "Select Id, DisplayName From Customer WHERE DisplayName = 'Chuck Russell' LIMIT 1"
|
90
89
|
```
|
data/lib/quickbooks/base.rb
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
module Quickbooks
|
2
2
|
class Base
|
3
3
|
module Finders
|
4
|
+
|
5
|
+
def find_by_id(id)
|
6
|
+
@service.fetch_by_id(id)
|
7
|
+
end
|
8
|
+
|
4
9
|
def qbuilder
|
5
10
|
Quickbooks::Util::QueryBuilder.new
|
6
11
|
end
|
@@ -18,7 +23,7 @@ module Quickbooks
|
|
18
23
|
sql_builder(where, options)
|
19
24
|
end
|
20
25
|
|
21
|
-
def
|
26
|
+
def find_by_display_name(display_name, options = {})
|
22
27
|
sql = display_name_sql(display_name, options)
|
23
28
|
@service.query(sql)
|
24
29
|
end
|
@@ -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 = '1.3.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}
|
@@ -108,12 +108,12 @@ describe Quickbooks::Base do
|
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
|
-
describe ".
|
111
|
+
describe ".find_by_id" do
|
112
112
|
it 'grabs a object by id' do
|
113
113
|
xml = read_fixture('invoice')
|
114
114
|
stub_response(xml)
|
115
115
|
qr = Quickbooks::Base.new(full_account, :invoice)
|
116
|
-
result = qr.
|
116
|
+
result = qr.find_by_id(28)
|
117
117
|
expect(result.id).to eq 156
|
118
118
|
end
|
119
119
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quickbooks-ruby-base
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: quickbooks-ruby
|