With qbwc_requests you have an easy way to create Qbxml requests.
Add this line to your application's Gemfile:
gem 'qbwc_requests'
And then execute:
$ bundle
Or install it yourself as:
$ gem install qbwc_requests
AccountQbxml::Query.factory({max_returned: 2000}).to_xml("request_id")
result
<?xml version="1.0" encoding="ISO-8859-1"?>
<?qbxml version="7.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<AccountQueryRq requestID="request_id">
<MaxReturned>2000</MaxReturned>
</AccountQueryRq>
</QBXMLMsgsRq>
</QBXML>
That will create an Account query for the qbxml version 7.0
AccountQbxml::Add.factory(name: 'Some Account name').to_xml("2")
Result
<?xml version="1.0" encoding="ISO-8859-1"?>
<?qbxml version="7.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<AccountAddRq requestID="2">
<AccountAdd>
<Name>Some Account name</Name>
</AccountAdd>
</AccountAddRq>
</QBXMLMsgsRq>
</QBXML>
That will create an account xml add requisition. Note that name is mandatory in order to create an Account. If no name is provided, the result will be a hash of errors.
You can also call valid? on the object to check if the object is valid.
Not Implemented
VendorQbxml::Mod.factory({name: "Vendor Name"}).to_xml("request_id")
<?xml version="1.0" encoding="ISO-8859-1"?>
<?qbxml version="7.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<VendorModRq requestID="request_id">
<VendorMod>
<Name>Vendor Name</Name>
</VendorMod>
</VendorModRq>
</QBXMLMsgsRq>
</QBXML>
You can use diferent versions of versions of the QBXML in two ways.
- Extra Parameter
VendorQbxml::Mod.factory({name: "Vendor Name"}, "13").to_xml("request_id")
- General Configuration
QbwcRequests.QBXML_VERSION = "13"
VendorQbxml::Mod.factory({name: "Vendor Name"}).to_xml("request_id")
Right now we just have the following models on this gem.
- Customers
- Jobs
- Account
- Items
- Discount Item
- Non Inventory Item
- Other Charge Item
- Payment Item
- Service Item
- Subtotal Item
- Group Item
- Vendors
- Purchase Orders
- Invoices
- Estimates
The Qbxml version for this models is the 7.0
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request