Switch branches/tags
Find file
Fetching contributors…
Cannot retrieve contributors at this time
92 lines (69 sloc) 3.18 KB


QBFC-Ruby provides a wrapper around QuickBooks' QBFC COM object, while allowing more or less direct access to the actual COM object.

Obviously, test before using on your production data…


QBFC-Ruby supports find queries with options, which utitilize QBFC's Query Requests. See QBFC::Element.find for details and options.

QBFC::session do | qb |
  checks = qb.checks.find(:first, :conditions => {:entity => 'ABC Supplies'})


QBFC-Ruby supports loading of related records. These are records represented by “*Ref” in the QBFC documentation. For example, a Check has, among others, a PayeeEntityRef and an AccountRef. These can be accessed via, respectively, check.payee and check.account. returns the name of the payee.

You can also access the *ID and Name fields of referenced records. Example: for the payee of a Check, check.payee_id and check.payee_name.

General Examples

# A very simple example, finding a single Customer by name
QBFC::session do | qb |
  puts qb.customer('Customer Name').full_name

# Find all Customer, then return the first in the Array
# Next, find the first Customer only
QBFC::session do | qb |
  customers = qb.customers.find(:all)
  puts customers[0].full_name
  puts qb.customers.find(:first).full_name

# Same as previous, but not using a block  
sess =
customers = QBFC::Customer.find(sess, :all)
puts customers[0].full_name
puts QBFC::Customer.find(sess, :first).full_name

# Use a QBFC::Session object, but access the COM object
# more directly.
QBFC::session do | qb |
  request_set = qb.CreateMsgSetRequest("US", 6, 0)
  customer_query = request_set.AppendCustomerQueryRq	
  response = qb.DoRequests(request_set)
  customer_set = response.ResponseList[0]
  first_customer = customer_set.Detail[0]
  puts first_customer.full_name


BehindLogic Quickbooks Rubygem


This gem covers the full API and does validations. I haven't tried it out, but the code samples look straightforward. ($199 for a internal license)

QuickBooks for Ruby

(docs:, homepage:

This is a project with similar goals to QBFC-Ruby. I believe the approach is creating Ruby classes that mirror the QuickBooks types and generate / parse qbXML. In my opinion, this approach is more stable and flexible than what I'm doing with QBFC-Ruby, but at the cost of slower development. (As in, QBFC-Ruby was intended as a collection of quick and dirty shortcuts; QuickBooks for Ruby seems to be intended as a much more complete project)

QBFC/qbXML COM Objects

Using the SDK directly is an option. Unless you need to use QBWC (QuickBooks Web Connector) or have some other reason for wanting to us qbXML, I suggest using QBFC. The SDK documents (see ) are pretty easy to use and navigate.

There are some other libraries on rubyforge in early stages which I haven't really explored.

Copyright © 2008 Jared E. Morgan, released under the MIT license