The modern Ruby QuickBooks client Part 2
Regards ♨ – Minimul
"Real world" fixtures
The qbo_api gem's specs were built against an official QuickBooks sandbox and then recorded using the VCR gem. Therefore, you have a fantastically quick way to get started with your integration project in that you can see "real world" QBO API transaction without your own sandbox or even a network connection. Allow me to demonstrate.
- Clone the
qbo_apigem, switch into the new directory, and
- Create a .env file If you are just running the specs then at minimum your .env needs to look like the following:
- Now you can run the specs by doing a
bundle exec rspec spec/
- Let's open up the
- Then go to the first spec where abouts the VCR cassette is being recorded.
credsmethod is defined in the
- Before the initialize set
QboApi.log = trueand run the individual spec.
- Now let's mess around with the response by outputing the invoice's customer name
- Next, open up the
spec/error_spec.rband goto the spec titled "handles a validation error".
$ git clone git://github.com/minimul/qbo_api && cd qbo_api $ bundle
export QBO_API_CONSUMER_KEY= export QBO_API_CONSUMER_SECRET= export QBO_API_ACCESS_TOKEN= export QBO_API_ACCESS_TOKEN_SECRET= export QBO_API_COMPANY_ID=12345
If you want to see an example of an advanced VCR custom matcher keep
spec/spec_helper.rb file. The purpose of the
matcher is to make VCR more lenient so that any QuickBooks sandbox can be used.
When getting started with a QuickBooks integration project using the
qbo_api gem leverage the "real world" recorded specs to help you get started quickly.