quickbooks 0.4.0 → 0.9.9

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.
Files changed (293) hide show
  1. data.tar.gz.sig +0 -0
  2. data/History.txt +23 -0
  3. data/License.txt +54 -0
  4. data/Manifest.txt +73 -0
  5. data/README.txt +79 -0
  6. data/Rakefile +17 -78
  7. data/lib/quickbooks.rb +153 -7
  8. data/lib/quickbooks/adaptability.rb +67 -0
  9. data/lib/quickbooks/adapters/http_adapter.rb +94 -0
  10. data/lib/quickbooks/adapters/https_adapter.rb +57 -0
  11. data/lib/quickbooks/adapters/ole_adapter.rb +141 -110
  12. data/lib/quickbooks/adapters/spew_adapter.rb +39 -0
  13. data/lib/quickbooks/adapters/tcp_adapter.rb +71 -0
  14. data/lib/quickbooks/adapters/test_adapter.rb +62 -0
  15. data/lib/quickbooks/element.rb +385 -0
  16. data/lib/quickbooks/element_collection.rb +105 -0
  17. data/lib/quickbooks/extlib.rb +8 -0
  18. data/lib/quickbooks/extlib/assertions.rb +8 -0
  19. data/lib/quickbooks/extlib/class.rb +98 -0
  20. data/lib/quickbooks/extlib/days_and_times.rb +10 -0
  21. data/lib/quickbooks/extlib/days_and_times/duration.rb +362 -0
  22. data/lib/quickbooks/extlib/days_and_times/numeric.rb +48 -0
  23. data/lib/quickbooks/extlib/days_and_times/object.rb +19 -0
  24. data/lib/quickbooks/extlib/days_and_times/time.rb +137 -0
  25. data/lib/quickbooks/extlib/hash.rb +327 -0
  26. data/lib/quickbooks/extlib/hook.rb +366 -0
  27. data/lib/quickbooks/extlib/inflection.rb +436 -0
  28. data/lib/quickbooks/extlib/logger.rb +202 -0
  29. data/lib/quickbooks/extlib/object.rb +162 -0
  30. data/lib/quickbooks/extlib/pathname.rb +15 -0
  31. data/lib/quickbooks/extlib/rubygems.rb +38 -0
  32. data/lib/quickbooks/extlib/string.rb +32 -0
  33. data/lib/quickbooks/extlib/time.rb +41 -0
  34. data/lib/quickbooks/model.rb +503 -121
  35. data/lib/quickbooks/option.rb +95 -0
  36. data/lib/quickbooks/property.rb +69 -0
  37. data/lib/quickbooks/ruby_ext.rb +251 -0
  38. data/lib/quickbooks/type.rb +75 -0
  39. data/lib/quickbooks/types.rb +58 -0
  40. data/lib/quickbooks/version.rb +10 -0
  41. data/lib/quickbooks/xsd.rb +243 -0
  42. data/lib/quickbooks/xsd/attribute.rb +57 -0
  43. data/lib/quickbooks/xsd/choice.rb +94 -0
  44. data/lib/quickbooks/xsd/complex_type.rb +77 -0
  45. data/lib/quickbooks/xsd/element.rb +214 -0
  46. data/lib/quickbooks/xsd/group.rb +94 -0
  47. data/lib/quickbooks/xsd/restriction.rb +51 -0
  48. data/lib/quickbooks/xsd/sequence.rb +85 -0
  49. data/lib/quickbooks/xsd/simple_type.rb +87 -0
  50. data/lib/quickbooks/xsd/union.rb +70 -0
  51. data/lib/quickbooks/xsd/validation.rb +89 -0
  52. data/lib/quickbooks/xsd/xml_parse.rb +80 -0
  53. data/quickbooks.gemspec +36 -0
  54. data/source/qbxml21_demo.xsd +2223 -0
  55. data/source/qbxmlops_demo.xsd +483 -0
  56. data/source/qbxmltypes.xsd +160 -0
  57. data/spec/association_spec.rb +5 -0
  58. data/spec/element_collection_spec.rb +8 -0
  59. data/spec/find_spec.rb +30 -0
  60. data/spec/lib/quickbooks/element_spec.rb +83 -0
  61. data/spec/lib/quickbooks/elements/sales_order_add_spec.rb +14 -0
  62. data/spec/lib/quickbooks/elements/vendor_add_spec.rb +78 -0
  63. data/spec/lib/quickbooks/model_spec.rb +89 -0
  64. data/spec/lib/quickbooks/models/customer_spec.rb +52 -0
  65. data/spec/lib/quickbooks/models/invoice_spec.rb +12 -0
  66. data/spec/lib/quickbooks/models/sales_order_line_spec.rb +0 -0
  67. data/spec/lib/quickbooks/models/sales_order_spec.rb +145 -0
  68. data/spec/lib/quickbooks/xsd/choice_spec.rb +18 -0
  69. data/spec/pending_spec.rb +11 -0
  70. data/spec/quickbooks_spec.rb +38 -0
  71. data/spec/repeatable_spec.rb +20 -0
  72. data/spec/requires_spec.rb +10 -0
  73. data/spec/spec_helper.rb +5 -0
  74. data/spec/validation_spec.rb +24 -0
  75. metadata +133 -285
  76. metadata.gz.sig +0 -0
  77. data/LICENSE +0 -16
  78. data/README +0 -49
  79. data/doc/classes/Array.html +0 -368
  80. data/doc/classes/Array.src/M000026.html +0 -18
  81. data/doc/classes/Array.src/M000027.html +0 -21
  82. data/doc/classes/Array.src/M000028.html +0 -18
  83. data/doc/classes/Array.src/M000029.html +0 -19
  84. data/doc/classes/Array.src/M000030.html +0 -18
  85. data/doc/classes/Array.src/M000031.html +0 -23
  86. data/doc/classes/Array.src/M000032.html +0 -18
  87. data/doc/classes/Array.src/M000033.html +0 -18
  88. data/doc/classes/Array.src/M000034.html +0 -18
  89. data/doc/classes/Array.src/M000035.html +0 -19
  90. data/doc/classes/Array.src/M000036.html +0 -18
  91. data/doc/classes/Array.src/M000037.html +0 -23
  92. data/doc/classes/Array.src/M000038.html +0 -18
  93. data/doc/classes/Array.src/M000039.html +0 -21
  94. data/doc/classes/Array.src/M000040.html +0 -18
  95. data/doc/classes/Array.src/M000041.html +0 -18
  96. data/doc/classes/Class.html +0 -171
  97. data/doc/classes/Class.src/M000042.html +0 -18
  98. data/doc/classes/Class.src/M000043.html +0 -18
  99. data/doc/classes/Hash.html +0 -516
  100. data/doc/classes/Hash.src/M000001.html +0 -18
  101. data/doc/classes/Hash.src/M000002.html +0 -21
  102. data/doc/classes/Hash.src/M000003.html +0 -18
  103. data/doc/classes/Hash.src/M000004.html +0 -21
  104. data/doc/classes/Hash.src/M000005.html +0 -18
  105. data/doc/classes/Hash.src/M000006.html +0 -20
  106. data/doc/classes/Hash.src/M000007.html +0 -18
  107. data/doc/classes/Hash.src/M000008.html +0 -22
  108. data/doc/classes/Hash.src/M000009.html +0 -18
  109. data/doc/classes/Hash.src/M000010.html +0 -21
  110. data/doc/classes/Hash.src/M000011.html +0 -24
  111. data/doc/classes/Hash.src/M000012.html +0 -18
  112. data/doc/classes/Hash.src/M000013.html +0 -21
  113. data/doc/classes/Hash.src/M000014.html +0 -18
  114. data/doc/classes/Hash.src/M000015.html +0 -21
  115. data/doc/classes/Hash.src/M000016.html +0 -18
  116. data/doc/classes/Hash.src/M000017.html +0 -21
  117. data/doc/classes/Hash.src/M000018.html +0 -27
  118. data/doc/classes/Hash.src/M000019.html +0 -20
  119. data/doc/classes/Hash.src/M000020.html +0 -18
  120. data/doc/classes/Hash.src/M000021.html +0 -18
  121. data/doc/classes/Hash.src/M000022.html +0 -18
  122. data/doc/classes/Hash.src/M000023.html +0 -18
  123. data/doc/classes/Hash.src/M000024.html +0 -18
  124. data/doc/classes/Hash.src/M000025.html +0 -28
  125. data/doc/classes/Object.html +0 -278
  126. data/doc/classes/Object.src/M000044.html +0 -24
  127. data/doc/classes/Object.src/M000045.html +0 -19
  128. data/doc/classes/Object.src/M000046.html +0 -24
  129. data/doc/classes/Object.src/M000047.html +0 -18
  130. data/doc/classes/Object.src/M000048.html +0 -19
  131. data/doc/classes/Object.src/M000049.html +0 -18
  132. data/doc/classes/Object.src/M000050.html +0 -18
  133. data/doc/classes/Object.src/M000051.html +0 -18
  134. data/doc/classes/Qbxml.html +0 -131
  135. data/doc/classes/Qbxml/Request.html +0 -224
  136. data/doc/classes/Qbxml/Request.src/M000132.html +0 -66
  137. data/doc/classes/Qbxml/Request.src/M000133.html +0 -19
  138. data/doc/classes/Qbxml/Request.src/M000134.html +0 -83
  139. data/doc/classes/Qbxml/RequestSet.html +0 -199
  140. data/doc/classes/Qbxml/RequestSet.src/M000135.html +0 -22
  141. data/doc/classes/Qbxml/RequestSet.src/M000136.html +0 -26
  142. data/doc/classes/Qbxml/RequestSet.src/M000137.html +0 -18
  143. data/doc/classes/Qbxml/RequestSet.src/M000138.html +0 -22
  144. data/doc/classes/Qbxml/Response.html +0 -302
  145. data/doc/classes/Qbxml/Response.src/M000123.html +0 -24
  146. data/doc/classes/Qbxml/Response.src/M000124.html +0 -19
  147. data/doc/classes/Qbxml/Response.src/M000125.html +0 -55
  148. data/doc/classes/Qbxml/Response.src/M000126.html +0 -18
  149. data/doc/classes/Qbxml/Response.src/M000127.html +0 -18
  150. data/doc/classes/Qbxml/Response.src/M000128.html +0 -18
  151. data/doc/classes/Qbxml/Response.src/M000129.html +0 -18
  152. data/doc/classes/Qbxml/Response.src/M000130.html +0 -18
  153. data/doc/classes/Qbxml/Response.src/M000131.html +0 -63
  154. data/doc/classes/Qbxml/ResponseSet.html +0 -244
  155. data/doc/classes/Qbxml/ResponseSet.src/M000116.html +0 -22
  156. data/doc/classes/Qbxml/ResponseSet.src/M000117.html +0 -26
  157. data/doc/classes/Qbxml/ResponseSet.src/M000118.html +0 -24
  158. data/doc/classes/Qbxml/ResponseSet.src/M000119.html +0 -20
  159. data/doc/classes/Qbxml/ResponseSet.src/M000120.html +0 -27
  160. data/doc/classes/Qbxml/ResponseSet.src/M000121.html +0 -18
  161. data/doc/classes/Qbxml/ResponseSet.src/M000122.html +0 -18
  162. data/doc/classes/Quickbooks.html +0 -196
  163. data/doc/classes/Quickbooks/Address.html +0 -139
  164. data/doc/classes/Quickbooks/Address.src/M000115.html +0 -19
  165. data/doc/classes/Quickbooks/Base.html +0 -567
  166. data/doc/classes/Quickbooks/Base.src/M000095.html +0 -18
  167. data/doc/classes/Quickbooks/Base.src/M000096.html +0 -20
  168. data/doc/classes/Quickbooks/Base.src/M000097.html +0 -19
  169. data/doc/classes/Quickbooks/Base.src/M000098.html +0 -18
  170. data/doc/classes/Quickbooks/Base.src/M000099.html +0 -19
  171. data/doc/classes/Quickbooks/Base.src/M000100.html +0 -30
  172. data/doc/classes/Quickbooks/Base.src/M000101.html +0 -22
  173. data/doc/classes/Quickbooks/Base.src/M000102.html +0 -30
  174. data/doc/classes/Quickbooks/Base.src/M000103.html +0 -19
  175. data/doc/classes/Quickbooks/Base.src/M000104.html +0 -19
  176. data/doc/classes/Quickbooks/Base.src/M000105.html +0 -18
  177. data/doc/classes/Quickbooks/Base.src/M000106.html +0 -18
  178. data/doc/classes/Quickbooks/Base.src/M000107.html +0 -19
  179. data/doc/classes/Quickbooks/Base.src/M000108.html +0 -18
  180. data/doc/classes/Quickbooks/Base.src/M000109.html +0 -45
  181. data/doc/classes/Quickbooks/Base.src/M000110.html +0 -18
  182. data/doc/classes/Quickbooks/Base.src/M000111.html +0 -18
  183. data/doc/classes/Quickbooks/Base.src/M000112.html +0 -20
  184. data/doc/classes/Quickbooks/BillAddress.html +0 -113
  185. data/doc/classes/Quickbooks/CreditCardInfo.html +0 -113
  186. data/doc/classes/Quickbooks/Customer.html +0 -113
  187. data/doc/classes/Quickbooks/CustomerTypeRef.html +0 -113
  188. data/doc/classes/Quickbooks/Deleted.html +0 -113
  189. data/doc/classes/Quickbooks/ItemSalesTaxRef.html +0 -113
  190. data/doc/classes/Quickbooks/JobTypeRef.html +0 -113
  191. data/doc/classes/Quickbooks/ListDeleted.html +0 -139
  192. data/doc/classes/Quickbooks/ListDeleted.src/M000114.html +0 -18
  193. data/doc/classes/Quickbooks/ListItem.html +0 -170
  194. data/doc/classes/Quickbooks/ListItem.src/M000093.html +0 -20
  195. data/doc/classes/Quickbooks/ListItem.src/M000094.html +0 -18
  196. data/doc/classes/Quickbooks/Model.html +0 -462
  197. data/doc/classes/Quickbooks/Model.src/M000073.html +0 -24
  198. data/doc/classes/Quickbooks/Model.src/M000074.html +0 -19
  199. data/doc/classes/Quickbooks/Model.src/M000075.html +0 -18
  200. data/doc/classes/Quickbooks/Model.src/M000076.html +0 -18
  201. data/doc/classes/Quickbooks/Model.src/M000077.html +0 -18
  202. data/doc/classes/Quickbooks/Model.src/M000078.html +0 -22
  203. data/doc/classes/Quickbooks/Model.src/M000079.html +0 -32
  204. data/doc/classes/Quickbooks/Model.src/M000080.html +0 -32
  205. data/doc/classes/Quickbooks/Model.src/M000081.html +0 -18
  206. data/doc/classes/Quickbooks/Model.src/M000082.html +0 -18
  207. data/doc/classes/Quickbooks/Model.src/M000083.html +0 -22
  208. data/doc/classes/Quickbooks/Model.src/M000084.html +0 -23
  209. data/doc/classes/Quickbooks/Model.src/M000085.html +0 -18
  210. data/doc/classes/Quickbooks/Model.src/M000086.html +0 -21
  211. data/doc/classes/Quickbooks/Model.src/M000087.html +0 -26
  212. data/doc/classes/Quickbooks/Model.src/M000088.html +0 -26
  213. data/doc/classes/Quickbooks/Model.src/M000089.html +0 -26
  214. data/doc/classes/Quickbooks/Model.src/M000090.html +0 -21
  215. data/doc/classes/Quickbooks/Model.src/M000091.html +0 -23
  216. data/doc/classes/Quickbooks/OleAdapter.html +0 -129
  217. data/doc/classes/Quickbooks/OleAdapter/Connection.html +0 -343
  218. data/doc/classes/Quickbooks/OleAdapter/Connection.src/M000058.html +0 -18
  219. data/doc/classes/Quickbooks/OleAdapter/Connection.src/M000059.html +0 -19
  220. data/doc/classes/Quickbooks/OleAdapter/Connection.src/M000060.html +0 -24
  221. data/doc/classes/Quickbooks/OleAdapter/Connection.src/M000061.html +0 -18
  222. data/doc/classes/Quickbooks/OleAdapter/Connection.src/M000062.html +0 -18
  223. data/doc/classes/Quickbooks/OleAdapter/Connection.src/M000063.html +0 -21
  224. data/doc/classes/Quickbooks/OleAdapter/Connection.src/M000064.html +0 -24
  225. data/doc/classes/Quickbooks/OleAdapter/Connection.src/M000065.html +0 -20
  226. data/doc/classes/Quickbooks/OleAdapter/Connection.src/M000066.html +0 -24
  227. data/doc/classes/Quickbooks/OleAdapter/Connection.src/M000067.html +0 -24
  228. data/doc/classes/Quickbooks/OleAdapter/Ole.html +0 -209
  229. data/doc/classes/Quickbooks/OleAdapter/Ole.src/M000068.html +0 -21
  230. data/doc/classes/Quickbooks/OleAdapter/Ole.src/M000069.html +0 -22
  231. data/doc/classes/Quickbooks/OleAdapter/Ole.src/M000070.html +0 -18
  232. data/doc/classes/Quickbooks/ParentRef.html +0 -113
  233. data/doc/classes/Quickbooks/PreferredPaymentMethodRef.html +0 -113
  234. data/doc/classes/Quickbooks/PriceLevelRef.html +0 -113
  235. data/doc/classes/Quickbooks/QbxmlDebugAdapter.html +0 -111
  236. data/doc/classes/Quickbooks/QbxmlDebugAdapter/Connection.html +0 -139
  237. data/doc/classes/Quickbooks/QbxmlDebugAdapter/Connection.src/M000057.html +0 -18
  238. data/doc/classes/Quickbooks/Ref.html +0 -146
  239. data/doc/classes/Quickbooks/Ref.src/M000113.html +0 -18
  240. data/doc/classes/Quickbooks/SalesRepRef.html +0 -113
  241. data/doc/classes/Quickbooks/SalesTaxCodeRef.html +0 -113
  242. data/doc/classes/Quickbooks/ShipAddress.html +0 -113
  243. data/doc/classes/Quickbooks/TermsRef.html +0 -113
  244. data/doc/classes/Quickbooks/Transaction.html +0 -154
  245. data/doc/classes/Quickbooks/Transaction.src/M000071.html +0 -19
  246. data/doc/classes/Quickbooks/Transaction.src/M000072.html +0 -18
  247. data/doc/classes/Quickbooks/TxnDeleted.html +0 -139
  248. data/doc/classes/Quickbooks/TxnDeleted.src/M000092.html +0 -18
  249. data/doc/classes/String.html +0 -203
  250. data/doc/classes/String.src/M000052.html +0 -18
  251. data/doc/classes/String.src/M000053.html +0 -18
  252. data/doc/classes/String.src/M000054.html +0 -18
  253. data/doc/classes/String.src/M000055.html +0 -18
  254. data/doc/classes/String.src/M000056.html +0 -18
  255. data/doc/created.rid +0 -1
  256. data/doc/files/LICENSE.html +0 -129
  257. data/doc/files/README.html +0 -225
  258. data/doc/files/lib/qbxml/request_rb.html +0 -110
  259. data/doc/files/lib/qbxml/response_rb.html +0 -109
  260. data/doc/files/lib/qbxml/support_rb.html +0 -101
  261. data/doc/files/lib/qbxml_rb.html +0 -122
  262. data/doc/files/lib/quickbooks/adapters/ole_adapter_rb.html +0 -108
  263. data/doc/files/lib/quickbooks/adapters/qbxml_debug_adapter_rb.html +0 -108
  264. data/doc/files/lib/quickbooks/base_rb.html +0 -327
  265. data/doc/files/lib/quickbooks/model_rb.html +0 -108
  266. data/doc/files/lib/quickbooks/models/common/address_rb.html +0 -101
  267. data/doc/files/lib/quickbooks/models/common/all_refs_rb.html +0 -101
  268. data/doc/files/lib/quickbooks/models/customer/credit_card_info_rb.html +0 -101
  269. data/doc/files/lib/quickbooks/models/customer_rb.html +0 -110
  270. data/doc/files/lib/quickbooks/models/deleted_rb.html +0 -101
  271. data/doc/files/lib/quickbooks/models/list_item_rb.html +0 -101
  272. data/doc/files/lib/quickbooks/models/transaction_rb.html +0 -101
  273. data/doc/files/lib/quickbooks/ruby_magic_rb.html +0 -120
  274. data/doc/files/lib/quickbooks_rb.html +0 -125
  275. data/doc/fr_class_index.html +0 -64
  276. data/doc/fr_file_index.html +0 -45
  277. data/doc/fr_method_index.html +0 -164
  278. data/doc/index.html +0 -24
  279. data/doc/rdoc-style.css +0 -208
  280. data/lib/qbxml.rb +0 -3
  281. data/lib/qbxml/request.rb +0 -207
  282. data/lib/qbxml/response.rb +0 -197
  283. data/lib/qbxml/support.rb +0 -130
  284. data/lib/quickbooks/adapters/qbxml_debug_adapter.rb +0 -10
  285. data/lib/quickbooks/base.rb +0 -277
  286. data/lib/quickbooks/models/common/address.rb +0 -14
  287. data/lib/quickbooks/models/common/all_refs.rb +0 -37
  288. data/lib/quickbooks/models/customer.rb +0 -70
  289. data/lib/quickbooks/models/customer/credit_card_info.rb +0 -5
  290. data/lib/quickbooks/models/deleted.rb +0 -22
  291. data/lib/quickbooks/models/list_item.rb +0 -41
  292. data/lib/quickbooks/models/transaction.rb +0 -49
  293. data/lib/quickbooks/ruby_magic.rb +0 -213
Binary file
@@ -0,0 +1,23 @@
1
+ === 0.9.0 / 2008-10-08
2
+
3
+ * First Release
4
+
5
+ === 0.9.2 / 2009-01-08
6
+
7
+ * Patches and updates
8
+
9
+ === 0.9.5 / 2009-02-20
10
+
11
+ * Restructured gem to generate from XSD dynamically instead of from DTD statically.
12
+
13
+ === 0.9.6 / 2009-03-10
14
+
15
+ * Fixed a couple bugs related to collection elements in responses.
16
+
17
+ === 0.9.7 / 2009-04-15
18
+
19
+ * Fixed conflicts with Rails / ActiveRecord / ActiveSupport.
20
+
21
+ === 0.9.8 / 2009-05-06
22
+
23
+ * A few minor enhancements; Made the :spew adapter default for ease of use in irb.
@@ -0,0 +1,54 @@
1
+ Copyright (c) 2008 BehindLogic <gems@behindlogic.com>
2
+
3
+ * THIS IS NOT FREE SOFTWARE!
4
+ Although I'd love for it to be free, the truth is it just took
5
+ SO MUCH WORK that I absolutely must get something out of it.
6
+ Please understand that in my opinion, to try to integrate with
7
+ QuickBooks from scratch would be nothing short of proposterous
8
+ with this ready-made gem looking you straight in the eye. I'll
9
+ just leave it at that. :)
10
+
11
+ * Use of the Trial Version
12
+ This is a trial version. For the most part, this is a working
13
+ copy that is restricted to working with a small set of QuickBooks
14
+ objects.
15
+
16
+ Use of the full version of this QuickBooks Rubygem is subject to a
17
+ fee. BehindLogic has developed this QuickBooks Rubygem out of its
18
+ own necessity and the necessity of others; and because of the large
19
+ number of hours required to complete such a task, BehindLogic has
20
+ decided to provide it to others for use at a decent fee. For the
21
+ current fee, visit behindlogic.com or contact gems@behindlogic.com.
22
+
23
+ * Extent of permission
24
+ This QuickBooks Rubygem shall only be used for its packaged
25
+ capabilities. It is provided as-is. You MAY NOT redistribute any
26
+ code contained within this library. You MAY NOT include any code
27
+ contained within this library within an open source project, when
28
+ in doing so effectively releases the code to the public. Remember,
29
+ the purpose of this License is to allow you to fully use this gem,
30
+ after you have paid your due. BehindLogic has spent countless
31
+ hours on this work, and seeks to be compensated over time for its
32
+ work.
33
+
34
+ * Support, Upgrades and Bugfixes
35
+ Agreement for Support will be discussed elsewhere, such as when you
36
+ communicate your purchase of a license from BehindLogic. Upgrades
37
+ are to be granted upon request at a fraction of the initial fee
38
+ paid. Upgrades are not guaranteed to be created for new versions of
39
+ QuickBooks, and the timeliness of this service is not guaranteed
40
+ since newer versions of QuickBooks aren't guaranteed by Intuit to
41
+ follow patterns of their predecessors. Incentive monies, to a
42
+ certain point, help to speed up the work when necessary. Bugfixes
43
+ will be treated with care and will be worked on for free; however,
44
+ again, timeliness is not guaranteed, but incentive monies can be
45
+ offered to expedite the bug squashing.
46
+
47
+ * PROVIDED AS IS!
48
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
49
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
50
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
51
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
52
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
53
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
54
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,73 @@
1
+ History.txt
2
+ License.txt
3
+ Manifest.txt
4
+ README.txt
5
+ Rakefile
6
+ lib/quickbooks.rb
7
+ lib/quickbooks/adaptability.rb
8
+ lib/quickbooks/adapters/http_adapter.rb
9
+ lib/quickbooks/adapters/https_adapter.rb
10
+ lib/quickbooks/adapters/ole_adapter.rb
11
+ lib/quickbooks/adapters/spew_adapter.rb
12
+ lib/quickbooks/adapters/tcp_adapter.rb
13
+ lib/quickbooks/adapters/test_adapter.rb
14
+ lib/quickbooks/element.rb
15
+ lib/quickbooks/element_collection.rb
16
+ lib/quickbooks/extlib.rb
17
+ lib/quickbooks/extlib/assertions.rb
18
+ lib/quickbooks/extlib/class.rb
19
+ lib/quickbooks/extlib/days_and_times.rb
20
+ lib/quickbooks/extlib/days_and_times/duration.rb
21
+ lib/quickbooks/extlib/days_and_times/numeric.rb
22
+ lib/quickbooks/extlib/days_and_times/object.rb
23
+ lib/quickbooks/extlib/days_and_times/time.rb
24
+ lib/quickbooks/extlib/hash.rb
25
+ lib/quickbooks/extlib/hook.rb
26
+ lib/quickbooks/extlib/inflection.rb
27
+ lib/quickbooks/extlib/logger.rb
28
+ lib/quickbooks/extlib/object.rb
29
+ lib/quickbooks/extlib/pathname.rb
30
+ lib/quickbooks/extlib/rubygems.rb
31
+ lib/quickbooks/extlib/string.rb
32
+ lib/quickbooks/extlib/time.rb
33
+ lib/quickbooks/model.rb
34
+ lib/quickbooks/option.rb
35
+ lib/quickbooks/property.rb
36
+ lib/quickbooks/ruby_ext.rb
37
+ lib/quickbooks/type.rb
38
+ lib/quickbooks/types.rb
39
+ lib/quickbooks/version.rb
40
+ lib/quickbooks/xsd.rb
41
+ lib/quickbooks/xsd/attribute.rb
42
+ lib/quickbooks/xsd/choice.rb
43
+ lib/quickbooks/xsd/complex_type.rb
44
+ lib/quickbooks/xsd/element.rb
45
+ lib/quickbooks/xsd/group.rb
46
+ lib/quickbooks/xsd/restriction.rb
47
+ lib/quickbooks/xsd/sequence.rb
48
+ lib/quickbooks/xsd/simple_type.rb
49
+ lib/quickbooks/xsd/union.rb
50
+ lib/quickbooks/xsd/validation.rb
51
+ lib/quickbooks/xsd/xml_parse.rb
52
+ quickbooks.gemspec
53
+ source/qbxml21_demo.xsd
54
+ source/qbxmlops_demo.xsd
55
+ source/qbxmltypes.xsd
56
+ spec/association_spec.rb
57
+ spec/element_collection_spec.rb
58
+ spec/find_spec.rb
59
+ spec/lib/quickbooks/element_spec.rb
60
+ spec/lib/quickbooks/elements/sales_order_add_spec.rb
61
+ spec/lib/quickbooks/elements/vendor_add_spec.rb
62
+ spec/lib/quickbooks/model_spec.rb
63
+ spec/lib/quickbooks/models/customer_spec.rb
64
+ spec/lib/quickbooks/models/invoice_spec.rb
65
+ spec/lib/quickbooks/models/sales_order_line_spec.rb
66
+ spec/lib/quickbooks/models/sales_order_spec.rb
67
+ spec/lib/quickbooks/xsd/choice_spec.rb
68
+ spec/pending_spec.rb
69
+ spec/quickbooks_spec.rb
70
+ spec/repeatable_spec.rb
71
+ spec/requires_spec.rb
72
+ spec/spec_helper.rb
73
+ spec/validation_spec.rb
@@ -0,0 +1,79 @@
1
+ = quickbooks
2
+
3
+ * http://behindlogic.com
4
+ * http://behindlogic.lighthouseapp.com/projects/32776
5
+
6
+ == DESCRIPTION:
7
+
8
+ The only comprehensive Ruby interface to Quickbooks. THIS IS A DEMO VERSION. Visit behindlogic.com for the full version, which works with all versions of QuickBooks.
9
+
10
+ == SYNOPSIS:
11
+
12
+ jim = QB::Customer.first(:fullname => ["Jim Stout"])
13
+ jim.destroy # Note that you cannot delete items in QuickBooks
14
+ # but you CAN delete them using the API.
15
+
16
+ == REQUIREMENTS:
17
+
18
+ NONE
19
+
20
+ == INSTALL:
21
+
22
+ gem install quickbooks
23
+
24
+ == LICENSE:
25
+
26
+ Copyright (c) 2008 BehindLogic <gems@behindlogic.com>
27
+
28
+ * THIS IS NOT FREE SOFTWARE!
29
+ Although I'd love for it to be free, the truth is it just took
30
+ SO MUCH WORK that I absolutely must get something out of it.
31
+ Please understand that in my opinion, to try to integrate with
32
+ QuickBooks from scratch would be nothing short of proposterous
33
+ with this ready-made gem looking you straight in the eye. I'll
34
+ just leave it at that. :)
35
+
36
+ * Use of the Trial Version
37
+ This is a trial version. For the most part, this is a working
38
+ copy that is restricted to working with a small set of QuickBooks
39
+ objects.
40
+
41
+ Use of the full version of this QuickBooks Rubygem is subject to a
42
+ fee. BehindLogic has developed this QuickBooks Rubygem out of its
43
+ own necessity and the necessity of others; and because of the large
44
+ number of hours required to complete such a task, BehindLogic has
45
+ decided to provide it to others for use at a decent fee. For the
46
+ current fee, visit behindlogic.com or contact gems@behindlogic.com.
47
+
48
+ * Extent of permission
49
+ This QuickBooks Rubygem shall only be used for its packaged
50
+ capabilities. It is provided as-is. You MAY NOT redistribute any
51
+ code contained within this library. You MAY NOT include any code
52
+ contained within this library within an open source project, when
53
+ in doing so effectively releases the code to the public. Remember,
54
+ the purpose of this License is to allow you to fully use this gem,
55
+ after you have paid your due. BehindLogic has spent countless
56
+ hours on this work, and seeks to be compensated over time for its
57
+ work.
58
+
59
+ * Support, Upgrades and Bugfixes
60
+ Agreement for Support will be discussed elsewhere, such as when you
61
+ communicate your purchase of a license from BehindLogic. Upgrades
62
+ are to be granted upon request at a fraction of the initial fee
63
+ paid. Upgrades are not guaranteed to be created for new versions of
64
+ QuickBooks, and the timeliness of this service is not guaranteed
65
+ since newer versions of QuickBooks aren't guaranteed by Intuit to
66
+ follow patterns of their predecessors. Incentive monies, to a
67
+ certain point, help to speed up the work when necessary. Bugfixes
68
+ will be treated with care and will be worked on for free; however,
69
+ again, timeliness is not guaranteed, but incentive monies can be
70
+ offered to expedite the bug squashing.
71
+
72
+ * PROVIDED AS IS!
73
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
74
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
75
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
76
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
77
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
78
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
79
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -1,82 +1,21 @@
1
- require 'rubygems'
2
- require 'rake'
3
- require 'rake/testtask'
4
- require 'rake/rdoctask'
5
- require 'rake/gempackagetask'
6
- require 'rake/contrib/rubyforgepublisher'
7
-
8
- PKG_NAME = 'quickbooks'
9
- PKG_VERSION = "0.4.0"
10
-
11
- PKG_FILES = FileList[
12
- "lib/**/*", "rspec/**/*", "[A-Z]*", "Rakefile", "doc/**/*"
13
- ]
14
-
15
- desc "Default Task"
16
- task :default => [ :test ] do
17
- # Run the unit tests
18
- desc "Run all rspec tests (rake task not yet implemented!)"
19
- end
20
-
21
- # Make a console, useful when working on tests
22
- desc "Generate a test console"
23
- task :console do
24
- verbose( false ) { sh "irb -I lib -r 'quickbooks'" }
25
- end
26
-
27
- # Genereate the RDoc documentation
28
- desc "Create documentation"
29
- Rake::RDocTask.new("doc") { |rdoc|
30
- rdoc.title = "QuickBooks for Ruby"
31
- rdoc.rdoc_dir = 'doc'
32
- rdoc.rdoc_files.include('README')
33
- rdoc.rdoc_files.include('LICENSE')
34
- rdoc.rdoc_files.include('lib/**/*.rb')
35
- }
1
+ # -*- ruby -*-
36
2
 
37
- # Generate the package
38
- spec = Gem::Specification.new do |s|
39
- #### Basic information.
40
- s.name = PKG_NAME
41
- s.version = PKG_VERSION
42
- s.platform = Gem::Platform::RUBY
43
- s.description = s.summary = "A module to connect to QuickBooks through the QuickBooks SDK using WIN32OLE (other connection types to come)."
44
-
45
- #### Dependencies.
46
- s.add_dependency('formattedstring', '>= 0.1.0')
47
- s.add_dependency('hash_magic', '>= 0.1.0')
48
-
49
- #### Which files are to be included in this gem? Everything! (Except CVS directories.)
50
- s.files = PKG_FILES
51
-
52
- #### Load-time details: library and application (you will need one or both).
53
- s.require_path = 'lib'
54
-
55
- #### Documentation and testing.
56
- s.has_rdoc = true
57
- s.extra_rdoc_files = ["README", "LICENSE"]
58
-
59
- #### Author and project details.
60
- s.author = "Daniel Parker"
61
- s.email = "gems@behindlogic.com"
62
- s.homepage = "http://quickbooks.rubyforge.org"
63
- s.rubyforge_project = 'quickbooks'
64
- end
65
-
66
- Rake::GemPackageTask.new(spec) do |pkg|
67
- pkg.need_zip = false
68
- pkg.need_tar = false
3
+ require 'rubygems'
4
+ gem 'hoe', '1.8.3'
5
+ require 'hoe'
6
+ require './lib/quickbooks.rb'
7
+ require './lib/quickbooks/version.rb'
8
+
9
+ hoe = Hoe.new('quickbooks', Quickbooks::VERSION::STRING) do |p|
10
+ p.developer('BehindLogic', 'gems@behindlogic.com')
11
+ p.test_globs = ["test/**/test_*.rb", "spec/**/*_spec.rb"]
12
+ p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
13
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
14
+ # p.extra_deps << ['extlib', '>= 0.9.6']
69
15
  end
70
16
 
71
- desc "Report code statistics (KLOCs, etc) from the application"
72
- task :stats do
73
- require 'code_statistics'
74
- CodeStatistics.new(
75
- ["Library", "lib"]
76
- ).to_s
17
+ # vim: syntax=Ruby
18
+ task :cultivate do
19
+ system "touch Manifest.txt; rake check_manifest | grep -v \"(in \" | patch"
20
+ system "rake debug_gem | grep -v \"(in \" > #{hoe.name}.gemspec"
77
21
  end
78
-
79
- desc "Publish new documentation"
80
- task :publish => [:doc] do
81
- `scp -r doc/* dcparker@rubyforge.org:/var/www/gforge-projects/quickbooks`
82
- end
@@ -1,7 +1,153 @@
1
- QUICKBOOKS_VERSION = '0.1.0'
2
- require 'quickbooks/base'
3
- require 'quickbooks/models/list_item'
4
- require 'quickbooks/models/transaction'
5
-
6
- require 'quickbooks/models/customer'
7
- require 'quickbooks/models/deleted'
1
+ require 'time'
2
+ gem_path = File.dirname(__FILE__)
3
+ $:.unshift(File.expand_path(gem_path)) unless $:.include?(gem_path) || $:.include?(File.expand_path(gem_path))
4
+
5
+ require 'quickbooks/extlib'
6
+ require 'quickbooks/ruby_ext'
7
+ require 'quickbooks/xsd'
8
+ require 'quickbooks/element_collection'
9
+ require 'quickbooks/element'
10
+ require 'quickbooks/model'
11
+ require 'quickbooks/adaptability'
12
+
13
+ # Use the QB constant to access any model or element class. QB::Customer will get the Customer model class,
14
+ # autogenerating it from the parsed specs if necessary. You can also access a class constant using the
15
+ # accessor method: QB['Customer']. Use QB.xsd if you want to browse the XSD data structure parsed from the
16
+ # specs at the current Quickbooks.qbxml_version.
17
+ module QB
18
+ class << self
19
+ def const_missing(const)
20
+ Quickbooks.get_constant(const)
21
+ end
22
+ alias :[] :const_missing
23
+
24
+ # Returns the XSD data structure parsed from the specs at the current Quickbooks.qbxml_version.
25
+ def xsd
26
+ Quickbooks.xsd(true)
27
+ end
28
+ end
29
+ end
30
+
31
+ module Quickbooks
32
+ # Just a placeholder for all Model classes.
33
+ module Models
34
+ end
35
+ # Just a placeholder for all Element classes.
36
+ module Elements
37
+ end
38
+ # Just a placeholder for all Property classes.
39
+ module Properties
40
+ end
41
+
42
+ ValidationError = Class.new(RuntimeError)
43
+ AttributeAssignmentError = Class.new(RuntimeError)
44
+ InvalidAttributeError = Class.new(AttributeAssignmentError)
45
+ QuickbooksAPIError = Class.new(RuntimeError)
46
+ HTTPConnectorError = Class.new(RuntimeError)
47
+
48
+ extend Adaptability
49
+
50
+ class << self
51
+
52
+ # Set or retrieve the current qbxml_version the gem is running at. If autoload is true, it will ask Quickbooks
53
+ # (via the current connection) for the qbxml versions it supports, then choose the latest that the gem also supports.
54
+ def qbxml_version(autoload=false)
55
+ @qbxml_version ||= if autoload
56
+ '2.1'
57
+ else
58
+ nil
59
+ end
60
+ end
61
+ def qbxml_version=(version)
62
+ warn "Only a subset of QBXML Version 2.1 is available in the demo."
63
+ @qbxml_version = '2.1'
64
+ # Load xsd right away?
65
+ # Also, could run a separate thread for loading this,
66
+ # then join it when needed and harvest the xsd from it.
67
+ # xsd(true)
68
+ end
69
+
70
+ # Returns the XSD data structure parsed from the current qbxml_version. If autoload is true, it will go ahead and parse the XSD for
71
+ # the current version if it is not already parsed and cached.
72
+ def xsd(autoload=false)
73
+ @xsd ||= {}
74
+ @xsd[qbxml_version(true)] || begin
75
+ @xsd[qbxml_version] = (autoload ? Quickbooks::XSD.parse_file("qbxmlops_demo.xsd", File.dirname(__FILE__) + "/../source/") : nil)
76
+ connector_error_xsd = <<ENDXSD
77
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
78
+ <xsd:element name="ErrorMessage">
79
+ <xsd:simpleType>
80
+ <xsd:restriction base="STRTYPE" />
81
+ </xsd:simpleType>
82
+ </xsd:element>
83
+
84
+ <xsd:element name="ConnectorError">
85
+ <xsd:complexType>
86
+ <xsd:sequence>
87
+ <xsd:element ref="ErrorMessage" />
88
+ </xsd:sequence>
89
+ </xsd:complexType>
90
+ </xsd:element>
91
+ ENDXSD
92
+ @xsd[qbxml_version].parse(connector_error_xsd)
93
+ end
94
+ @xsd[qbxml_version]
95
+ end
96
+
97
+ # Quickbooks.get_constant. See QB.
98
+ def get_constant(const)
99
+ const = const.to_s
100
+ return loaded_classes[const] if loaded_classes.has_key?(const)
101
+ # TODO: Need to auto-generate Models too!
102
+ # If const+'Ret' exists, generate a Model class for const.
103
+ if const_xsd = xsd(true)[const] || xsd(true)[const+'Ret'] || xsd(true)[const+'Add'] || xsd(true)[const+'Mod']
104
+ loaded_classes[const] = const_xsd.to_class(const)
105
+ else
106
+ raise RuntimeError, "The Quickbooks class '#{const}' could not be found (called from #{caller[1]}) in QBXML Version #{qbxml_version}. Please report to gems@behindlogic.com if you think this is a BUG! (#{xsd.inspect} : #{const.inspect} => #{xsd[const]})"
107
+ end
108
+ end
109
+
110
+ def send_qbxml(qbxml)
111
+ @last_response_xml = connection.send_xml("<?xml version=\"1.0\" ?>\n<?qbxml version=\"#{qbxml_version(true)}\" ?>\n#{qbxml}")
112
+ end
113
+
114
+ def send_request(request)
115
+ Quickbooks::Support.parse_xml(send_qbxml(request.to_xml))
116
+ end
117
+
118
+ def requestify(requestish)
119
+ QB::QBXMLMsgsRq.options[:onError].default = 'stopOnError'
120
+ request = requestish.class.name =~ /Rq$/ ? QB::QBXML.new(:QBXMLMsgsRq => [requestish]) : requestish
121
+ raise ValidationError, request.to_xml + "\n" + request.errors.join(', ') if !request.valid?
122
+ return request
123
+ end
124
+
125
+ def qbxml(&block)
126
+ raise ArgumentError unless block_given?
127
+ yield
128
+ end
129
+
130
+ # Execute a Request to Quickbooks and parse the answer back into QB gem objects.
131
+ def execute(requestish)
132
+ request = requestify(requestish)
133
+ response_klass_name = request[:QBXMLMsgsRq].attributes[0].class.short_name.gsub(/Rq/, 'Rs')
134
+ @last_response = send_request(request)
135
+ raise RuntimeError, "Response invalid!" unless @last_response.respond_to?(:[])
136
+ # Here, if the response we got was an error (<ConnectorError><ErrorMessage>...</ErrorMessage></ConnectorError>), deal with it now.
137
+ raise HTTPConnectorError, @last_response[:ConnectorError][:ErrorMessage] if @last_response[:ConnectorError]
138
+ raise RuntimeError, "Response did not include QBXMLMsgsRs." unless @last_response[:QBXMLMsgsRs]
139
+ raise RuntimeError, "Response not the right type (#{response_klass_name})." unless @last_response[:QBXMLMsgsRs][response_klass_name]
140
+ # raise RuntimeError, "Response has no results." unless @last_response[:QBXMLMsgsRs][response_klass_name][0].nil?
141
+ rs = @last_response[:QBXMLMsgsRs][response_klass_name][0]
142
+ if rs && rs['statusSeverity'] == 'Error'
143
+ raise QuickbooksAPIError, "##{rs['statusCode']}: #{rs['statusMessage']}"
144
+ end
145
+ @last_response
146
+ end
147
+
148
+ def loaded_classes
149
+ @loaded_classes ||= {}
150
+ @loaded_classes[qbxml_version(true)] ||= {}
151
+ end
152
+ end
153
+ end