github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

zackchandler / acts_as_quickbooks_model

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 16
    • 6
  • Source
  • Commits
  • Network (6)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Simplying working with models that rely on parsing QuickBooks SDK qbXML messages — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

convert " html entity back to " 
Zack Chandler (author)
Tue Feb 02 11:45:30 -0800 2010
commit  2b3dc2b5e572120ce87d71c592bceb3dab076774
tree    580bf67903c6e3678e4c930f524704fa102193ae
parent  b7c276aca5b4eb74770c8b04a64a30a6aee87ed8
acts_as_quickbooks_model /
name age
history
message
file .gitignore Sat May 17 12:36:03 -0700 2008 tests, auto-build has_many associations [zackchandler]
file README.markdown Thu Jan 28 13:46:05 -0800 2010 add Ruby 1.9.1 support [Zack Chandler]
file Rakefile Fri May 02 00:03:32 -0700 2008 add auto-generated note, qb:all rake task [zackchandler]
directory definitions/ Fri Feb 13 12:04:18 -0800 2009 Add SalesTaxCode definitions [zackchandler]
file init.rb Thu May 01 15:35:26 -0700 2008 first commit [zackchandler]
directory lib/ Tue Feb 02 11:45:30 -0800 2010 convert " html entity back to " [Zack Chandler]
directory migrations/ Fri Feb 13 12:04:18 -0800 2009 Add SalesTaxCode definitions [zackchandler]
directory model_maps/ Fri Feb 13 12:04:18 -0800 2009 Add SalesTaxCode definitions [zackchandler]
directory test/ Loading commit data...
README.markdown

Introduction

This plugin simplifies the parsing of qbXML messages into ActiveRecord model attributes.

Usage

class Customer < ActiveRecord::Base
  acts_as_quickbooks_model
end

xml = <<-XML
<CustomerRet>
  <ListID>150000-933272658</ListID>
  <Name>Abercrombie, Kristy</Name>
  <BillAddress>
    <Addr1>Kristy Abercrombie</Addr1>
    <Addr2>5647 Cypress Hill Rd</Addr2>
    <City>Bayshore</City>
    <State>CA</State>
    <PostalCode>94326</PostalCode>
  </BillAddress>
</CustomerRet>
XML

customer = Customer.new(:qbxml => xml)
customer.list_id # => "150000-933272658"
customer.name # => "Abercrombie, Kristy"
customer.bill_address_city # => "Bayshore"
...

Auto-builds has_many associations

class Invoice < ActiveRecord::Base
  acts_as_quickbooks_model
  has_many :invoice_lines
  has_many :invoice_line_groups
end
class InvoiceLine < ActiveRecord::Base
  acts_as_quickbooks_model
  belongs_to :invoice
end
class InvoiceLineGroup < ActiveRecord::Base
  acts_as_quickbooks_model
  belongs_to :invoice
end

xml = <<-XML
<InvoiceRet>
  <TxnID>123</TxnID>
  <InvoiceLineRet>
    <TxnLineID>456</TxnLineID>
    <ItemRef>
      <ListID>789</ListID>
    </ItemRef>
  </InvoiceLineRet>
  <InvoiceLineRet>
    <TxnLineID>012</TxnLineID>
    <ItemRef>
      <ListID>567</ListID>
    </ItemRef>
  </InvoiceLineRet>
  <InvoiceLineGroupRet>
    <TxnLineID>321</TxnLineID>
    <ItemGroupRef>
      <ListID>987</ListID>
    </ItemGroupRef>
  </InvoiceLineGroupRet>
</InvoiceRet>
XML

invoice = Invoice.create(:qbxml => xml)
invoice.txn_id # => "123"
invoice.invoice_lines.count # => 2
invoice.invoice_line_groups.count # => 1
invoice.invoice_lines.first.txn_line_id # => "456"
invoice.invoice_line_groups.first.txn_line_id # => "321"
...

Tested Ruby Versions

  • 1.8.6
  • 1.8.7
  • 1.9.1

References

QuickBooks SDK Reference

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server