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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YTgzZjdjZGZjODEyMmMyNjk4MjM0ZmNmNjZhM2Q0YmJlN2U3NDI1Yw==
4
+ YTc3MTNmZDU5Yjc1N2U0ODM1YTI0NzI4ZGE2ZDc0ZTYwYTEzYmVjMA==
5
5
  data.tar.gz: !binary |-
6
- MThiMzIwNmQ2NjQ3NTEzMTdhZTQwNzZmZDU0ZDA2NmQ0ZmExNjdiNQ==
6
+ YjhkMTZlYzMyNGVmYmMzODA2MGQ0ZDUzNjI0MWNmMmUyZDAyMzlhMw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YTE4MTkxNjU4M2M3NmVkNjY1OTRmMTNjMDQyNTAxOGJiYWJhMTdhYzNlYzYz
10
- YTcyMDJlMjM2YjI2NzZmNWJhYzgzZmZmZWE5YWIwZTc2ZTU2NDExZjdjZWY2
11
- MWNiYTYzMTYwMDc2N2ZhNTkyMTViNWYwZWIyZDEwNDc0N2YyZDU=
9
+ NzkxNTRhMDUwMzRlN2E0Y2ViODdkYTlhY2JlYTlkZTJhNTcyYWYzYjlmMjIx
10
+ MWM1NDE5ODk4NmZiNTQ4ZGJiOWU4ZTA4NmUwYzcwNjQxZjFjNDc1ZTJjYWI4
11
+ Mzc5ODAyNGZlMTcyNWJhZmU3Y2M1MzI1ZGJkYmU3YmYwYjI1NTA=
12
12
  data.tar.gz: !binary |-
13
- YjMwYWQ0ZTUzYWMxOTc2YjhjYzRjNjU0Y2EwZWIyYjdmNGIyMjc1NWQ5ZmY4
14
- ZThhZTlkY2JhMmZmZTk5MWQ4YWJiZjc3NTZkMmZlM2I5ZGY4NGUyMGJhNmE3
15
- NmVkODMyM2NjYjVjZjY4YTk1Nzc4MmFkMjc2YzJlMTFjODhiYTM=
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
- >> b.show
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
- >> b.show page:1, per_page: 3
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
- ### id()
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.id(1)
78
+ >> base.find_by_id(1)
80
79
  ```
81
80
 
82
- ### display_name()
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.display_name('Chuck Russell')
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
  ```
@@ -39,10 +39,6 @@ module Quickbooks
39
39
  end
40
40
  end
41
41
 
42
- def id(id)
43
- @service.fetch_by_id(id)
44
- end
45
-
46
42
  def description(e)
47
43
  desc = (method = describing_method) =~ /(total)/ ? e.send(method).to_f : e.send(method)
48
44
  rescue => e
@@ -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 display_name(display_name, options = {})
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.2.0'
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 ".id" do
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.id(28)
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.2.0
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-03-30 00:00:00.000000000 Z
11
+ date: 2015-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: quickbooks-ruby