quickbooks 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/README +11 -7
  2. data/Rakefile +1 -1
  3. data/doc/classes/QuickBooks.html +5 -33
  4. data/doc/classes/QuickBooks/{Session.html → Connection.html} +37 -37
  5. data/doc/classes/QuickBooks/{Session.src/M000011.html → Connection.src/M000015.html} +2 -2
  6. data/doc/classes/QuickBooks/{Session.src/M000012.html → Connection.src/M000016.html} +2 -2
  7. data/doc/classes/QuickBooks/{Session.src/M000013.html → Connection.src/M000017.html} +2 -2
  8. data/doc/classes/QuickBooks/{Session.src/M000014.html → Connection.src/M000018.html} +2 -2
  9. data/doc/classes/QuickBooks/{Session.src/M000015.html → Connection.src/M000019.html} +2 -2
  10. data/doc/classes/QuickBooks/Models.html +2 -2
  11. data/doc/classes/QuickBooks/Models/Base.html +70 -8
  12. data/doc/classes/QuickBooks/Models/Base.src/M000010.html +5 -3
  13. data/doc/classes/QuickBooks/Models/Base.src/M000011.html +18 -0
  14. data/doc/classes/QuickBooks/Models/Base.src/M000012.html +18 -0
  15. data/doc/classes/QuickBooks/Models/Base.src/{M000009.html → M000013.html} +1 -2
  16. data/doc/classes/QuickBooks/Models/{Transaction.src/M000003.html → Base.src/M000014.html} +3 -3
  17. data/doc/classes/QuickBooks/Models/Customer.html +17 -2
  18. data/doc/classes/QuickBooks/Models/Customer.src/M000001.html +1 -1
  19. data/doc/classes/QuickBooks/Models/Customer.src/M000002.html +2 -1
  20. data/doc/classes/QuickBooks/Models/Customer.src/M000003.html +18 -0
  21. data/doc/classes/QuickBooks/Models/ListItem.html +9 -9
  22. data/doc/classes/QuickBooks/Models/ListItem.src/M000008.html +2 -2
  23. data/doc/classes/QuickBooks/Models/ListItem.src/{M000007.html → M000009.html} +2 -2
  24. data/doc/classes/QuickBooks/Models/Transaction.html +18 -18
  25. data/doc/classes/QuickBooks/Models/Transaction.src/M000004.html +2 -2
  26. data/doc/classes/QuickBooks/Models/Transaction.src/M000005.html +3 -3
  27. data/doc/classes/QuickBooks/Models/Transaction.src/M000006.html +2 -2
  28. data/doc/classes/QuickBooks/Models/Transaction.src/M000007.html +17 -0
  29. data/doc/created.rid +1 -1
  30. data/doc/files/README.html +14 -8
  31. data/doc/files/lib/quickbooks/{session_rb.html → connection_rb.html} +4 -4
  32. data/doc/files/lib/quickbooks/models/base_rb.html +1 -29
  33. data/doc/files/lib/quickbooks/models/{customer_rb.html → models_rb.html} +5 -33
  34. data/doc/files/lib/quickbooks_rb.html +3 -32
  35. data/doc/fr_class_index.html +1 -1
  36. data/doc/fr_file_index.html +2 -2
  37. data/doc/fr_method_index.html +14 -10
  38. data/lib/quickbooks.rb +2 -40
  39. data/lib/quickbooks/{session.rb → connection.rb} +7 -25
  40. data/lib/quickbooks/models/base.rb +19 -18
  41. data/lib/quickbooks/models/{customer.rb → models.rb} +5 -18
  42. data/test/quickbooks/quickbooks_test.rb +19 -12
  43. metadata +20 -16
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Tue Sep 12 14:07:00 Pacific Standard Time 2006</td>
59
+ <td>Fri Sep 15 11:24:37 Pacific Standard Time 2006</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -68,34 +68,6 @@
68
68
 
69
69
  <div id="contextContent">
70
70
 
71
- <div id="description">
72
- <p>
73
- Copyright &#169; 2006 Chris Bruce
74
- </p>
75
- <p>
76
- Permission is hereby granted, free of charge, to any person obtaining a
77
- copy of this software and associated documentation files (the
78
- &quot;Software&quot;), to deal in the Software without restriction,
79
- including without limitation the rights to use, copy, modify, merge,
80
- publish, distribute, sublicense, and/or sell copies of the Software, and to
81
- permit persons to whom the Software is furnished to do so, subject to the
82
- following conditions:
83
- </p>
84
- <p>
85
- The above copyright notice and this permission notice shall be included in
86
- all copies or substantial portions of the Software.
87
- </p>
88
- <p>
89
- THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
90
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
91
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
92
- NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
93
- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
94
- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
95
- USE OR OTHER DEALINGS IN THE SOFTWARE.
96
- </p>
97
-
98
- </div>
99
71
 
100
72
 
101
73
  </div>
@@ -5,7 +5,7 @@
5
5
 
6
6
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
7
  <head>
8
- <title>File: customer.rb</title>
8
+ <title>File: models.rb</title>
9
9
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
10
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
11
  <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
@@ -47,16 +47,16 @@
47
47
 
48
48
 
49
49
  <div id="fileHeader">
50
- <h1>customer.rb</h1>
50
+ <h1>models.rb</h1>
51
51
  <table class="header-table">
52
52
  <tr class="top-aligned-row">
53
53
  <td><strong>Path:</strong></td>
54
- <td>lib/quickbooks/models/customer.rb
54
+ <td>lib/quickbooks/models/models.rb
55
55
  </td>
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Tue Sep 12 14:07:09 Pacific Standard Time 2006</td>
59
+ <td>Fri Sep 15 11:24:24 Pacific Standard Time 2006</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -68,40 +68,12 @@
68
68
 
69
69
  <div id="contextContent">
70
70
 
71
- <div id="description">
72
- <p>
73
- Copyright &#169; 2006 Chris Bruce
74
- </p>
75
- <p>
76
- Permission is hereby granted, free of charge, to any person obtaining a
77
- copy of this software and associated documentation files (the
78
- &quot;Software&quot;), to deal in the Software without restriction,
79
- including without limitation the rights to use, copy, modify, merge,
80
- publish, distribute, sublicense, and/or sell copies of the Software, and to
81
- permit persons to whom the Software is furnished to do so, subject to the
82
- following conditions:
83
- </p>
84
- <p>
85
- The above copyright notice and this permission notice shall be included in
86
- all copies or substantial portions of the Software.
87
- </p>
88
- <p>
89
- THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
90
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
91
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
92
- NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
93
- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
94
- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
95
- USE OR OTHER DEALINGS IN THE SOFTWARE.
96
- </p>
97
-
98
- </div>
99
71
 
100
72
  <div id="requires-list">
101
73
  <h3 class="section-bar">Required files</h3>
102
74
 
103
75
  <div class="name-list">
104
- base&nbsp;&nbsp;
76
+ quickbooks/models/base&nbsp;&nbsp;
105
77
  </div>
106
78
  </div>
107
79
 
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Tue Sep 12 16:09:52 Pacific Standard Time 2006</td>
59
+ <td>Fri Sep 15 11:18:45 Pacific Standard Time 2006</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -68,42 +68,13 @@
68
68
 
69
69
  <div id="contextContent">
70
70
 
71
- <div id="description">
72
- <p>
73
- <a href="../../classes/QuickBooks/Session.html">QuickBooks::Session</a> is
74
- used to communicate with <a
75
- href="../../classes/QuickBooks.html">QuickBooks</a> RDS Server. You need to
76
- configure your <a href="../../classes/QuickBooks.html">QuickBooks</a>
77
- software to allow RDS connection from application.
78
- </p>
79
- <pre>
80
- require 'quickbooks'
81
-
82
- session = QuickBooks::Session.new('admin', 'pass', 'My Test App')
83
- session.open
84
- xml = &lt;&lt;END
85
- &lt;?xml version=&quot;1.0&quot;?&gt;
86
- &lt;?qbxml version=&quot;3.0&quot;?&gt;
87
- &lt;QBXML&gt;
88
- &lt;QBXMLMsgsRq onError=&quot;continueOnError&quot;&gt;
89
- &lt;InvoiceQueryRq requestID=&quot;1&quot;&gt;
90
- &lt;RefNumber&gt;81&lt;/RefNumber&gt;
91
- &lt;IncludeLineItems&gt;true&lt;/IncludeLineItems&gt;
92
- &lt;/InvoiceQueryRq&gt;
93
- &lt;/QBXMLMsgsRq&gt;
94
- &lt;/QBXML&gt;
95
- &lt;&lt;END
96
- session.send(xml)
97
- session.close
98
- </pre>
99
-
100
- </div>
101
71
 
102
72
  <div id="requires-list">
103
73
  <h3 class="section-bar">Required files</h3>
104
74
 
105
75
  <div class="name-list">
106
- quickbooks/session&nbsp;&nbsp;
76
+ quickbooks/connection&nbsp;&nbsp;
77
+ quickbooks/models/models&nbsp;&nbsp;
107
78
  </div>
108
79
  </div>
109
80
 
@@ -21,6 +21,7 @@
21
21
  <h1 class="section-bar">Classes</h1>
22
22
  <div id="index-entries">
23
23
  <a href="classes/QuickBooks.html">QuickBooks</a><br />
24
+ <a href="classes/QuickBooks/Connection.html">QuickBooks::Connection</a><br />
24
25
  <a href="classes/QuickBooks/Models.html">QuickBooks::Models</a><br />
25
26
  <a href="classes/QuickBooks/Models/Address.html">QuickBooks::Models::Address</a><br />
26
27
  <a href="classes/QuickBooks/Models/Base.html">QuickBooks::Models::Base</a><br />
@@ -29,7 +30,6 @@
29
30
  <a href="classes/QuickBooks/Models/DataExt.html">QuickBooks::Models::DataExt</a><br />
30
31
  <a href="classes/QuickBooks/Models/ListItem.html">QuickBooks::Models::ListItem</a><br />
31
32
  <a href="classes/QuickBooks/Models/Transaction.html">QuickBooks::Models::Transaction</a><br />
32
- <a href="classes/QuickBooks/Session.html">QuickBooks::Session</a><br />
33
33
  </div>
34
34
  </div>
35
35
  </body>
@@ -23,9 +23,9 @@
23
23
  <a href="files/LICENSE.html">LICENSE</a><br />
24
24
  <a href="files/README.html">README</a><br />
25
25
  <a href="files/lib/quickbooks_rb.html">lib/quickbooks.rb</a><br />
26
+ <a href="files/lib/quickbooks/connection_rb.html">lib/quickbooks/connection.rb</a><br />
26
27
  <a href="files/lib/quickbooks/models/base_rb.html">lib/quickbooks/models/base.rb</a><br />
27
- <a href="files/lib/quickbooks/models/customer_rb.html">lib/quickbooks/models/customer.rb</a><br />
28
- <a href="files/lib/quickbooks/session_rb.html">lib/quickbooks/session.rb</a><br />
28
+ <a href="files/lib/quickbooks/models/models_rb.html">lib/quickbooks/models/models.rb</a><br />
29
29
  </div>
30
30
  </div>
31
31
  </body>
@@ -20,21 +20,25 @@
20
20
  <div id="index">
21
21
  <h1 class="section-bar">Methods</h1>
22
22
  <div id="index-entries">
23
- <a href="classes/QuickBooks/Models/Base.html#M000009">add_xml (QuickBooks::Models::Base)</a><br />
24
- <a href="classes/QuickBooks/Session.html#M000015">close (QuickBooks::Session)</a><br />
25
- <a href="classes/QuickBooks/Session.html#M000012">connected? (QuickBooks::Session)</a><br />
23
+ <a href="classes/QuickBooks/Models/Base.html#M000013">add_xml (QuickBooks::Models::Base)</a><br />
24
+ <a href="classes/QuickBooks/Connection.html#M000019">close (QuickBooks::Connection)</a><br />
25
+ <a href="classes/QuickBooks/Connection.html#M000016">connected? (QuickBooks::Connection)</a><br />
26
+ <a href="classes/QuickBooks/Models/Base.html#M000011">connection (QuickBooks::Models::Base)</a><br />
27
+ <a href="classes/QuickBooks/Models/Base.html#M000012">connection= (QuickBooks::Models::Base)</a><br />
28
+ <a href="classes/QuickBooks/Models/Transaction.html#M000005">delete (QuickBooks::Models::Transaction)</a><br />
26
29
  <a href="classes/QuickBooks/Models/Transaction.html#M000004">delete (QuickBooks::Models::Transaction)</a><br />
27
- <a href="classes/QuickBooks/Models/Transaction.html#M000003">delete (QuickBooks::Models::Transaction)</a><br />
28
- <a href="classes/QuickBooks/Models/ListItem.html#M000007">delete (QuickBooks::Models::ListItem)</a><br />
29
30
  <a href="classes/QuickBooks/Models/ListItem.html#M000008">delete (QuickBooks::Models::ListItem)</a><br />
30
- <a href="classes/QuickBooks/Models/Base.html#M000010">mod_xml (QuickBooks::Models::Base)</a><br />
31
- <a href="classes/QuickBooks/Session.html#M000011">new (QuickBooks::Session)</a><br />
31
+ <a href="classes/QuickBooks/Models/ListItem.html#M000009">delete (QuickBooks::Models::ListItem)</a><br />
32
+ <a href="classes/QuickBooks/Models/Base.html#M000010">establish_connection (QuickBooks::Models::Base)</a><br />
33
+ <a href="classes/QuickBooks/Models/Customer.html#M000003">find (QuickBooks::Models::Customer)</a><br />
34
+ <a href="classes/QuickBooks/Models/Base.html#M000014">mod_xml (QuickBooks::Models::Base)</a><br />
32
35
  <a href="classes/QuickBooks/Models/Customer.html#M000001">new (QuickBooks::Models::Customer)</a><br />
36
+ <a href="classes/QuickBooks/Connection.html#M000015">new (QuickBooks::Connection)</a><br />
33
37
  <a href="classes/QuickBooks/Models/Customer.html#M000002">new_record? (QuickBooks::Models::Customer)</a><br />
34
- <a href="classes/QuickBooks/Session.html#M000013">open (QuickBooks::Session)</a><br />
35
- <a href="classes/QuickBooks/Session.html#M000014">send (QuickBooks::Session)</a><br />
36
- <a href="classes/QuickBooks/Models/Transaction.html#M000005">void (QuickBooks::Models::Transaction)</a><br />
38
+ <a href="classes/QuickBooks/Connection.html#M000017">open (QuickBooks::Connection)</a><br />
39
+ <a href="classes/QuickBooks/Connection.html#M000018">send (QuickBooks::Connection)</a><br />
37
40
  <a href="classes/QuickBooks/Models/Transaction.html#M000006">void (QuickBooks::Models::Transaction)</a><br />
41
+ <a href="classes/QuickBooks/Models/Transaction.html#M000007">void (QuickBooks::Models::Transaction)</a><br />
38
42
  </div>
39
43
  </div>
40
44
  </body>
data/lib/quickbooks.rb CHANGED
@@ -1,40 +1,2 @@
1
- #--
2
- # Copyright (c) 2006 Chris Bruce
3
- #
4
- # Permission is hereby granted, free of charge, to any person obtaining a copy of this software
5
- # and associated documentation files (the "Software"), to deal in the Software without restriction,
6
- # including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
7
- # and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
8
- # subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in all copies or substantial
11
- # portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
14
- # LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
15
- # NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
16
- # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
17
- # OR OTHER DEALINGS IN THE SOFTWARE.
18
- #++
19
- # QuickBooks::Session is used to communicate with QuickBooks RDS Server. You need to configure
20
- # your QuickBooks software to allow RDS connection from application.
21
- #
22
- # require 'quickbooks'
23
- #
24
- # session = QuickBooks::Session.new('admin', 'pass', 'My Test App')
25
- # session.open
26
- # xml = <<END
27
- # <?xml version="1.0"?>
28
- # <?qbxml version="3.0"?>
29
- # <QBXML>
30
- # <QBXMLMsgsRq onError="continueOnError">
31
- # <InvoiceQueryRq requestID="1">
32
- # <RefNumber>81</RefNumber>
33
- # <IncludeLineItems>true</IncludeLineItems>
34
- # </InvoiceQueryRq>
35
- # </QBXMLMsgsRq>
36
- # </QBXML>
37
- # <<END
38
- # session.send(xml)
39
- # session.close
40
- require 'quickbooks/session'
1
+ require 'quickbooks/connection'
2
+ require 'quickbooks/models/models'
@@ -1,30 +1,12 @@
1
- #--
2
- # Copyright (c) 2006 Chris Bruce
3
- #
4
- # Permission is hereby granted, free of charge, to any person obtaining a copy of this software
5
- # and associated documentation files (the "Software"), to deal in the Software without restriction,
6
- # including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
7
- # and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
8
- # subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in all copies or substantial
11
- # portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
14
- # LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
15
- # NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
16
- # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
17
- # OR OTHER DEALINGS IN THE SOFTWARE.
18
- #++
19
1
 
20
2
  module QuickBooks
21
- # Session used to communicate with QuickBooks RDS Server. You need to configure
22
- # your QuickBooks software to allow RDS connection from application.
3
+ # Connection is used to communicate with QuickBooks RDS Server. You need to configure
4
+ # your QuickBooks software to allow RDS connection from your application.
23
5
  # <code>
24
6
  # require 'quickbooks'
25
7
  #
26
- # session = QuickBooks::Session.new('admin', 'pass', 'My Test App')
27
- # session.open
8
+ # connection = QuickBooks::Connection.new('admin', 'pass', 'My Test App')
9
+ # connection.open
28
10
  # xml = <<END
29
11
  # <?xml version="1.0"?>
30
12
  # <?qbxml version="3.0"?>
@@ -37,9 +19,9 @@ module QuickBooks
37
19
  # </QBXMLMsgsRq>
38
20
  # </QBXML>
39
21
  # <<END
40
- # session.send(xml)
41
- # session.close
42
- class Session
22
+ # connection.send(xml)
23
+ # connection.close
24
+ class Connection
43
25
  require 'cgi'
44
26
  require 'soap/wsdlDriver'
45
27
 
@@ -1,25 +1,26 @@
1
- # Copyright (c) 2006 Chris Bruce
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy of this software
4
- # and associated documentation files (the "Software"), to deal in the Software without restriction,
5
- # including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
6
- # and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
7
- # subject to the following conditions:
8
- #
9
- # The above copyright notice and this permission notice shall be included in all copies or substantial
10
- # portions of the Software.
11
- #
12
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
13
- # LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
14
- # NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
15
- # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
16
- # OR OTHER DEALINGS IN THE SOFTWARE.
17
-
18
1
  module QuickBooks
19
2
  module Models
20
3
  class Base
4
+
5
+ # Establishes a connection to the QuickBooks RDS Server for all Model Classes
6
+ def self.establish_connection(user, password, application_name, host="localhost", port=3790, mode='multiUser')
7
+ @@connection = Connection.new(user, password, application_name, host, port, mode)
8
+ @@connection.open
9
+ end
10
+
11
+ # Returns the current Connection
12
+ def self.connection
13
+ @@connection
14
+ end
15
+
16
+ # Sets the current Connection
17
+ # connection = QuickBooks::Connection.new('user', 'pass', 'My Test App')
18
+ # QuickBooks::Models::Base.connection = connection
19
+ def self.connection=(connection)
20
+ @@connection = connection
21
+ end
22
+
21
23
  def add_xml
22
- xml
23
24
  end
24
25
 
25
26
  def mod_xml
@@ -1,21 +1,4 @@
1
- # Copyright (c) 2006 Chris Bruce
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy of this software
4
- # and associated documentation files (the "Software"), to deal in the Software without restriction,
5
- # including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
6
- # and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
7
- # subject to the following conditions:
8
- #
9
- # The above copyright notice and this permission notice shall be included in all copies or substantial
10
- # portions of the Software.
11
- #
12
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
13
- # LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
14
- # NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
15
- # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
16
- # OR OTHER DEALINGS IN THE SOFTWARE.
17
-
18
- require 'base'
1
+ require 'quickbooks/models/base'
19
2
  module QuickBooks
20
3
  module Models
21
4
  class Customer < ListItem
@@ -48,8 +31,12 @@ module QuickBooks
48
31
  end
49
32
 
50
33
  def new_record?
34
+ @new_record
51
35
  end
52
36
 
37
+ def self.find(parameters)
38
+
39
+ end
53
40
 
54
41
  end
55
42
  end
@@ -1,13 +1,15 @@
1
1
  require File.dirname(__FILE__) + '/../test_helper'
2
2
 
3
3
  class QuickBooksTest < Test::Unit::TestCase
4
- def setup
5
- end
6
-
7
- def test_connection
8
- session = QuickBooks::Session.new('admin', 'pass123', 'My Test App')
9
- session.open
10
- xml = <<EOL
4
+ def setup
5
+ end
6
+
7
+ # This test assumes you have RDS configured with the following name and password
8
+ # and that you are using the sample company that comes with QuickBooks.
9
+ def test_connection
10
+ connection = QuickBooks::Connection.new('admin', 'pass123', 'My Test App')
11
+ connection.open
12
+ xml = <<EOL
11
13
  <?xml version="1.0"?>
12
14
  <?qbxml version="3.0"?>
13
15
  <QBXML>
@@ -19,9 +21,14 @@ class QuickBooksTest < Test::Unit::TestCase
19
21
  </QBXMLMsgsRq>
20
22
  </QBXML>
21
23
  EOL
22
- res = session.send(xml)
23
- assert_not_nil(res)
24
- session.close
25
- end
26
-
24
+ res = connection.send(xml)
25
+ assert_not_nil(res)
26
+ connection.close
27
+ end
28
+
29
+ def test_model_connection
30
+ QuickBooks::Models::Base.establish_connection('admin', 'pass123', 'My Test App')
31
+ assert_not_nil(QuickBooks::Models::Base.connection)
32
+ end
33
+
27
34
  end