quickbooks 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +1 -1
- data/Rakefile +4 -2
- data/doc/classes/Array.html +333 -40
- data/doc/classes/Array.src/M000037.html +18 -0
- data/doc/classes/Array.src/M000038.html +21 -0
- data/doc/classes/Array.src/M000039.html +18 -0
- data/doc/classes/Array.src/M000040.html +19 -0
- data/doc/classes/Array.src/M000041.html +18 -0
- data/doc/classes/Array.src/{M000004.html → M000042.html} +1 -1
- data/doc/classes/Array.src/M000043.html +18 -0
- data/doc/classes/Array.src/M000044.html +18 -0
- data/doc/classes/Array.src/{M000001.html → M000045.html} +1 -1
- data/doc/classes/Array.src/{M000002.html → M000046.html} +1 -1
- data/doc/classes/Array.src/{M000003.html → M000047.html} +1 -1
- data/doc/classes/Array.src/M000048.html +23 -0
- data/doc/classes/Array.src/{M000005.html → M000049.html} +1 -1
- data/doc/classes/Array.src/{M000006.html → M000050.html} +2 -2
- data/doc/classes/Array.src/{M000007.html → M000051.html} +1 -1
- data/doc/classes/Array.src/{M000008.html → M000052.html} +1 -1
- data/doc/classes/Array.src/M000053.html +18 -0
- data/doc/classes/Array.src/M000054.html +20 -0
- data/doc/classes/Array.src/M000055.html +18 -0
- data/doc/classes/Array.src/M000056.html +34 -0
- data/doc/classes/Array.src/M000057.html +19 -0
- data/doc/classes/Array.src/M000058.html +29 -0
- data/doc/classes/Array.src/M000059.html +18 -0
- data/doc/classes/Array.src/M000060.html +20 -0
- data/doc/classes/Array.src/M000061.html +18 -0
- data/doc/classes/Array.src/M000062.html +18 -0
- data/doc/classes/Array.src/M000063.html +19 -0
- data/doc/classes/Class.html +25 -6
- data/doc/classes/Class.src/M000075.html +18 -0
- data/doc/classes/Class.src/M000076.html +18 -0
- data/doc/classes/Hash.html +329 -103
- data/doc/classes/Hash.src/M000004.html +18 -0
- data/doc/classes/Hash.src/M000005.html +21 -0
- data/doc/classes/Hash.src/M000006.html +18 -0
- data/doc/classes/Hash.src/M000007.html +21 -0
- data/doc/classes/Hash.src/M000008.html +18 -0
- data/doc/classes/Hash.src/M000009.html +6 -4
- data/doc/classes/Hash.src/M000010.html +4 -7
- data/doc/classes/Hash.src/M000011.html +8 -4
- data/doc/classes/Hash.src/M000012.html +4 -7
- data/doc/classes/Hash.src/M000013.html +7 -4
- data/doc/classes/Hash.src/M000014.html +4 -7
- data/doc/classes/Hash.src/M000015.html +6 -12
- data/doc/classes/Hash.src/M000016.html +4 -6
- data/doc/classes/Hash.src/M000017.html +7 -4
- data/doc/classes/Hash.src/M000018.html +4 -6
- data/doc/classes/Hash.src/M000019.html +5 -22
- data/doc/classes/Hash.src/M000020.html +14 -5
- data/doc/classes/Hash.src/M000021.html +7 -5
- data/doc/classes/Hash.src/M000022.html +5 -7
- data/doc/classes/Hash.src/M000023.html +7 -5
- data/doc/classes/Hash.src/M000024.html +5 -5
- data/doc/classes/Hash.src/M000025.html +4 -4
- data/doc/classes/Hash.src/M000026.html +4 -8
- data/doc/classes/Hash.src/M000027.html +22 -0
- data/doc/classes/Hash.src/M000028.html +18 -0
- data/doc/classes/Hash.src/M000029.html +20 -0
- data/doc/classes/Hash.src/M000030.html +18 -0
- data/doc/classes/Hash.src/M000031.html +30 -0
- data/doc/classes/Hash.src/M000032.html +19 -0
- data/doc/classes/Hash.src/M000033.html +19 -0
- data/doc/classes/Hash.src/M000034.html +18 -0
- data/doc/classes/Hash.src/M000035.html +18 -0
- data/doc/classes/Hash.src/M000036.html +21 -0
- data/doc/classes/Object.html +75 -39
- data/doc/classes/Object.src/M000077.html +24 -0
- data/doc/classes/Object.src/M000078.html +19 -0
- data/doc/classes/Object.src/{M000028.html → M000079.html} +1 -1
- data/doc/classes/Object.src/{M000029.html → M000080.html} +1 -1
- data/doc/classes/Object.src/{M000030.html → M000081.html} +1 -1
- data/doc/classes/Object.src/{M000031.html → M000082.html} +1 -1
- data/doc/classes/Object.src/{M000032.html → M000083.html} +1 -1
- data/doc/classes/Object.src/{M000033.html → M000084.html} +2 -2
- data/doc/classes/OrderedArray.html +178 -0
- data/doc/classes/OrderedArray.src/M000001.html +18 -0
- data/doc/classes/OrderedArray.src/M000002.html +18 -0
- data/doc/classes/OrderedArray.src/M000003.html +18 -0
- data/doc/classes/OrderedHash.html +324 -0
- data/doc/classes/OrderedHash.src/M000064.html +19 -0
- data/doc/classes/OrderedHash.src/M000065.html +18 -0
- data/doc/classes/OrderedHash.src/M000066.html +18 -0
- data/doc/classes/OrderedHash.src/M000067.html +18 -0
- data/doc/classes/OrderedHash.src/M000068.html +18 -0
- data/doc/classes/OrderedHash.src/M000069.html +18 -0
- data/doc/classes/OrderedHash.src/M000070.html +20 -0
- data/doc/classes/OrderedHash.src/M000071.html +18 -0
- data/doc/classes/OrderedHash.src/M000072.html +18 -0
- data/doc/classes/OrderedHash.src/M000073.html +19 -0
- data/doc/classes/OrderedHash.src/M000074.html +24 -0
- data/doc/classes/{Quickbooks/Qbxml.html → Qbxml.html} +11 -13
- data/doc/classes/{Quickbooks/Qbxml → Qbxml}/Request.html +32 -22
- data/doc/classes/Qbxml/Request.src/M000184.html +65 -0
- data/doc/classes/Qbxml/Request.src/M000185.html +19 -0
- data/doc/classes/Qbxml/Request.src/M000186.html +83 -0
- data/doc/classes/{Quickbooks/Qbxml → Qbxml}/RequestSet.html +32 -26
- data/doc/classes/{Quickbooks/Connection.src/M000104.html → Qbxml/RequestSet.src/M000187.html} +7 -5
- data/doc/classes/Qbxml/RequestSet.src/M000188.html +26 -0
- data/doc/classes/Qbxml/RequestSet.src/M000189.html +18 -0
- data/doc/classes/Qbxml/RequestSet.src/M000190.html +22 -0
- data/doc/classes/{Quickbooks/Qbxml → Qbxml}/Response.html +51 -51
- data/doc/classes/Qbxml/Response.src/M000175.html +24 -0
- data/doc/classes/Qbxml/Response.src/M000176.html +19 -0
- data/doc/classes/Qbxml/Response.src/M000177.html +55 -0
- data/doc/classes/{Quickbooks/Connection.src/M000097.html → Qbxml/Response.src/M000178.html} +4 -4
- data/doc/classes/Qbxml/Response.src/M000179.html +18 -0
- data/doc/classes/Qbxml/Response.src/M000180.html +18 -0
- data/doc/classes/{Quickbooks/Connection.src/M000100.html → Qbxml/Response.src/M000181.html} +4 -4
- data/doc/classes/{Quickbooks/Connection.src/M000101.html → Qbxml/Response.src/M000182.html} +4 -4
- data/doc/classes/Qbxml/Response.src/M000183.html +63 -0
- data/doc/classes/{Quickbooks/Qbxml → Qbxml}/ResponseSet.html +47 -41
- data/doc/classes/Qbxml/ResponseSet.src/M000168.html +22 -0
- data/doc/classes/Qbxml/ResponseSet.src/M000169.html +26 -0
- data/doc/classes/Qbxml/ResponseSet.src/M000170.html +24 -0
- data/doc/classes/Qbxml/ResponseSet.src/M000171.html +20 -0
- data/doc/classes/Qbxml/ResponseSet.src/M000172.html +27 -0
- data/doc/classes/Qbxml/ResponseSet.src/M000173.html +18 -0
- data/doc/classes/Qbxml/ResponseSet.src/M000174.html +18 -0
- data/doc/classes/Quickbooks.html +24 -10
- data/doc/classes/Quickbooks/Address.html +5 -5
- data/doc/classes/Quickbooks/Address.src/{M000107.html → M000150.html} +0 -0
- data/doc/classes/Quickbooks/Base.html +133 -120
- data/doc/classes/Quickbooks/Base.src/{M000080.html → M000131.html} +1 -1
- data/doc/classes/Quickbooks/Base.src/M000132.html +20 -0
- data/doc/classes/Quickbooks/Base.src/M000133.html +19 -0
- data/doc/classes/Quickbooks/Base.src/{M000082.html → M000134.html} +1 -1
- data/doc/classes/Quickbooks/Base.src/{M000083.html → M000135.html} +2 -2
- data/doc/classes/Quickbooks/Base.src/M000136.html +30 -0
- data/doc/classes/Quickbooks/Base.src/{M000085.html → M000137.html} +1 -1
- data/doc/classes/Quickbooks/Base.src/{M000086.html → M000138.html} +2 -2
- data/doc/classes/Quickbooks/Base.src/{M000087.html → M000139.html} +2 -2
- data/doc/classes/Quickbooks/Base.src/{M000088.html → M000140.html} +2 -2
- data/doc/classes/Quickbooks/Base.src/{M000089.html → M000141.html} +1 -1
- data/doc/classes/Quickbooks/Base.src/{M000090.html → M000142.html} +1 -1
- data/doc/classes/Quickbooks/Base.src/{M000091.html → M000143.html} +1 -1
- data/doc/classes/Quickbooks/Base.src/{M000092.html → M000144.html} +3 -3
- data/doc/classes/Quickbooks/Base.src/{M000093.html → M000145.html} +2 -2
- data/doc/classes/Quickbooks/Base.src/{M000094.html → M000146.html} +2 -2
- data/doc/classes/Quickbooks/Base.src/{M000095.html → M000147.html} +1 -1
- data/doc/classes/Quickbooks/{Qbxml/ResponseSetArrayExt.html → Deleted.html} +14 -6
- data/doc/classes/Quickbooks/ListDeleted.html +139 -0
- data/doc/classes/Quickbooks/ListDeleted.src/M000149.html +18 -0
- data/doc/classes/Quickbooks/ListItem.html +11 -11
- data/doc/classes/Quickbooks/ListItem.src/M000129.html +19 -0
- data/doc/classes/Quickbooks/ListItem.src/{M000079.html → M000130.html} +4 -4
- data/doc/classes/Quickbooks/Model.html +110 -110
- data/doc/classes/Quickbooks/Model.src/{M000059.html → M000109.html} +4 -3
- data/doc/classes/Quickbooks/Model.src/{M000060.html → M000110.html} +2 -2
- data/doc/classes/Quickbooks/Model.src/{M000061.html → M000111.html} +2 -2
- data/doc/classes/Quickbooks/Model.src/{M000062.html → M000112.html} +3 -2
- data/doc/classes/Quickbooks/Model.src/{M000063.html → M000113.html} +1 -1
- data/doc/classes/Quickbooks/Model.src/M000114.html +22 -0
- data/doc/classes/Quickbooks/Model.src/{M000065.html → M000115.html} +2 -2
- data/doc/classes/Quickbooks/Model.src/{M000066.html → M000116.html} +2 -2
- data/doc/classes/Quickbooks/Model.src/{M000067.html → M000117.html} +1 -1
- data/doc/classes/Quickbooks/Model.src/{M000068.html → M000118.html} +1 -1
- data/doc/classes/Quickbooks/Model.src/{M000069.html → M000119.html} +1 -1
- data/doc/classes/Quickbooks/Model.src/{M000070.html → M000120.html} +1 -1
- data/doc/classes/Quickbooks/Model.src/{M000071.html → M000121.html} +1 -1
- data/doc/classes/Quickbooks/Model.src/{M000072.html → M000122.html} +1 -1
- data/doc/classes/Quickbooks/Model.src/{M000073.html → M000123.html} +2 -2
- data/doc/classes/Quickbooks/Model.src/{M000074.html → M000124.html} +3 -3
- data/doc/classes/Quickbooks/Model.src/{M000075.html → M000125.html} +3 -3
- data/doc/classes/Quickbooks/Model.src/{M000076.html → M000126.html} +1 -1
- data/doc/classes/Quickbooks/Model.src/{M000077.html → M000127.html} +1 -1
- data/doc/classes/{QBHelpers.html → Quickbooks/OleAdapter.html} +19 -9
- data/doc/classes/Quickbooks/{Connection.html → OleAdapter/Connection.html} +80 -106
- data/doc/classes/Quickbooks/{Qbxml/Response.src/M000044.html → OleAdapter/Connection.src/M000094.html} +4 -4
- data/doc/classes/Quickbooks/OleAdapter/Connection.src/M000095.html +19 -0
- data/doc/classes/Quickbooks/OleAdapter/Connection.src/M000096.html +24 -0
- data/doc/classes/Quickbooks/{Qbxml/Response.src/M000047.html → OleAdapter/Connection.src/M000097.html} +4 -4
- data/doc/classes/Quickbooks/{Qbxml/Response.src/M000048.html → OleAdapter/Connection.src/M000098.html} +4 -4
- data/doc/classes/Quickbooks/OleAdapter/Connection.src/M000099.html +21 -0
- data/doc/classes/Quickbooks/OleAdapter/Connection.src/M000100.html +24 -0
- data/doc/classes/Quickbooks/OleAdapter/Connection.src/M000101.html +20 -0
- data/doc/classes/Quickbooks/OleAdapter/Connection.src/M000102.html +24 -0
- data/doc/classes/Quickbooks/OleAdapter/Connection.src/M000103.html +24 -0
- data/doc/classes/{QBHelpers → Quickbooks/OleAdapter}/Ole.html +24 -24
- data/doc/classes/Quickbooks/OleAdapter/Ole.src/M000104.html +21 -0
- data/doc/classes/Quickbooks/OleAdapter/Ole.src/M000105.html +22 -0
- data/doc/classes/Quickbooks/OleAdapter/Ole.src/M000106.html +18 -0
- data/doc/classes/Quickbooks/{Qbxml/RequestSetArrayExt.html → QbxmlDebugAdapter.html} +11 -5
- data/doc/classes/Quickbooks/QbxmlDebugAdapter/Connection.html +139 -0
- data/doc/classes/Quickbooks/{Qbxml/RequestSet.src/M000055.html → QbxmlDebugAdapter/Connection.src/M000093.html} +4 -4
- data/doc/classes/Quickbooks/Ref.html +5 -5
- data/doc/classes/Quickbooks/Ref.src/{M000096.html → M000148.html} +0 -0
- data/doc/classes/Quickbooks/Transaction.html +10 -10
- data/doc/classes/Quickbooks/Transaction.src/{M000057.html → M000107.html} +0 -0
- data/doc/classes/Quickbooks/Transaction.src/{M000058.html → M000108.html} +0 -0
- data/doc/classes/Quickbooks/TxnDeleted.html +139 -0
- data/doc/classes/Quickbooks/TxnDeleted.src/M000128.html +18 -0
- data/doc/classes/SlashedArray.html +226 -0
- data/doc/classes/SlashedArray.src/M000161.html +23 -0
- data/doc/classes/SlashedArray.src/M000162.html +18 -0
- data/doc/classes/SlashedArray.src/M000163.html +18 -0
- data/doc/classes/SlashedArray.src/M000164.html +22 -0
- data/doc/classes/SlashedArray.src/M000165.html +22 -0
- data/doc/classes/SlashedArray.src/M000166.html +18 -0
- data/doc/classes/SlashedArray.src/M000167.html +22 -0
- data/doc/classes/SlashedHash.html +193 -0
- data/doc/classes/SlashedHash.src/M000156.html +22 -0
- data/doc/classes/SlashedHash.src/M000157.html +18 -0
- data/doc/classes/SlashedHash.src/M000158.html +18 -0
- data/doc/classes/SlashedHash.src/M000159.html +27 -0
- data/doc/classes/SlashedHash.src/M000160.html +22 -0
- data/doc/classes/String.html +269 -0
- data/doc/classes/String.src/M000085.html +18 -0
- data/doc/classes/String.src/M000086.html +18 -0
- data/doc/classes/String.src/M000087.html +18 -0
- data/doc/classes/String.src/M000088.html +18 -0
- data/doc/classes/String.src/M000089.html +18 -0
- data/doc/classes/String.src/M000090.html +18 -0
- data/doc/classes/String.src/M000091.html +18 -0
- data/doc/classes/String.src/M000092.html +97 -0
- data/doc/classes/UniqueArray.html +193 -0
- data/doc/classes/UniqueArray.src/M000151.html +25 -0
- data/doc/classes/UniqueArray.src/M000152.html +18 -0
- data/doc/classes/UniqueArray.src/M000153.html +20 -0
- data/doc/classes/UniqueArray.src/M000154.html +20 -0
- data/doc/classes/UniqueArray.src/M000155.html +20 -0
- data/doc/created.rid +1 -1
- data/doc/files/LICENSE.html +2 -2
- data/doc/files/lib/{quickbooks/connection_rb.html → qbxml/request_rb.html} +6 -6
- data/doc/files/lib/{quickbooks/qbxml_rb.html → qbxml/response_rb.html} +6 -6
- data/doc/files/lib/{quickbooks/qbxml/request_rb.html → qbxml/support_rb.html} +6 -7
- data/doc/files/lib/qbxml_rb.html +109 -0
- data/doc/files/lib/quickbooks/{qbxml/response_rb.html → adapters/ole_adapter_rb.html} +5 -5
- data/doc/files/lib/quickbooks/adapters/qbxml_debug_adapter_rb.html +108 -0
- data/doc/files/lib/quickbooks/base_rb.html +2 -4
- data/doc/files/lib/quickbooks/model_rb.html +2 -1
- data/doc/files/lib/quickbooks/models/customer_rb.html +1 -1
- data/doc/files/lib/quickbooks/models/deleted_rb.html +101 -0
- data/doc/files/lib/quickbooks/models/list_item_rb.html +1 -1
- data/doc/files/lib/quickbooks/ruby_magic_rb.html +9 -1
- data/doc/files/lib/quickbooks/{ole_helper_rb.html → structure_rb.html} +20 -7
- data/doc/files/lib/quickbooks_rb.html +2 -3
- data/doc/fr_class_index.html +19 -10
- data/doc/fr_file_index.html +8 -5
- data/doc/fr_method_index.html +190 -110
- data/lib/qbxml.rb +2 -0
- data/lib/qbxml/request.rb +205 -0
- data/lib/qbxml/response.rb +197 -0
- data/lib/qbxml/support.rb +130 -0
- data/lib/quickbooks.rb +1 -2
- data/lib/quickbooks/adapters/ole_adapter.rb +148 -0
- data/lib/quickbooks/adapters/qbxml_debug_adapter.rb +10 -0
- data/lib/quickbooks/base.rb +33 -24
- data/lib/quickbooks/model.rb +20 -13
- data/lib/quickbooks/models/customer.rb +1 -1
- data/lib/quickbooks/models/deleted.rb +22 -0
- data/lib/quickbooks/models/list_item.rb +29 -27
- data/lib/quickbooks/ruby_magic.rb +31 -28
- data/lib/quickbooks/structure.rb +393 -0
- metadata +242 -127
- data/doc/classes/Class.src/M000027.html +0 -18
- data/doc/classes/QBHelpers/Ole.src/M000108.html +0 -21
- data/doc/classes/QBHelpers/Ole.src/M000109.html +0 -22
- data/doc/classes/QBHelpers/Ole.src/M000110.html +0 -18
- data/doc/classes/Quickbooks/Base.src/M000081.html +0 -18
- data/doc/classes/Quickbooks/Base.src/M000084.html +0 -23
- data/doc/classes/Quickbooks/Connection.src/M000098.html +0 -19
- data/doc/classes/Quickbooks/Connection.src/M000099.html +0 -24
- data/doc/classes/Quickbooks/Connection.src/M000102.html +0 -21
- data/doc/classes/Quickbooks/Connection.src/M000103.html +0 -24
- data/doc/classes/Quickbooks/Connection.src/M000105.html +0 -24
- data/doc/classes/Quickbooks/Connection.src/M000106.html +0 -24
- data/doc/classes/Quickbooks/ListItem.src/M000078.html +0 -19
- data/doc/classes/Quickbooks/Model.src/M000064.html +0 -18
- data/doc/classes/Quickbooks/Qbxml/Request.src/M000050.html +0 -34
- data/doc/classes/Quickbooks/Qbxml/Request.src/M000051.html +0 -19
- data/doc/classes/Quickbooks/Qbxml/Request.src/M000052.html +0 -81
- data/doc/classes/Quickbooks/Qbxml/RequestSet.src/M000053.html +0 -22
- data/doc/classes/Quickbooks/Qbxml/RequestSet.src/M000054.html +0 -26
- data/doc/classes/Quickbooks/Qbxml/RequestSet.src/M000056.html +0 -22
- data/doc/classes/Quickbooks/Qbxml/Response.src/M000041.html +0 -24
- data/doc/classes/Quickbooks/Qbxml/Response.src/M000042.html +0 -19
- data/doc/classes/Quickbooks/Qbxml/Response.src/M000043.html +0 -44
- data/doc/classes/Quickbooks/Qbxml/Response.src/M000045.html +0 -18
- data/doc/classes/Quickbooks/Qbxml/Response.src/M000046.html +0 -18
- data/doc/classes/Quickbooks/Qbxml/Response.src/M000049.html +0 -63
- data/doc/classes/Quickbooks/Qbxml/ResponseSet.src/M000034.html +0 -22
- data/doc/classes/Quickbooks/Qbxml/ResponseSet.src/M000035.html +0 -26
- data/doc/classes/Quickbooks/Qbxml/ResponseSet.src/M000036.html +0 -24
- data/doc/classes/Quickbooks/Qbxml/ResponseSet.src/M000037.html +0 -18
- data/doc/classes/Quickbooks/Qbxml/ResponseSet.src/M000038.html +0 -27
- data/doc/classes/Quickbooks/Qbxml/ResponseSet.src/M000039.html +0 -18
- data/doc/classes/Quickbooks/Qbxml/ResponseSet.src/M000040.html +0 -18
- data/lib/quickbooks/connection.rb +0 -105
- data/lib/quickbooks/ole_helper.rb +0 -47
- data/lib/quickbooks/qbxml.rb +0 -2
- data/lib/quickbooks/qbxml/request.rb +0 -169
- data/lib/quickbooks/qbxml/response.rb +0 -185
@@ -1,22 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>set (Quickbooks::Qbxml::RequestSet)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/quickbooks/qbxml/request.rb, line 9</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set</span>
|
15
|
-
<span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@set</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>)
|
16
|
-
<span class="ruby-ivar">@set</span> = []
|
17
|
-
<span class="ruby-ivar">@set</span>.<span class="ruby-identifier">extend</span>(<span class="ruby-constant">Quickbooks</span><span class="ruby-operator">::</span><span class="ruby-constant">Qbxml</span><span class="ruby-operator">::</span><span class="ruby-constant">RequestSetArrayExt</span>)
|
18
|
-
<span class="ruby-keyword kw">end</span>
|
19
|
-
<span class="ruby-ivar">@set</span>
|
20
|
-
<span class="ruby-keyword kw">end</span></pre>
|
21
|
-
</body>
|
22
|
-
</html>
|
@@ -1,26 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title><< (Quickbooks::Qbxml::RequestSet)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/quickbooks/qbxml/request.rb, line 17</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-operator"><<</span>(<span class="ruby-identifier">qbxml_request</span>)
|
15
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">qbxml_request</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Quickbooks</span><span class="ruby-operator">::</span><span class="ruby-constant">Qbxml</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>)
|
16
|
-
<span class="ruby-identifier">set</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">qbxml_request</span>
|
17
|
-
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">qbxml_request</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:each</span>)
|
18
|
-
<span class="ruby-identifier">qbxml_request</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">request</span><span class="ruby-operator">|</span>
|
19
|
-
<span class="ruby-keyword kw">self</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">request</span>
|
20
|
-
<span class="ruby-keyword kw">end</span>
|
21
|
-
<span class="ruby-keyword kw">else</span>
|
22
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">"Cannot add object of type #{qbxml_request.class.name} to a Quickbooks::Qbxml::RequestSet"</span>
|
23
|
-
<span class="ruby-keyword kw">end</span>
|
24
|
-
<span class="ruby-keyword kw">end</span></pre>
|
25
|
-
</body>
|
26
|
-
</html>
|
@@ -1,22 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>to_xml (Quickbooks::Qbxml::RequestSet)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/quickbooks/qbxml/request.rb, line 33</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_xml</span>
|
15
|
-
<span class="ruby-identifier">pre</span> = <span class="ruby-value str">"<?xml version=\"1.0\" ?>\n<?qbxml version=\"\#{Quickbooks::Qbxml::VERSION}\" ?>\n<QBXML>\n<QBXMLMsgsRq onError=\"stopOnError\">\n"</span>
|
16
|
-
<span class="ruby-identifier">requests</span> = <span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">to_xml</span>(<span class="ruby-keyword kw">false</span>)}.<span class="ruby-identifier">join</span>
|
17
|
-
<span class="ruby-identifier">post</span> = <span class="ruby-value str">"</QBXMLMsgsRq>\n</QBXML>\n"</span>
|
18
|
-
<span class="ruby-comment cmt"># puts pre + requests + post</span>
|
19
|
-
<span class="ruby-identifier">pre</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">requests</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">post</span>
|
20
|
-
<span class="ruby-keyword kw">end</span></pre>
|
21
|
-
</body>
|
22
|
-
</html>
|
@@ -1,24 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>new (Quickbooks::Qbxml::Response)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/quickbooks/qbxml/response.rb, line 68</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">xml_or_hash</span>)
|
15
|
-
<span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">xml_or_hash</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>))
|
16
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">import_from_hash</span>(<span class="ruby-identifier">xml_or_hash</span>)
|
17
|
-
<span class="ruby-keyword kw">elsif</span>(<span class="ruby-identifier">xml_or_hash</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>))
|
18
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">import_from_xml</span>(<span class="ruby-identifier">xml_or_hash</span>)
|
19
|
-
<span class="ruby-keyword kw">else</span>
|
20
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"Quickbooks::Qbxml::ResponseSet must be initialized with either a Hash or an xml-formatted String."</span>
|
21
|
-
<span class="ruby-keyword kw">end</span>
|
22
|
-
<span class="ruby-keyword kw">end</span></pre>
|
23
|
-
</body>
|
24
|
-
</html>
|
@@ -1,19 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>import_from_xml (Quickbooks::Qbxml::Response)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/quickbooks/qbxml/response.rb, line 78</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">import_from_xml</span>(<span class="ruby-identifier">xml</span>)
|
15
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">import_from_hash</span>(<span class="ruby-constant">Hash</span>.<span class="ruby-identifier">from_xml</span>(<span class="ruby-identifier">xml</span>))
|
16
|
-
<span class="ruby-keyword kw">self</span>
|
17
|
-
<span class="ruby-keyword kw">end</span></pre>
|
18
|
-
</body>
|
19
|
-
</html>
|
@@ -1,44 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>import_from_hash (Quickbooks::Qbxml::Response)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/quickbooks/qbxml/response.rb, line 82</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">import_from_hash</span>(<span class="ruby-identifier">hsh</span>)
|
15
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"Hash passed to Quickbooks::Qbxml::Response.from_hash must contain only one top-level key"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">hsh</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
|
16
|
-
<span class="ruby-identifier">name</span> = <span class="ruby-identifier">hsh</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">first</span>
|
17
|
-
<span class="ruby-comment cmt"># for development</span>
|
18
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">raw_response</span> = <span class="ruby-identifier">hsh</span>
|
19
|
-
<span class="ruby-comment cmt"># * * * *</span>
|
20
|
-
<span class="ruby-identifier">hsh</span> = <span class="ruby-identifier">hsh</span>[<span class="ruby-identifier">name</span>]
|
21
|
-
|
22
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">status</span> = <span class="ruby-identifier">hsh</span>[<span class="ruby-value str">'statusCode'</span>].<span class="ruby-identifier">to_i</span>
|
23
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">severity</span> = <span class="ruby-identifier">hsh</span>[<span class="ruby-value str">'statusSeverity'</span>]
|
24
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">message</span> = <span class="ruby-identifier">hsh</span>[<span class="ruby-value str">'statusMessage'</span>]
|
25
|
-
<span class="ruby-comment cmt"># if self.status == 0 # Status is good, proceed with eating the request.</span>
|
26
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">m</span> = <span class="ruby-identifier">name</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp re">/^(List|Txn)Del(etedQuery)?Rs$/</span>)
|
27
|
-
<span class="ruby-comment cmt"># (List|Txn)DelRs, or (List|Txn)DeletedQueryRs - both return just a few attributes, like ListID / TxnID and TimeDeleted</span>
|
28
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">response_type</span> = <span class="ruby-identifier">hsh</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">m</span>[<span class="ruby-value">1</span>]<span class="ruby-operator">+</span><span class="ruby-value str">'DelType'</span>)
|
29
|
-
<span class="ruby-comment cmt"># self.ret_items = ResponseObject.new(self.response_type, hsh.dup)</span>
|
30
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">ret_items</span> = <span class="ruby-identifier">hsh</span>.<span class="ruby-identifier">dup</span>
|
31
|
-
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">m</span> = <span class="ruby-identifier">name</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp re">/^([A-Za-z][a-z]+)(Query|Mod|Add)Rs$/</span>)
|
32
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">response_type</span> = <span class="ruby-identifier">m</span>[<span class="ruby-value">1</span>]
|
33
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">ret_items</span> = <span class="ruby-identifier">hsh</span>[<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">response_type</span><span class="ruby-operator">+</span><span class="ruby-value str">'Ret'</span>]
|
34
|
-
<span class="ruby-keyword kw">else</span>
|
35
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-node">"Could not read this response:\n#{self.raw_response.inspect}"</span>
|
36
|
-
<span class="ruby-keyword kw">end</span>
|
37
|
-
<span class="ruby-comment cmt"># else # Status is bad.</span>
|
38
|
-
|
39
|
-
<span class="ruby-comment cmt"># end</span>
|
40
|
-
<span class="ruby-comment cmt"># puts self.inspect</span>
|
41
|
-
<span class="ruby-keyword kw">self</span>
|
42
|
-
<span class="ruby-keyword kw">end</span></pre>
|
43
|
-
</body>
|
44
|
-
</html>
|
@@ -1,18 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>from_hash (Quickbooks::Qbxml::Response)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/quickbooks/qbxml/response.rb, line 117</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">from_hash</span>(<span class="ruby-identifier">hsh</span>)
|
15
|
-
<span class="ruby-identifier">new</span>.<span class="ruby-identifier">import_from_hash</span>(<span class="ruby-identifier">hsh</span>)
|
16
|
-
<span class="ruby-keyword kw">end</span></pre>
|
17
|
-
</body>
|
18
|
-
</html>
|
@@ -1,18 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>instantiatable? (Quickbooks::Qbxml::Response)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/quickbooks/qbxml/response.rb, line 122</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">instantiatable?</span> <span class="ruby-comment cmt"># Just checks to see if it can create an object of this type, and if there is actually data to instantiate</span>
|
15
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">response_type</span> <span class="ruby-value">? </span>(<span class="ruby-constant">Quickbooks</span>.<span class="ruby-identifier">const_defined?</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">response_type</span>) <span class="ruby-operator">&&</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">ret_items</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>) <span class="ruby-operator">||</span> (<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">ret_items</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>) <span class="ruby-operator">&&</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">ret_items</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>))) <span class="ruby-operator">:</span> <span class="ruby-keyword kw">false</span>
|
16
|
-
<span class="ruby-keyword kw">end</span></pre>
|
17
|
-
</body>
|
18
|
-
</html>
|
@@ -1,63 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>instantiate (Quickbooks::Qbxml::Response)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/quickbooks/qbxml/response.rb, line 132</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">instantiate</span>(<span class="ruby-identifier">reinstantiate</span>=<span class="ruby-keyword kw">nil</span>)
|
15
|
-
<span class="ruby-identifier">objs</span> = []
|
16
|
-
(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">ret_items</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>) <span class="ruby-operator">?</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">ret_items</span> <span class="ruby-operator">:</span> [<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">ret_items</span>]).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ret_item</span><span class="ruby-operator">|</span>
|
17
|
-
<span class="ruby-identifier">obj</span> = <span class="ruby-identifier">reinstantiate</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">reinstantiate</span>
|
18
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">instantiatable?</span>
|
19
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
20
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">nil?</span>
|
21
|
-
<span class="ruby-identifier">obj</span> = <span class="ruby-node">"Quickbooks::#{self.response_type}"</span>.<span class="ruby-identifier">constantize</span>.<span class="ruby-identifier">instantiate</span>(<span class="ruby-identifier">ret_item</span>)
|
22
|
-
<span class="ruby-keyword kw">else</span>
|
23
|
-
<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">instantiate</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-identifier">ret_item</span>)
|
24
|
-
<span class="ruby-keyword kw">end</span>
|
25
|
-
<span class="ruby-keyword kw">else</span>
|
26
|
-
<span class="ruby-comment cmt"># Instantiatable, but some error status. For any error status</span>
|
27
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-comment cmt"># Must be a new object. Just as well, create a new object WITHOUT any original_attributes.</span>
|
28
|
-
<span class="ruby-identifier">obj</span> = <span class="ruby-node">"Quickbooks::#{self.response_type}"</span>.<span class="ruby-identifier">constantize</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">ret_item</span>)
|
29
|
-
<span class="ruby-keyword kw">else</span> <span class="ruby-comment cmt"># An existing object. Must be an update or delete request. Update object's original_attributes.</span>
|
30
|
-
<span class="ruby-identifier">updated</span> = []
|
31
|
-
<span class="ruby-identifier">ret_item</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
|
32
|
-
<span class="ruby-identifier">k</span> = <span class="ruby-identifier">k</span>.<span class="ruby-identifier">underscore</span>
|
33
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">original_values</span>[<span class="ruby-identifier">k</span>] <span class="ruby-operator">!=</span> <span class="ruby-identifier">v</span>
|
34
|
-
<span class="ruby-identifier">updated</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">k</span>
|
35
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-value str">'@object_properties'</span>).<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">k</span>.<span class="ruby-identifier">to_sym</span>)
|
36
|
-
<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">original_values</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-value str">'@object_properties'</span>)[<span class="ruby-identifier">k</span>.<span class="ruby-identifier">to_sym</span>].<span class="ruby-identifier">new</span>(<span class="ruby-identifier">v</span>)
|
37
|
-
<span class="ruby-keyword kw">else</span>
|
38
|
-
<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">original_values</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span>
|
39
|
-
<span class="ruby-keyword kw">end</span>
|
40
|
-
<span class="ruby-keyword kw">end</span>
|
41
|
-
<span class="ruby-keyword kw">end</span>
|
42
|
-
<span class="ruby-comment cmt"># Update object's 'read-only' attributes (as well as in the original_values):</span>
|
43
|
-
<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">read_only</span>.<span class="ruby-identifier">stringify_values</span>.<span class="ruby-identifier">camelize_values</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span>
|
44
|
-
<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">k</span>.<span class="ruby-identifier">underscore</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'='</span>, <span class="ruby-identifier">ret_item</span>[<span class="ruby-identifier">k</span>]) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ret_item</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">k</span>) <span class="ruby-operator">&&</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">k</span>.<span class="ruby-identifier">underscore</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'='</span>)
|
45
|
-
<span class="ruby-keyword kw">end</span>
|
46
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">message</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">message</span> <span class="ruby-operator">+</span> <span class="ruby-value str">" Other properties were out of date: ["</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">updated</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">', '</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">'].'</span>
|
47
|
-
<span class="ruby-keyword kw">end</span>
|
48
|
-
<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">errors</span> <span class="ruby-operator"><<</span> {<span class="ruby-identifier">:code</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">status</span>, <span class="ruby-identifier">:message</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">message</span>, <span class="ruby-identifier">:response</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">self</span>}
|
49
|
-
<span class="ruby-keyword kw">end</span>
|
50
|
-
<span class="ruby-keyword kw">else</span>
|
51
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
52
|
-
<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">errors</span> <span class="ruby-operator"><<</span> {<span class="ruby-identifier">:code</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">:message</span> =<span class="ruby-operator">></span> <span class="ruby-node">"Cannot instantiate object of type #{self.response_type}!"</span>, <span class="ruby-identifier">:response</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">self</span>}
|
53
|
-
<span class="ruby-keyword kw">else</span>
|
54
|
-
<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">errors</span> <span class="ruby-operator"><<</span> {<span class="ruby-identifier">:code</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">status</span>, <span class="ruby-identifier">:message</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">message</span>, <span class="ruby-identifier">:response</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">self</span>}
|
55
|
-
<span class="ruby-keyword kw">end</span>
|
56
|
-
<span class="ruby-keyword kw">end</span>
|
57
|
-
<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">response_log</span> <span class="ruby-operator"><<</span> <span class="ruby-keyword kw">self</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">nil?</span>
|
58
|
-
<span class="ruby-identifier">objs</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">obj</span>
|
59
|
-
<span class="ruby-keyword kw">end</span>
|
60
|
-
<span class="ruby-identifier">objs</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">1</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">objs</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">objs</span>[<span class="ruby-value">0</span>] <span class="ruby-comment cmt"># Single or nil if not more than one.</span>
|
61
|
-
<span class="ruby-keyword kw">end</span></pre>
|
62
|
-
</body>
|
63
|
-
</html>
|
@@ -1,22 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>set (Quickbooks::Qbxml::ResponseSet)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/quickbooks/qbxml/response.rb, line 7</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set</span>
|
15
|
-
<span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@set</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>)
|
16
|
-
<span class="ruby-ivar">@set</span> = []
|
17
|
-
<span class="ruby-ivar">@set</span>.<span class="ruby-identifier">extend</span>(<span class="ruby-constant">Quickbooks</span><span class="ruby-operator">::</span><span class="ruby-constant">Qbxml</span><span class="ruby-operator">::</span><span class="ruby-constant">ResponseSetArrayExt</span>)
|
18
|
-
<span class="ruby-keyword kw">end</span>
|
19
|
-
<span class="ruby-ivar">@set</span>
|
20
|
-
<span class="ruby-keyword kw">end</span></pre>
|
21
|
-
</body>
|
22
|
-
</html>
|
@@ -1,26 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title><< (Quickbooks::Qbxml::ResponseSet)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/quickbooks/qbxml/response.rb, line 15</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-operator"><<</span>(<span class="ruby-identifier">qbxml_response</span>)
|
15
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">qbxml_response</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Quickbooks</span><span class="ruby-operator">::</span><span class="ruby-constant">Qbxml</span><span class="ruby-operator">::</span><span class="ruby-constant">Response</span>)
|
16
|
-
<span class="ruby-identifier">set</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">qbxml_response</span>
|
17
|
-
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">qbxml_response</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:each</span>)
|
18
|
-
<span class="ruby-identifier">qbxml_response</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">response</span><span class="ruby-operator">|</span>
|
19
|
-
<span class="ruby-keyword kw">self</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">response</span>
|
20
|
-
<span class="ruby-keyword kw">end</span>
|
21
|
-
<span class="ruby-keyword kw">else</span>
|
22
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">"Cannot add object of type #{qbxml_response.class.name} to a Quickbooks::Qbxml::ResponseSet"</span>
|
23
|
-
<span class="ruby-keyword kw">end</span>
|
24
|
-
<span class="ruby-keyword kw">end</span></pre>
|
25
|
-
</body>
|
26
|
-
</html>
|
@@ -1,24 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>new (Quickbooks::Qbxml::ResponseSet)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/quickbooks/qbxml/response.rb, line 27</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">xml_or_hash</span>)
|
15
|
-
<span class="ruby-keyword kw">if</span>(<span class="ruby-identifier">xml_or_hash</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>))
|
16
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">append_from_hash</span>(<span class="ruby-identifier">xml_or_hash</span>)
|
17
|
-
<span class="ruby-keyword kw">elsif</span>(<span class="ruby-identifier">xml_or_hash</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>))
|
18
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">append_from_xml</span>(<span class="ruby-identifier">xml_or_hash</span>)
|
19
|
-
<span class="ruby-keyword kw">else</span>
|
20
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"Quickbooks::Qbxml::ResponseSet must be initialized with either a Hash or an xml-formatted String."</span>
|
21
|
-
<span class="ruby-keyword kw">end</span>
|
22
|
-
<span class="ruby-keyword kw">end</span></pre>
|
23
|
-
</body>
|
24
|
-
</html>
|
@@ -1,18 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>append_from_xml (Quickbooks::Qbxml::ResponseSet)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/quickbooks/qbxml/response.rb, line 37</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">append_from_xml</span>(<span class="ruby-identifier">xml</span>)
|
15
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">append_from_hash</span>(<span class="ruby-constant">Hash</span>.<span class="ruby-identifier">from_xml</span>(<span class="ruby-identifier">xml</span>))
|
16
|
-
<span class="ruby-keyword kw">end</span></pre>
|
17
|
-
</body>
|
18
|
-
</html>
|
@@ -1,27 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>append_from_hash (Quickbooks::Qbxml::ResponseSet)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/quickbooks/qbxml/response.rb, line 40</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">append_from_hash</span>(<span class="ruby-identifier">hsh</span>)
|
15
|
-
<span class="ruby-identifier">to_append</span> = []
|
16
|
-
<span class="ruby-identifier">hsh</span> = <span class="ruby-identifier">hsh</span>[<span class="ruby-value str">'QBXML'</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hsh</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-value str">'QBXML'</span>)
|
17
|
-
<span class="ruby-identifier">hsh</span> = <span class="ruby-identifier">hsh</span>[<span class="ruby-value str">'QBXMLMsgsRs'</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hsh</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-value str">'QBXMLMsgsRs'</span>)
|
18
|
-
<span class="ruby-comment cmt"># responses will contain one or more keys.</span>
|
19
|
-
<span class="ruby-identifier">hsh</span>.<span class="ruby-identifier">each_key</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
|
20
|
-
<span class="ruby-comment cmt"># response_type is either a single response object, or an array of response objects. Force it into an array:</span>
|
21
|
-
<span class="ruby-identifier">responses</span> = <span class="ruby-identifier">hsh</span>[<span class="ruby-identifier">name</span>].<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">hsh</span>[<span class="ruby-identifier">name</span>] <span class="ruby-operator">:</span> [<span class="ruby-identifier">hsh</span>[<span class="ruby-identifier">name</span>]]
|
22
|
-
<span class="ruby-identifier">responses</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">response</span><span class="ruby-operator">|</span> <span class="ruby-identifier">to_append</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Response</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">name</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">response</span>) }
|
23
|
-
<span class="ruby-keyword kw">end</span>
|
24
|
-
<span class="ruby-keyword kw">self</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">to_append</span>
|
25
|
-
<span class="ruby-keyword kw">end</span></pre>
|
26
|
-
</body>
|
27
|
-
</html>
|
@@ -1,18 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>from_xml (Quickbooks::Qbxml::ResponseSet)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/quickbooks/qbxml/response.rb, line 54</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">from_xml</span>(<span class="ruby-identifier">xml</span>)
|
15
|
-
<span class="ruby-identifier">new</span>.<span class="ruby-identifier">append_from_xml</span>(<span class="ruby-identifier">xml</span>)
|
16
|
-
<span class="ruby-keyword kw">end</span></pre>
|
17
|
-
</body>
|
18
|
-
</html>
|
@@ -1,18 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>from_hash (Quickbooks::Qbxml::ResponseSet)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/quickbooks/qbxml/response.rb, line 57</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">from_hash</span>(<span class="ruby-identifier">hsh</span>)
|
15
|
-
<span class="ruby-identifier">new</span>.<span class="ruby-identifier">append_from_hash</span>(<span class="ruby-identifier">hsh</span>)
|
16
|
-
<span class="ruby-keyword kw">end</span></pre>
|
17
|
-
</body>
|
18
|
-
</html>
|
@@ -1,105 +0,0 @@
|
|
1
|
-
require 'win32ole'
|
2
|
-
require 'quickbooks/ole_helper'
|
3
|
-
|
4
|
-
module Quickbooks
|
5
|
-
# Connection is used internally by Quickbooks::Base to automatically manage a the communication with quickbooks.
|
6
|
-
# Currently the only connection mode supported is WIN32OlE, which means your application must be running on the
|
7
|
-
# same computer as Quickbooks.
|
8
|
-
#
|
9
|
-
# Quickbooks does not allow the user to close the company or exit the program until all outside applications are
|
10
|
-
# disconnected from its API. Therefore, this class includes an at_exit hook that automatically closes all open
|
11
|
-
# connections for you when your program exits.
|
12
|
-
class Connection
|
13
|
-
include QBHelpers
|
14
|
-
|
15
|
-
class << self #:nodoc: all
|
16
|
-
def connections
|
17
|
-
@connections || (@connections = [])
|
18
|
-
end
|
19
|
-
def connections=(v)
|
20
|
-
# raise ArgumentError, "Quickbooks::Connection.connections can only contain Quickbooks::Connection objects, but contains #{v.collect {|c| c.class.name}.uniq.join(', ')} objects" unless v.collect {|c| c.class.name}.uniq == ['Quickbooks::Connection']
|
21
|
-
@connections = v
|
22
|
-
end
|
23
|
-
|
24
|
-
at_exit do
|
25
|
-
Quickbooks::Connection.connections.each do |conn|
|
26
|
-
conn.close
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
# Initializes an instance of Quickbooks::Session.
|
32
|
-
# - _application_name_ is required.
|
33
|
-
# - _file_ is optional, in which case the connection will be made to the currently open company file in the Quickbooks application.
|
34
|
-
# - _user_ and _password_ may be required if you have specified a specific file to open.
|
35
|
-
# - _connection_type_ can be one of: ['unknown', 'localQBD', 'remoteQBD', 'localQBDLaunchUI', 'remoteQBOE']
|
36
|
-
# - _connection_mode_ can be one of: ['SingleUser', 'MultiUser', 'DoNotCare']
|
37
|
-
def initialize(application_name='RubyApplication', file='', user='', password='', connection_type='localQBD', connection_mode='DoNotCare')
|
38
|
-
@file = file
|
39
|
-
@user = user
|
40
|
-
@password = password
|
41
|
-
@application_name = application_name
|
42
|
-
@quickbooks = Ole.new('QBXMLRP2.RequestProcessor', 'QBXMLRP2 1.0 Type Library')
|
43
|
-
@connection_type = @quickbooks.get_variable(connection_type)
|
44
|
-
@connection_mode = @quickbooks.get_variable('qbFileOpen'+connection_mode)
|
45
|
-
end
|
46
|
-
|
47
|
-
# Returns true if there is an open connection to Quickbooks, false if not. Use session? to determine an open session.
|
48
|
-
def connected?
|
49
|
-
@connected ||= false
|
50
|
-
end
|
51
|
-
|
52
|
-
# Returns true if there is an active session. Use connected? to determine whether you are connected or not.
|
53
|
-
def session?
|
54
|
-
!@session.nil?
|
55
|
-
end
|
56
|
-
|
57
|
-
# Sends a request to Quickbooks. This request should be a valid QBXML request. Use Quickbooks::Qbxml::Request to generate valid requests.
|
58
|
-
def send_xml(xml)
|
59
|
-
@quickbooks.ProcessRequest(session, xml)
|
60
|
-
rescue => e
|
61
|
-
warn "ERROR processing request:\n#{xml}"
|
62
|
-
raise # Reraises the original error, only this way we got the xml output
|
63
|
-
end
|
64
|
-
|
65
|
-
# Returns the active connection to Quickbooks, or creates a new one if none exists.
|
66
|
-
def connection
|
67
|
-
@connection || begin
|
68
|
-
@connection = @quickbooks.ole
|
69
|
-
@connection.OpenConnection2('',@application_name,@connection_type)
|
70
|
-
Quickbooks::Connection.connections << self
|
71
|
-
@connected = true
|
72
|
-
@connection
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
# Begin a session to Quickbooks.
|
77
|
-
def session
|
78
|
-
@session || begin
|
79
|
-
@session = connection.BeginSession(@file,@connection_mode)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
# End the current Quickbooks session. After ending a session, a new session may be reopened if desired.
|
84
|
-
def end_session
|
85
|
-
if !@session.nil?
|
86
|
-
connection.EndSession(@session)
|
87
|
-
@session = nil
|
88
|
-
true
|
89
|
-
else
|
90
|
-
false
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
# Close the connection to Quickbooks. Automatically ends the session, if there is one.
|
95
|
-
def close
|
96
|
-
end_session
|
97
|
-
if connected? && connection.CloseConnection
|
98
|
-
@connected = false
|
99
|
-
@connection = nil
|
100
|
-
Quickbooks::Connection.connections = Quickbooks::Connection.connections - [self]
|
101
|
-
end
|
102
|
-
return !@connected # Returns false if CloseConnection failed.
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|