quickbooks 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README +18 -28
- data/Rakefile +17 -30
- data/doc/classes/{QuickBooks/Models/DataExt.html → Class.html} +151 -140
- data/doc/classes/Class.src/M000003.html +18 -0
- data/doc/classes/Hash.html +164 -0
- data/doc/classes/Hash.src/M000001.html +20 -0
- data/doc/classes/Hash.src/M000002.html +23 -0
- data/doc/classes/{QuickBooks/Models/Transaction.html → Object.html} +207 -201
- data/doc/classes/Object.src/M000004.html +24 -0
- data/doc/classes/Object.src/M000005.html +18 -0
- data/doc/classes/Object.src/M000006.html +19 -0
- data/doc/classes/Object.src/M000007.html +18 -0
- data/doc/classes/{QuickBooks.html → QBHelpers.html} +118 -119
- data/doc/classes/QBHelpers/Ole.html +209 -0
- data/doc/classes/QBHelpers/Ole.src/M000066.html +21 -0
- data/doc/classes/QBHelpers/Ole.src/M000067.html +22 -0
- data/doc/classes/QBHelpers/Ole.src/M000068.html +18 -0
- data/doc/classes/Quickbooks.html +136 -0
- data/doc/classes/Quickbooks/Base.html +618 -0
- data/doc/classes/Quickbooks/Base.src/M000034.html +18 -0
- data/doc/classes/Quickbooks/Base.src/M000035.html +18 -0
- data/doc/classes/Quickbooks/Base.src/M000036.html +18 -0
- data/doc/classes/Quickbooks/Base.src/M000037.html +19 -0
- data/doc/classes/Quickbooks/Base.src/M000038.html +19 -0
- data/doc/classes/Quickbooks/Base.src/M000039.html +25 -0
- data/doc/classes/Quickbooks/Base.src/M000040.html +27 -0
- data/doc/classes/Quickbooks/Base.src/M000041.html +22 -0
- data/doc/classes/Quickbooks/Base.src/M000042.html +30 -0
- data/doc/classes/Quickbooks/Base.src/M000043.html +18 -0
- data/doc/classes/Quickbooks/Base.src/M000044.html +19 -0
- data/doc/classes/Quickbooks/Base.src/M000045.html +18 -0
- data/doc/classes/Quickbooks/Base.src/M000046.html +19 -0
- data/doc/classes/Quickbooks/Base.src/M000047.html +22 -0
- data/doc/classes/Quickbooks/Base.src/M000048.html +23 -0
- data/doc/classes/Quickbooks/Base.src/M000049.html +18 -0
- data/doc/classes/Quickbooks/Base.src/M000050.html +21 -0
- data/doc/classes/Quickbooks/Base.src/M000051.html +25 -0
- data/doc/classes/Quickbooks/Base.src/M000052.html +18 -0
- data/doc/classes/Quickbooks/Base.src/M000053.html +36 -0
- data/doc/classes/Quickbooks/Base.src/M000054.html +18 -0
- data/doc/classes/Quickbooks/Base.src/M000055.html +18 -0
- data/doc/classes/Quickbooks/Connection.html +369 -0
- data/doc/classes/{QuickBooks/Models/Customer.src/M000002.html → Quickbooks/Connection.src/M000056.html} +17 -17
- data/doc/classes/Quickbooks/Connection.src/M000057.html +19 -0
- data/doc/classes/Quickbooks/Connection.src/M000058.html +25 -0
- data/doc/classes/{QuickBooks/Connection.src/M000018.html → Quickbooks/Connection.src/M000059.html} +17 -17
- data/doc/classes/Quickbooks/Connection.src/M000060.html +18 -0
- data/doc/classes/Quickbooks/Connection.src/M000061.html +21 -0
- data/doc/classes/Quickbooks/Connection.src/M000062.html +24 -0
- data/doc/classes/{QuickBooks/Connection.src/M000016.html → Quickbooks/Connection.src/M000063.html} +19 -20
- data/doc/classes/{QuickBooks/Connection.src/M000019.html → Quickbooks/Connection.src/M000064.html} +23 -21
- data/doc/classes/Quickbooks/Connection.src/M000065.html +24 -0
- data/doc/classes/{QuickBooks/Models.html → Quickbooks/Customer.html} +112 -120
- data/doc/classes/{QuickBooks/Models/CreditCardInfo.html → Quickbooks/ListItem.html} +176 -148
- data/doc/classes/Quickbooks/ListItem.src/M000033.html +31 -0
- data/doc/classes/Quickbooks/Qbxml.html +138 -0
- data/doc/classes/{QuickBooks/Models/ListItem.html → Quickbooks/Qbxml/Error.html} +167 -173
- data/doc/classes/{QuickBooks/Models/Base.src/M000011.html → Quickbooks/Qbxml/Error.src/M000031.html} +17 -17
- data/doc/classes/Quickbooks/Qbxml/Request.html +182 -0
- data/doc/classes/Quickbooks/Qbxml/Request.src/M000024.html +23 -0
- data/doc/classes/Quickbooks/Qbxml/Request.src/M000025.html +19 -0
- data/doc/classes/Quickbooks/Qbxml/Request.src/M000026.html +57 -0
- data/doc/classes/Quickbooks/Qbxml/RequestSet.html +193 -0
- data/doc/classes/Quickbooks/Qbxml/RequestSet.src/M000027.html +22 -0
- data/doc/classes/Quickbooks/Qbxml/RequestSet.src/M000028.html +26 -0
- data/doc/classes/{QuickBooks/Models/Base.src/M000014.html → Quickbooks/Qbxml/RequestSet.src/M000029.html} +17 -16
- data/doc/classes/Quickbooks/Qbxml/RequestSet.src/M000030.html +22 -0
- data/doc/classes/Quickbooks/Qbxml/RequestSetArrayExt.html +105 -0
- data/doc/classes/{QuickBooks/Connection.html → Quickbooks/Qbxml/Response.html} +301 -278
- data/doc/classes/Quickbooks/Qbxml/Response.src/M000015.html +24 -0
- data/doc/classes/Quickbooks/Qbxml/Response.src/M000016.html +19 -0
- data/doc/classes/Quickbooks/Qbxml/Response.src/M000017.html +45 -0
- data/doc/classes/Quickbooks/Qbxml/Response.src/M000018.html +18 -0
- data/doc/classes/Quickbooks/Qbxml/Response.src/M000019.html +18 -0
- data/doc/classes/Quickbooks/Qbxml/Response.src/M000020.html +18 -0
- data/doc/classes/{QuickBooks/Models/Base.src/M000013.html → Quickbooks/Qbxml/Response.src/M000021.html} +17 -16
- data/doc/classes/{QuickBooks/Models/ListItem.src/M000009.html → Quickbooks/Qbxml/Response.src/M000022.html} +17 -16
- data/doc/classes/Quickbooks/Qbxml/Response.src/M000023.html +52 -0
- data/doc/classes/{QuickBooks/Models/Base.html → Quickbooks/Qbxml/ResponseSet.html} +237 -213
- data/doc/classes/Quickbooks/Qbxml/ResponseSet.src/M000008.html +22 -0
- data/doc/classes/Quickbooks/Qbxml/ResponseSet.src/M000009.html +26 -0
- data/doc/classes/Quickbooks/Qbxml/ResponseSet.src/M000010.html +24 -0
- data/doc/classes/{QuickBooks/Models/Base.src/M000012.html → Quickbooks/Qbxml/ResponseSet.src/M000011.html} +17 -17
- data/doc/classes/Quickbooks/Qbxml/ResponseSet.src/M000012.html +27 -0
- data/doc/classes/Quickbooks/Qbxml/ResponseSet.src/M000013.html +18 -0
- data/doc/classes/Quickbooks/Qbxml/ResponseSet.src/M000014.html +18 -0
- data/doc/classes/Quickbooks/Qbxml/ResponseSetArrayExt.html +105 -0
- data/doc/classes/{QuickBooks/Models/Address.html → Quickbooks/Transaction.html} +194 -158
- data/doc/classes/Quickbooks/Transaction.src/M000032.html +26 -0
- data/doc/created.rid +1 -1
- data/doc/files/LICENSE.html +128 -128
- data/doc/files/README.html +185 -173
- data/doc/files/lib/quickbooks/base_rb.html +317 -0
- data/doc/files/lib/quickbooks/connection_rb.html +108 -108
- data/doc/files/lib/quickbooks/models/{base_rb.html → customer_rb.html} +100 -100
- data/doc/files/lib/quickbooks/models/list_item_rb.html +101 -0
- data/doc/files/lib/quickbooks/models/transaction_rb.html +101 -0
- data/doc/files/lib/quickbooks/ole_helper_rb.html +109 -0
- data/doc/files/lib/quickbooks/qbxml/error_rb.html +101 -0
- data/doc/files/lib/quickbooks/{models/models_rb.html → qbxml/request_rb.html} +108 -107
- data/doc/files/lib/quickbooks/qbxml/response_rb.html +109 -0
- data/doc/files/lib/quickbooks/ruby_magic_rb.html +111 -0
- data/doc/files/lib/quickbooks_rb.html +112 -108
- data/doc/fr_class_index.html +44 -35
- data/doc/fr_file_index.html +38 -31
- data/doc/fr_method_index.html +93 -44
- data/doc/index.html +23 -23
- data/doc/rdoc-style.css +207 -207
- data/lib/quickbooks.rb +6 -1
- data/lib/quickbooks/base.rb +282 -0
- data/lib/quickbooks/connection.rb +91 -57
- data/lib/quickbooks/models/customer.rb +71 -0
- data/lib/quickbooks/models/list_item.rb +22 -0
- data/lib/quickbooks/models/transaction.rb +40 -0
- data/lib/quickbooks/ole_helper.rb +47 -0
- data/lib/quickbooks/qbxml/error.rb +20 -0
- data/lib/quickbooks/qbxml/request.rb +120 -0
- data/lib/quickbooks/qbxml/response.rb +176 -0
- data/lib/quickbooks/ruby_magic.rb +67 -0
- metadata +173 -84
- data/doc/classes/QuickBooks/Connection.src/M000015.html +0 -25
- data/doc/classes/QuickBooks/Connection.src/M000017.html +0 -20
- data/doc/classes/QuickBooks/Models/Base.src/M000010.html +0 -19
- data/doc/classes/QuickBooks/Models/Customer.html +0 -424
- data/doc/classes/QuickBooks/Models/Customer.src/M000001.html +0 -34
- data/doc/classes/QuickBooks/Models/Customer.src/M000003.html +0 -18
- data/doc/classes/QuickBooks/Models/ListItem.src/M000008.html +0 -17
- data/doc/classes/QuickBooks/Models/Transaction.src/M000004.html +0 -17
- data/doc/classes/QuickBooks/Models/Transaction.src/M000005.html +0 -17
- data/doc/classes/QuickBooks/Models/Transaction.src/M000006.html +0 -17
- data/doc/classes/QuickBooks/Models/Transaction.src/M000007.html +0 -17
- data/lib/quickbooks/models/base.rb +0 -72
- data/lib/quickbooks/models/models.rb +0 -43
- data/test/quickbooks/quickbooks_test.rb +0 -34
- data/test/test_helper.rb +0 -4
@@ -0,0 +1,18 @@
|
|
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>success? (Quickbooks::Base)</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/base.rb, line 83</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">success?</span>
|
15
|
+
<span class="ruby-ivar">@response_log</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">success?</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
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>establish_connection (Quickbooks::Base)</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/base.rb, line 92</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">establish_connection</span>(<span class="ruby-identifier">application_name</span>=<span class="ruby-value str">'RubyApplication'</span>, <span class="ruby-identifier">file</span>=<span class="ruby-value str">''</span>, <span class="ruby-identifier">user</span>=<span class="ruby-value str">''</span>, <span class="ruby-identifier">password</span>=<span class="ruby-value str">''</span>, <span class="ruby-identifier">connection_type</span>=<span class="ruby-value str">'localQBD'</span>, <span class="ruby-identifier">connection_mode</span>=<span class="ruby-value str">'DoNotCare'</span>)
|
15
|
+
<span class="ruby-ivar">@@connection</span> = <span class="ruby-constant">Connection</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">application_name</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">user</span>, <span class="ruby-identifier">password</span>, <span class="ruby-identifier">connection_type</span>, <span class="ruby-identifier">connection_mode</span>)
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
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>connection (Quickbooks::Base)</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/base.rb, line 97</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">connection</span>
|
15
|
+
<span class="ruby-ivar">@connection</span> <span class="ruby-operator">||</span> (<span class="ruby-ivar">@@connection</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">establish_connection</span>())
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,19 @@
|
|
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>connection= (Quickbooks::Base)</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/base.rb, line 106</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">connection=</span>(<span class="ruby-identifier">conn</span>)
|
15
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"Cannot set connection to anything but a Quickbooks::Connection object"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">conn</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Quickbooks</span><span class="ruby-operator">::</span><span class="ruby-constant">Connection</span>)
|
16
|
+
<span class="ruby-ivar">@connection</span> = <span class="ruby-identifier">conn</span>
|
17
|
+
<span class="ruby-keyword kw">end</span></pre>
|
18
|
+
</body>
|
19
|
+
</html>
|
@@ -0,0 +1,19 @@
|
|
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>property (Quickbooks::Base)</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/base.rb, line 113</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">property</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
15
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"must include a property name"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
16
|
+
<span class="ruby-identifier">properties</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
17
|
+
<span class="ruby-keyword kw">end</span></pre>
|
18
|
+
</body>
|
19
|
+
</html>
|
@@ -0,0 +1,25 @@
|
|
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>properties (Quickbooks::Base)</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/base.rb, line 119</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">properties</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
15
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">blank?</span>
|
16
|
+
<span class="ruby-ivar">@properties</span> <span class="ruby-operator">||</span> (<span class="ruby-ivar">@properties</span> = [])
|
17
|
+
<span class="ruby-keyword kw">else</span>
|
18
|
+
<span class="ruby-identifier">args</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">property</span><span class="ruby-operator">|</span>
|
19
|
+
<span class="ruby-identifier">properties</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">property</span>
|
20
|
+
<span class="ruby-identifier">attr_accessor</span> <span class="ruby-identifier">property</span>
|
21
|
+
<span class="ruby-keyword kw">end</span>
|
22
|
+
<span class="ruby-keyword kw">end</span>
|
23
|
+
<span class="ruby-keyword kw">end</span></pre>
|
24
|
+
</body>
|
25
|
+
</html>
|
@@ -0,0 +1,27 @@
|
|
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>request_and_instantiate (Quickbooks::Base)</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/base.rb, line 135</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">request_and_instantiate</span>(<span class="ruby-identifier">obj_or_args</span>,<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
15
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">obj_or_args</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Quickbooks</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>)
|
16
|
+
<span class="ruby-identifier">reinstantiate</span> = <span class="ruby-identifier">obj_or_args</span>
|
17
|
+
<span class="ruby-keyword kw">else</span>
|
18
|
+
<span class="ruby-identifier">reinstantiate</span> = <span class="ruby-keyword kw">nil</span>
|
19
|
+
<span class="ruby-identifier">args</span>.<span class="ruby-identifier">unshift</span>(<span class="ruby-identifier">obj_or_args</span>)
|
20
|
+
<span class="ruby-keyword kw">end</span>
|
21
|
+
|
22
|
+
<span class="ruby-identifier">objects</span> = [] <span class="ruby-comment cmt"># This will hold and return the instantiated objects from the quickbooks response</span>
|
23
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">request</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</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">objects</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">instantiate</span>(<span class="ruby-identifier">reinstantiate</span>) } <span class="ruby-comment cmt"># Does not instantiate if it's an error, but simply records response into response_log</span>
|
24
|
+
<span class="ruby-identifier">objects</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">objects</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">:</span> <span class="ruby-identifier">objects</span>
|
25
|
+
<span class="ruby-keyword kw">end</span></pre>
|
26
|
+
</body>
|
27
|
+
</html>
|
@@ -0,0 +1,22 @@
|
|
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>request (Quickbooks::Base)</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/base.rb, line 149</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">request</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
15
|
+
<span class="ruby-constant">Qbxml</span><span class="ruby-operator">::</span><span class="ruby-constant">ResponseSet</span>.<span class="ruby-identifier">new</span>(
|
16
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">connection</span>.<span class="ruby-identifier">send_xml</span>(
|
17
|
+
<span class="ruby-constant">Qbxml</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>).<span class="ruby-identifier">to_xml</span>
|
18
|
+
)
|
19
|
+
)
|
20
|
+
<span class="ruby-keyword kw">end</span></pre>
|
21
|
+
</body>
|
22
|
+
</html>
|
@@ -0,0 +1,30 @@
|
|
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::Base)</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/base.rb, line 158</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">instantiate</span>(<span class="ruby-identifier">obj_or_attrs</span>={},<span class="ruby-identifier">attrs</span>={})
|
15
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">obj_or_attrs</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Quickbooks</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>)
|
16
|
+
<span class="ruby-identifier">obj</span> = <span class="ruby-identifier">obj_or_attrs</span>
|
17
|
+
<span class="ruby-keyword kw">else</span>
|
18
|
+
<span class="ruby-identifier">obj</span> = <span class="ruby-identifier">allocate</span>
|
19
|
+
<span class="ruby-identifier">attrs</span> = <span class="ruby-identifier">obj_or_attrs</span>
|
20
|
+
<span class="ruby-keyword kw">end</span>
|
21
|
+
<span class="ruby-identifier">attrs</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>,<span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
|
22
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">underscore</span><span class="ruby-operator">+</span><span class="ruby-value str">'='</span>)
|
23
|
+
<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">underscore</span><span class="ruby-operator">+</span><span class="ruby-value str">'='</span>, <span class="ruby-identifier">value</span>)
|
24
|
+
<span class="ruby-identifier">obj</span>.<span class="ruby-identifier">original_values</span>[<span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">underscore</span>] = <span class="ruby-identifier">value</span>
|
25
|
+
<span class="ruby-keyword kw">end</span>
|
26
|
+
<span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">attrs</span>
|
27
|
+
<span class="ruby-identifier">obj</span> <span class="ruby-comment cmt"># Will be either a nice object, or a Quickbooks::Qbxml::Error object.</span>
|
28
|
+
<span class="ruby-keyword kw">end</span></pre>
|
29
|
+
</body>
|
30
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
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>all (Quickbooks::Base)</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/base.rb, line 175</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">all</span>(<span class="ruby-identifier">filters</span>={})
|
15
|
+
[<span class="ruby-identifier">request_and_instantiate</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class_leaf_name</span>, <span class="ruby-identifier">:query</span>, <span class="ruby-identifier">filters</span>)].<span class="ruby-identifier">flatten</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,19 @@
|
|
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>first (Quickbooks::Base)</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/base.rb, line 180</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">first</span>(<span class="ruby-identifier">filters</span>={})
|
15
|
+
<span class="ruby-identifier">filters</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">:MaxReturned</span> =<span class="ruby-operator">></span> <span class="ruby-value">1</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">filters</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">:ListID</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">filters</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">:TxnID</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">filters</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">:FullName</span>)
|
16
|
+
<span class="ruby-identifier">request_and_instantiate</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class_leaf_name</span>, <span class="ruby-identifier">:query</span>, <span class="ruby-identifier">filters</span>)
|
17
|
+
<span class="ruby-keyword kw">end</span></pre>
|
18
|
+
</body>
|
19
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
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>create (Quickbooks::Base)</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/base.rb, line 186</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
15
|
+
<span class="ruby-identifier">new</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>).<span class="ruby-identifier">save</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,19 @@
|
|
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::Base)</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/base.rb, line 192</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">args</span>={})
|
15
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">attributes</span> = <span class="ruby-identifier">args</span>
|
16
|
+
<span class="ruby-ivar">@new_record</span> = <span class="ruby-keyword kw">true</span>
|
17
|
+
<span class="ruby-keyword kw">end</span></pre>
|
18
|
+
</body>
|
19
|
+
</html>
|
@@ -0,0 +1,22 @@
|
|
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>attributes (Quickbooks::Base)</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/base.rb, line 198</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">attributes</span>
|
15
|
+
<span class="ruby-identifier">attrs</span> = {}
|
16
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">properties</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">column</span><span class="ruby-operator">|</span>
|
17
|
+
<span class="ruby-identifier">attrs</span>[<span class="ruby-identifier">column</span>.<span class="ruby-identifier">to_s</span>] = <span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-value str">'@'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">column</span>.<span class="ruby-identifier">to_s</span>)
|
18
|
+
<span class="ruby-keyword kw">end</span>
|
19
|
+
<span class="ruby-identifier">attrs</span>
|
20
|
+
<span class="ruby-keyword kw">end</span></pre>
|
21
|
+
</body>
|
22
|
+
</html>
|
@@ -0,0 +1,23 @@
|
|
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>attributes= (Quickbooks::Base)</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/base.rb, line 206</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">attributes=</span>(<span class="ruby-identifier">attrs</span>)
|
15
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"attributes can only be set to a hash of attributes"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">attrs</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
|
16
|
+
<span class="ruby-identifier">attrs</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>,<span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
|
17
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">underscore</span><span class="ruby-operator">+</span><span class="ruby-value str">'='</span>)
|
18
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">underscore</span><span class="ruby-operator">+</span><span class="ruby-value str">'='</span>, <span class="ruby-identifier">value</span>)
|
19
|
+
<span class="ruby-keyword kw">end</span>
|
20
|
+
<span class="ruby-keyword kw">end</span>
|
21
|
+
<span class="ruby-keyword kw">end</span></pre>
|
22
|
+
</body>
|
23
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
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>original_values (Quickbooks::Base)</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/base.rb, line 216</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">original_values</span>
|
15
|
+
<span class="ruby-ivar">@original_values</span> <span class="ruby-operator">||</span> (<span class="ruby-ivar">@original_values</span> = {})
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,21 @@
|
|
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>dirty? (Quickbooks::Base)</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/base.rb, line 221</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dirty?</span>
|
15
|
+
<span class="ruby-comment cmt"># Concept: For each column that the current model includes, has the value been changed?</span>
|
16
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">properties</span>.<span class="ruby-identifier">any?</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">column</span><span class="ruby-operator">|</span>
|
17
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-value str">'@'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">column</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-operator">!=</span> <span class="ruby-identifier">original_values</span>[<span class="ruby-identifier">column</span>.<span class="ruby-identifier">to_s</span>]
|
18
|
+
<span class="ruby-keyword kw">end</span>
|
19
|
+
<span class="ruby-keyword kw">end</span></pre>
|
20
|
+
</body>
|
21
|
+
</html>
|
@@ -0,0 +1,25 @@
|
|
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>dirty_attributes (Quickbooks::Base)</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/base.rb, line 229</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dirty_attributes</span>
|
15
|
+
<span class="ruby-identifier">pairs</span> = {}
|
16
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">properties</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">column</span><span class="ruby-operator">|</span>
|
17
|
+
<span class="ruby-identifier">value</span> = <span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-value str">'@'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">column</span>.<span class="ruby-identifier">to_s</span>)
|
18
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">original_values</span>[<span class="ruby-identifier">column</span>.<span class="ruby-identifier">to_s</span>]
|
19
|
+
<span class="ruby-identifier">pairs</span>[<span class="ruby-identifier">column</span>.<span class="ruby-identifier">to_s</span>] = <span class="ruby-identifier">value</span>
|
20
|
+
<span class="ruby-keyword kw">end</span>
|
21
|
+
<span class="ruby-keyword kw">end</span>
|
22
|
+
<span class="ruby-identifier">pairs</span>
|
23
|
+
<span class="ruby-keyword kw">end</span></pre>
|
24
|
+
</body>
|
25
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
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_record? (Quickbooks::Base)</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/base.rb, line 241</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">new_record?</span>
|
15
|
+
<span class="ruby-ivar">@new_record</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,36 @@
|
|
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>save (Quickbooks::Base)</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/base.rb, line 250</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">save</span>
|
15
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">dirty?</span>
|
16
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">new_record?</span>
|
17
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">request_and_instantiate</span>(<span class="ruby-keyword kw">self</span>, <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">class_leaf_name</span>, <span class="ruby-identifier">:add</span>, <span class="ruby-identifier">dirty_attributes</span>.<span class="ruby-identifier">camelize_keys!</span>)
|
18
|
+
<span class="ruby-ivar">@new_record</span> = <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">dirty?</span>
|
19
|
+
<span class="ruby-keyword kw">else</span>
|
20
|
+
<span class="ruby-comment cmt"># Smart system that respects EditSequences and other people's changes.</span>
|
21
|
+
<span class="ruby-comment cmt"># 1) Try to save</span>
|
22
|
+
<span class="ruby-comment cmt"># 2) When we get a status of 3200, that means our EditSequence is not up to date</span>
|
23
|
+
<span class="ruby-comment cmt"># 3) Replace self's original_attributes with those just retrieved, and update the automatic attributes, like EditSequence and TimeModified</span>
|
24
|
+
<span class="ruby-comment cmt"># 4) Return false, return the object dirty but ready to save</span>
|
25
|
+
<span class="ruby-identifier">old_originals</span> = <span class="ruby-identifier">original_values</span>.<span class="ruby-identifier">dup</span>
|
26
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">request_and_instantiate</span>(<span class="ruby-keyword kw">self</span>, <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">class_leaf_name</span>, <span class="ruby-identifier">:mod</span>, <span class="ruby-identifier">dirty_attributes</span>.<span class="ruby-identifier">camelize_keys!</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">:ListID</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">list_id</span>, <span class="ruby-identifier">:EditSequence</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">edit_sequence</span>))
|
27
|
+
<span class="ruby-comment cmt"># If save failed because of old record, but none of the fields conflict, re-save.</span>
|
28
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">dirty?</span> <span class="ruby-operator">&&</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">response_log</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value">3200</span>
|
29
|
+
<span class="ruby-comment cmt"># puts "Now Dirty: #{dirty_attributes.keys.join(', ')}\nUpdated: #{old_originals.diff(original_values).keys.join(', ')}"</span>
|
30
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">save</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">dirty_attributes</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> (<span class="ruby-identifier">dirty_attributes</span>.<span class="ruby-identifier">keys</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">old_originals</span>.<span class="ruby-identifier">diff</span>(<span class="ruby-identifier">original_values</span>).<span class="ruby-identifier">keys</span>).<span class="ruby-identifier">length</span>
|
31
|
+
<span class="ruby-keyword kw">end</span>
|
32
|
+
<span class="ruby-keyword kw">end</span>
|
33
|
+
<span class="ruby-operator">!</span><span class="ruby-identifier">dirty?</span>
|
34
|
+
<span class="ruby-keyword kw">end</span></pre>
|
35
|
+
</body>
|
36
|
+
</html>
|