ipp_quickbase_devkit 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (239) hide show
  1. data/LICENSE +87 -0
  2. data/README.rdoc +112 -0
  3. data/doc/QuickBaseClient.rb.htm +1896 -0
  4. data/doc/ReleaseNotes.txt +43 -0
  5. data/doc/qbc.makeCSVFile.qbc +4 -0
  6. data/doc/qbc.makeCSVFile.rb +4 -0
  7. data/doc/quickbase_adapter.rb.htm +399 -0
  8. data/examples/cookbookfiles/QuickBaseAPICookbook.html +2590 -0
  9. data/examples/cookbookfiles/addChangeRemoveUserRole.rb +21 -0
  10. data/examples/cookbookfiles/addOrEditRecord.rb +10 -0
  11. data/examples/cookbookfiles/application_object.rb +55 -0
  12. data/examples/cookbookfiles/applyRubyFormulas.rb +10 -0
  13. data/examples/cookbookfiles/average.rb +27 -0
  14. data/examples/cookbookfiles/backupApplication.rb +8 -0
  15. data/examples/cookbookfiles/cacheSchemas.rb +53 -0
  16. data/examples/cookbookfiles/calculateRunningTotals.rb +11 -0
  17. data/examples/cookbookfiles/copyrecords.rb +73 -0
  18. data/examples/cookbookfiles/count.rb +26 -0
  19. data/examples/cookbookfiles/createRecordNavigatorHTML.rb +42 -0
  20. data/examples/cookbookfiles/createReportDashboard.rb +35 -0
  21. data/examples/cookbookfiles/createTable.rb +12 -0
  22. data/examples/cookbookfiles/deviation.rb +25 -0
  23. data/examples/cookbookfiles/downloadCookbook.rb +97 -0
  24. data/examples/cookbookfiles/downloadFile.rb +10 -0
  25. data/examples/cookbookfiles/downloadFilesToFolder.rb +81 -0
  26. data/examples/cookbookfiles/downloadToTextFile.rb +64 -0
  27. data/examples/cookbookfiles/dumpSchema.rb +11 -0
  28. data/examples/cookbookfiles/duplicateRecord.rb +8 -0
  29. data/examples/cookbookfiles/dynamicMethods.rb +33 -0
  30. data/examples/cookbookfiles/editRecords.rb +15 -0
  31. data/examples/cookbookfiles/findJohnsLast10Records.rb +17 -0
  32. data/examples/cookbookfiles/findRubyRecords.rb +17 -0
  33. data/examples/cookbookfiles/formatCurrency.rb +24 -0
  34. data/examples/cookbookfiles/formatDate.rb +10 -0
  35. data/examples/cookbookfiles/formatDuration.rb +27 -0
  36. data/examples/cookbookfiles/formatPercent.rb +24 -0
  37. data/examples/cookbookfiles/getAllValuesForFields.rb +18 -0
  38. data/examples/cookbookfiles/getAppDTMInfo.rb +29 -0
  39. data/examples/cookbookfiles/getApplicationVariable.rb +5 -0
  40. data/examples/cookbookfiles/getChildTableDBID.rb +11 -0
  41. data/examples/cookbookfiles/getColumnListForReport.rb +6 -0
  42. data/examples/cookbookfiles/getFieldChoices.rb +13 -0
  43. data/examples/cookbookfiles/getFieldIDs.rb +6 -0
  44. data/examples/cookbookfiles/getFieldNames.rb +6 -0
  45. data/examples/cookbookfiles/getLastModTime.rb +8 -0
  46. data/examples/cookbookfiles/getLastRecModTime.rb +8 -0
  47. data/examples/cookbookfiles/getNumRecords.rb +8 -0
  48. data/examples/cookbookfiles/getNumTables.rb +4 -0
  49. data/examples/cookbookfiles/getRecord.rb +5 -0
  50. data/examples/cookbookfiles/getRecordDisplayURL.rb +13 -0
  51. data/examples/cookbookfiles/getRecordsAddedToday.rb +20 -0
  52. data/examples/cookbookfiles/getRecordsAsJSON.rb +6 -0
  53. data/examples/cookbookfiles/getReportNames.rb +25 -0
  54. data/examples/cookbookfiles/getRoleInfo.rb +48 -0
  55. data/examples/cookbookfiles/getServerStatus.rb +11 -0
  56. data/examples/cookbookfiles/getSortListForReport.rb +6 -0
  57. data/examples/cookbookfiles/getTableIDs.rb +6 -0
  58. data/examples/cookbookfiles/getTableName.rb +8 -0
  59. data/examples/cookbookfiles/getTableNames.rb +25 -0
  60. data/examples/cookbookfiles/getTimeCreated.rb +8 -0
  61. data/examples/cookbookfiles/getTimeInMilliseconds.rb +5 -0
  62. data/examples/cookbookfiles/getUserInfo.rb +26 -0
  63. data/examples/cookbookfiles/getUserRole.rb +15 -0
  64. data/examples/cookbookfiles/intranet.rb +101 -0
  65. data/examples/cookbookfiles/isAverageField.rb +17 -0
  66. data/examples/cookbookfiles/isDbidString.rb +8 -0
  67. data/examples/cookbookfiles/isTotalField.rb +16 -0
  68. data/examples/cookbookfiles/iterateDBPages.rb +8 -0
  69. data/examples/cookbookfiles/iterateFilteredRecords.rb +12 -0
  70. data/examples/cookbookfiles/iterateJoinRecords.rb +68 -0
  71. data/examples/cookbookfiles/iterateRecordInfos.rb +8 -0
  72. data/examples/cookbookfiles/iterateRecords.rb +23 -0
  73. data/examples/cookbookfiles/iterateSummaryRecords.rb +13 -0
  74. data/examples/cookbookfiles/iterateUnionRecords.rb +38 -0
  75. data/examples/cookbookfiles/listAccessibleApplications.rb +6 -0
  76. data/examples/cookbookfiles/logRequestAndResponseXML.rb +8 -0
  77. data/examples/cookbookfiles/lookupFieldPropertyByName.rb +62 -0
  78. data/examples/cookbookfiles/lookupFieldTypeByName.rb +10 -0
  79. data/examples/cookbookfiles/makeCSVFile.rb +4 -0
  80. data/examples/cookbookfiles/makeSlideShow.rb +42 -0
  81. data/examples/cookbookfiles/makerecs.rb +64 -0
  82. data/examples/cookbookfiles/max.rb +26 -0
  83. data/examples/cookbookfiles/min.rb +26 -0
  84. data/examples/cookbookfiles/percent.rb +29 -0
  85. data/examples/cookbookfiles/printChildElements.rb +54 -0
  86. data/examples/cookbookfiles/printNewRecords.rb +12 -0
  87. data/examples/cookbookfiles/processRESTRequest.rb +21 -0
  88. data/examples/cookbookfiles/provisionAndInviteNewUser.rb +13 -0
  89. data/examples/cookbookfiles/purgeRecords.rb +15 -0
  90. data/examples/cookbookfiles/quickbase_adapter.rb.htm +397 -0
  91. data/examples/cookbookfiles/quickbase_record_finder.zip +0 -0
  92. data/examples/cookbookfiles/recordAndFieldIterator.rb +24 -0
  93. data/examples/cookbookfiles/runImport.rb +9 -0
  94. data/examples/cookbookfiles/runQuickBaseTwitterConnector.rb +41 -0
  95. data/examples/cookbookfiles/sendToQuickBase.rb +33 -0
  96. data/examples/cookbookfiles/setDBvar.rb +6 -0
  97. data/examples/cookbookfiles/showRequestAndResponseXML.rb +8 -0
  98. data/examples/cookbookfiles/sqlQuery.rb +11 -0
  99. data/examples/cookbookfiles/stopOnError.rb +10 -0
  100. data/examples/cookbookfiles/sum.rb +26 -0
  101. data/examples/cookbookfiles/twitterFromQuickBase.rb +42 -0
  102. data/examples/cookbookfiles/twitterWithQuickBase.rb +36 -0
  103. data/examples/cookbookfiles/uploadCSVData.rb +20 -0
  104. data/examples/cookbookfiles/uploadExcelData.rb +22 -0
  105. data/examples/cookbookfiles/uploadFileEveryHour.rb +18 -0
  106. data/examples/cookbookfiles/uploadFileIntoNewRecord.rb +8 -0
  107. data/examples/cookbookfiles/uploadFilesFromFolder.exe +0 -0
  108. data/examples/cookbookfiles/uploadFilesFromFolder.rb +69 -0
  109. data/examples/cookbookfiles/useCompanyURL.rb +12 -0
  110. data/examples/cookbookfiles/userRoles.rb +49 -0
  111. data/examples/cookbookfiles/watchCommunityForum.rb +5 -0
  112. data/examples/cookbookfiles/wikifyTable.rb +29 -0
  113. data/examples/cookbookfiles/xmlShortcuts.rb +33 -0
  114. data/examples/pmp/app/controllers/application.rb +7 -0
  115. data/examples/pmp/app/controllers/contacts_controller.rb +8 -0
  116. data/examples/pmp/app/controllers/document_library_controller.rb +2 -0
  117. data/examples/pmp/app/controllers/issues_controller.rb +5 -0
  118. data/examples/pmp/app/controllers/projects_controller.rb +22 -0
  119. data/examples/pmp/app/controllers/resources_controller.rb +2 -0
  120. data/examples/pmp/app/controllers/tasks_controller.rb +13 -0
  121. data/examples/pmp/app/controllers/time_cards_controller.rb +5 -0
  122. data/examples/pmp/app/helpers/application_helper.rb +3 -0
  123. data/examples/pmp/app/helpers/contacts_helper.rb +2 -0
  124. data/examples/pmp/app/helpers/document_library_helper.rb +2 -0
  125. data/examples/pmp/app/helpers/issues_helper.rb +2 -0
  126. data/examples/pmp/app/helpers/projects_helper.rb +2 -0
  127. data/examples/pmp/app/helpers/resources_helper.rb +2 -0
  128. data/examples/pmp/app/helpers/tasks_helper.rb +2 -0
  129. data/examples/pmp/app/helpers/time_cards_helper.rb +2 -0
  130. data/examples/pmp/app/models/contacts.rb +26 -0
  131. data/examples/pmp/app/models/document_library.rb +2 -0
  132. data/examples/pmp/app/models/issues.rb +6 -0
  133. data/examples/pmp/app/models/projects.rb +26 -0
  134. data/examples/pmp/app/models/resources.rb +2 -0
  135. data/examples/pmp/app/models/tasks.rb +12 -0
  136. data/examples/pmp/app/models/time_cards.rb +7 -0
  137. data/examples/pmp/app/schemas/contacts.xml +1 -0
  138. data/examples/pmp/app/schemas/document_library.xml +1 -0
  139. data/examples/pmp/app/schemas/issues.xml +1 -0
  140. data/examples/pmp/app/schemas/pmp.xml +1 -0
  141. data/examples/pmp/app/schemas/projects.xml +1 -0
  142. data/examples/pmp/app/schemas/readme.txt +8 -0
  143. data/examples/pmp/app/schemas/resources.xml +1 -0
  144. data/examples/pmp/app/schemas/tasks.xml +1 -0
  145. data/examples/pmp/app/schemas/time_cards.xml +1 -0
  146. data/examples/pmp/app/views/contacts/companies.rhtml +31 -0
  147. data/examples/pmp/app/views/contacts/project_contacts.rhtml +31 -0
  148. data/examples/pmp/app/views/issues/filter_issues.rhtml +26 -0
  149. data/examples/pmp/app/views/layouts/application.rhtml +56 -0
  150. data/examples/pmp/app/views/projects/all_projects.rhtml +33 -0
  151. data/examples/pmp/app/views/projects/home.rhtml +11 -0
  152. data/examples/pmp/app/views/projects/my_open_projects.rhtml +27 -0
  153. data/examples/pmp/app/views/projects/open_projects.rhtml +44 -0
  154. data/examples/pmp/app/views/projects/project_sorted_by_company.rhtml +40 -0
  155. data/examples/pmp/app/views/projects/projects_sorted_by_priority.rhtml +30 -0
  156. data/examples/pmp/app/views/projects/updated_projects.rhtml +0 -0
  157. data/examples/pmp/app/views/tasks/all_tasks.rhtml +27 -0
  158. data/examples/pmp/app/views/tasks/search.rhtml +23 -0
  159. data/examples/pmp/app/views/tasks/search2.rhtml +23 -0
  160. data/examples/pmp/app/views/tasks/search3.rhtml +23 -0
  161. data/examples/pmp/app/views/time_cards/summary.rhtml +38 -0
  162. data/examples/pmp/config/boot.rb +45 -0
  163. data/examples/pmp/config/database.yml +30 -0
  164. data/examples/pmp/config/environment.rb +60 -0
  165. data/examples/pmp/config/environments/development.rb +21 -0
  166. data/examples/pmp/config/environments/production.rb +18 -0
  167. data/examples/pmp/config/environments/test.rb +19 -0
  168. data/examples/pmp/config/routes.rb +23 -0
  169. data/examples/pmp/db/migrate/001_create_projects.rb +10 -0
  170. data/examples/pmp/db/migrate/002_create_tasks.rb +10 -0
  171. data/examples/pmp/db/migrate/003_create_issues.rb +10 -0
  172. data/examples/pmp/db/migrate/004_create_document_libraries.rb +10 -0
  173. data/examples/pmp/db/migrate/005_create_resources.rb +10 -0
  174. data/examples/pmp/db/migrate/006_create_time_cards.rb +10 -0
  175. data/examples/pmp/db/migrate/007_create_contacts.rb +10 -0
  176. data/examples/pmp/public/404.html +30 -0
  177. data/examples/pmp/public/500.html +30 -0
  178. data/examples/pmp/public/app.index.html +277 -0
  179. data/examples/pmp/public/dispatch.cgi +10 -0
  180. data/examples/pmp/public/dispatch.fcgi +24 -0
  181. data/examples/pmp/public/dispatch.rb +10 -0
  182. data/examples/pmp/public/favicon.ico +0 -0
  183. data/examples/pmp/public/images/rails.png +0 -0
  184. data/examples/pmp/public/javascripts/application.js +2 -0
  185. data/examples/pmp/public/javascripts/controls.js +833 -0
  186. data/examples/pmp/public/javascripts/dragdrop.js +942 -0
  187. data/examples/pmp/public/javascripts/effects.js +1088 -0
  188. data/examples/pmp/public/javascripts/prototype.js +2515 -0
  189. data/examples/pmp/public/robots.txt +1 -0
  190. data/examples/pmp/test/fixtures/contacts.yml +5 -0
  191. data/examples/pmp/test/fixtures/document_libraries.yml +5 -0
  192. data/examples/pmp/test/fixtures/issues.yml +5 -0
  193. data/examples/pmp/test/fixtures/projects.yml +5 -0
  194. data/examples/pmp/test/fixtures/resources.yml +5 -0
  195. data/examples/pmp/test/fixtures/tasks.yml +5 -0
  196. data/examples/pmp/test/fixtures/time_cards.yml +5 -0
  197. data/examples/pmp/test/functional/contacts_controller_test.rb +18 -0
  198. data/examples/pmp/test/functional/document_library_controller_test.rb +18 -0
  199. data/examples/pmp/test/functional/issues_controller_test.rb +18 -0
  200. data/examples/pmp/test/functional/projects_controller_test.rb +18 -0
  201. data/examples/pmp/test/functional/resources_controller_test.rb +18 -0
  202. data/examples/pmp/test/functional/tasks_controller_test.rb +18 -0
  203. data/examples/pmp/test/functional/time_cards_controller_test.rb +18 -0
  204. data/examples/pmp/test/test_helper.rb +28 -0
  205. data/examples/pmp/test/unit/contacts_test.rb +10 -0
  206. data/examples/pmp/test/unit/document_library_test.rb +10 -0
  207. data/examples/pmp/test/unit/issues_test.rb +10 -0
  208. data/examples/pmp/test/unit/projects_test.rb +10 -0
  209. data/examples/pmp/test/unit/resources_test.rb +10 -0
  210. data/examples/pmp/test/unit/tasks_test.rb +10 -0
  211. data/examples/pmp/test/unit/time_cards_test.rb +10 -0
  212. data/lib/QuickBaseClient.rb +5054 -0
  213. data/lib/QuickBaseCommandLineClient.rb +401 -0
  214. data/lib/QuickBaseContactsAppBuilder.rb +419 -0
  215. data/lib/QuickBaseEmailer.rb +334 -0
  216. data/lib/QuickBaseEventNotifier.rb +592 -0
  217. data/lib/QuickBaseMisc.rb +96 -0
  218. data/lib/QuickBaseObjects.rb +566 -0
  219. data/lib/QuickBaseRSSGenerator.rb +286 -0
  220. data/lib/QuickBaseTextData.rb +545 -0
  221. data/lib/QuickBaseTwitterConnector.rb +300 -0
  222. data/lib/QuickBaseWebClient.rb +126 -0
  223. data/lib/WorkPlaceClient.rb +45 -0
  224. data/lib/qbc.makeCSVFile.qbc +4 -0
  225. data/lib/qbc.makeCSVFile.rb +17 -0
  226. data/lib/quickbase_adapter.rb +320 -0
  227. data/lib/runFieldEntryDialog.rb +151 -0
  228. data/lib/runOfflineFieldEntryDialog.rb +203 -0
  229. data/rakefile +100 -0
  230. data/test/run_tests.bat +7 -0
  231. data/test/spec_all_tests.rb +13 -0
  232. data/test/spec_smoke_tests.rb +58 -0
  233. data/test/spec_workplace_addrecord_test.rb +46 -0
  234. data/test/spec_workplace_base_test.rb +57 -0
  235. data/test/spec_workplace_editrecord_test.rb +38 -0
  236. data/test/spec_workplace_json_test.rb +38 -0
  237. data/test/spec_workplace_objects_test.rb +39 -0
  238. data/test/spec_workplace_smoke_tests.rb +45 -0
  239. metadata +353 -0
data/LICENSE ADDED
@@ -0,0 +1,87 @@
1
+ Eclipse Public License -v 1.0
2
+
3
+ THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
4
+
5
+ 1. DEFINITIONS
6
+
7
+ "Contribution" means:
8
+
9
+ a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
10
+
11
+ b) in the case of each subsequent Contributor:
12
+
13
+ i) changes to the Program, and
14
+
15
+ ii) additions to the Program;
16
+
17
+ where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.
18
+
19
+ "Contributor" means any person or entity that distributes the Program.
20
+
21
+ "Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.
22
+
23
+ "Program" means the Contributions distributed in accordance with this Agreement.
24
+
25
+ "Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
26
+
27
+ 2. GRANT OF RIGHTS
28
+
29
+ a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.
30
+
31
+ b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
32
+
33
+ c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.
34
+
35
+ d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.
36
+
37
+ 3. REQUIREMENTS
38
+
39
+ A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
40
+
41
+ a) it complies with the terms and conditions of this Agreement; and
42
+
43
+ b) its license agreement:
44
+
45
+ i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
46
+
47
+ ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
48
+
49
+ iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and
50
+
51
+ iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.
52
+
53
+ When the Program is made available in source code form:
54
+
55
+ a) it must be made available under this Agreement; and
56
+
57
+ b) a copy of this Agreement must be included with each copy of the Program.
58
+
59
+ Contributors may not remove or alter any copyright notices contained within the Program.
60
+
61
+ Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution.
62
+
63
+ 4. COMMERCIAL DISTRIBUTION
64
+
65
+ Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.
66
+
67
+ For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.
68
+
69
+ 5. NO WARRANTY
70
+
71
+ EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
72
+
73
+ 6. DISCLAIMER OF LIABILITY
74
+
75
+ EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
76
+
77
+ 7. GENERAL
78
+
79
+ If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
80
+
81
+ If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.
82
+
83
+ All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.
84
+
85
+ Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
86
+
87
+ This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.
data/README.rdoc ADDED
@@ -0,0 +1,112 @@
1
+ = ipp_quickbase_devkit , ipp_quickbase_devkit_jruby
2
+
3
+ The ipp_quickbase_devkit is a Ruby client for database applications on
4
+ http://www.quickbase.com and http://workplace.intuit.com.
5
+ The Intuit Partner Platform (IPP) uses QuickBase applications on http://workplace.intuit.com.
6
+
7
+ A separate ipp_quickbase_devkit_jruby exists for JRuby that simplifies installation and setup.
8
+
9
+ == Installation
10
+
11
+ You will need Ruby version 1.8.6 or higher to use the devkit, or JRuby 1.3.1 or higher.
12
+
13
+ To install the devkit for regular Ruby, enter:
14
+
15
+ ==== gem install ipp_quickbase_devkit --source http://code.intuit.com/gems (Note: Location is TBD as of 8/15/09)
16
+
17
+
18
+ For JRuby, enter:
19
+
20
+ ==== gem install ipp_quickbase_devkit_jruby --source http://code.intuit.com/gems (Note: Location is TBD as of 8/15/09)
21
+
22
+
23
+ To verify that the gem was installed, enter:
24
+
25
+ ==== ruby -e "require 'rubygems' ; require 'QuickBaseCommandLineClient' ; QuickBase::CommandLineClient.new.run"
26
+
27
+ This will start a command-line interface to www.quickbase.com.
28
+ If you have an account on www.quickbase.com, enter:
29
+
30
+ ==== si <username> <password>
31
+
32
+ Otherwise, if you have an account on workplace.intuit.com, enter:
33
+
34
+ ==== ruby setHTTPConnectionAndqbhost( true, "workplace", "intuit")
35
+
36
+ then enter:
37
+
38
+ ==== si <username> <password>
39
+
40
+ To list the applications you can access, enter:
41
+
42
+ ==== la
43
+
44
+ To quit the command-line client, enter:
45
+
46
+ ==== q
47
+
48
+
49
+ == Getting started
50
+
51
+ The guts of the Ruby devkit is a wrapper for the QuickBase HTTP API, described here[http://member.developer.intuit.com/MyIDN/technical_resources/quickbase/framework/httpapiref/HTML_API_Programmers_Guide.htm].
52
+
53
+ Each API call has a matching Ruby method in the wrapper, with parameters and return values that match the API.
54
+ Class QuickBase::Client in the QuickBaseClient.rb file contains these API methods, and numerous additional methods
55
+ aimed at reducing the effort needed to interact with QuickBase. QuickBase::Client holds on to the values returned from
56
+ QuickBase in @member variables. Check out the (relatively new) QuickBase::Objects if you prefer working with
57
+ classes that encapsulate the core entities in QuickBase.
58
+
59
+ By default, QuickBase::Client points at www.quickbase.com. Since the IPP is on workplace.intuit.com, there
60
+ is a QuickBase::WorkPlaceClient in WorkPlaceClient.rb that points at workplace.intuit.com by default.
61
+
62
+ Reading the HTTP API and playing with the QuickBase::CommandLineClient is good way to get an idea of how the
63
+ HTTP API works, and how the devkit builds on it.
64
+
65
+ == Running tests
66
+
67
+ The unit tests expect that 'rubygems' is required outside of the tests themselves. To ensure that the tests run, add
68
+ the following to your .profile (or equivalent):
69
+
70
+ ==== export RUBYOPT=-rubygems
71
+
72
+ Then run
73
+
74
+ ==== rake spec
75
+
76
+ to execute the unit tests.
77
+
78
+ == Example code
79
+
80
+ The examples/cookbookfiles folder contains about 100 example Ruby source files, with documentation in cookbook
81
+ form (examples/cookbookfiles/QuickBaseAPICookbook.html). It is a local version of the QuickBase API CookBook, a
82
+ public QuickBase application located here[https://www.quickbase.com/db/bcdcajmrf].
83
+
84
+ == Documentation
85
+
86
+ Apart from the RDoc documentation (which you are probably looking at), there is older documentation in the
87
+ doc/QuickBaseClient.rb.htm file. This document was valid until July 2009, and reflects the last 'pre-IPP' version of
88
+ the devkit, which is still available here[https://www.quickbase.com/db/8emtadvk?a=dr&r=ztj&rl=cjtm].
89
+
90
+ The doc/quickbase_adapter.rb.htm file describes that Rails adapater for QuickBase, which comes with this devkit.
91
+ A separate Ruby gem will be created for the adapter soon.
92
+
93
+ == History
94
+
95
+ The ipp_quickbase_devkit started life in 2005 as a script to generate burndown charts in a Scrum application created
96
+ in QuickBase. The application is available in the {QuickBase Application Library}[https://www.quickbase.com/db/bbtt9cjr7?a=dr&rid=438]
97
+ and is also visible here[https://www.quickbase.com/db/bcy6rhgvc].
98
+
99
+ From there it evolved into the {'Ruby Wrapper for the QuickBase HTTP API'}[https://www.quickbase.com/db/8emtadvk?a=dr&r=ztj&rl=cjtm], and
100
+ QuickBase users at numerous companies have found it useful.
101
+
102
+ In June 2009 it was well positioned to become a component of the Intuit Partner Platform, with some tidying
103
+ up and improved documentation.
104
+
105
+ == License
106
+
107
+ Copyright (c) 2009 Gareth Lewis and Intuit, Inc.
108
+
109
+ All rights reserved. This program and the accompanying materials
110
+ are made available under the terms of the Eclipse Public License v1.0
111
+ which accompanies this distribution, and is available at
112
+ http://www.opensource.org/licenses/eclipse-1.0.php
@@ -0,0 +1,1896 @@
1
+
2
+ <html>
3
+ <head>
4
+ <title>
5
+ QuickBaseClient.rb: A Ruby language wrapper for the QuickBase HTTP API
6
+ </title>
7
+ </head>
8
+ <body>
9
+
10
+ <font face="Arial">
11
+ <br>
12
+ <br>
13
+
14
+ <h2><a href="QuickBaseClient.rb">QuickBaseClient.rb</a>: A Ruby language wrapper for the QuickBase HTTP API</h2>
15
+
16
+ This document explains what <a href="QuickBaseClient.rb">QuickBaseClient.rb</a> is and the kinds of tasks it is suited for, and provides examples of how to accomplish those tasks.
17
+ The 2/13/2006 version of this document can be considered about 3/4trs complete; some sections are obviously waiting to be filled in and a couple more sections need to be added.
18
+
19
+ <h3>What is <a href="QuickBaseClient.rb">QuickBaseClient.rb</a>?</h3>
20
+
21
+ <a href="QuickBaseClient.rb">QuickBaseClient.rb</a> is collection of routines written in the Ruby programming language that enable developers to create, modify and query QuickBase applications using the Ruby language. The core routines closely mimic the 'API_' items described in the <a href="https://www.quickbase.com/up/6mztyxu8/g/rc7/en/va/QuickBaseAPI.htm">QuickBase HTTP API Reference document</a>. Additional 'helper' routines are included that reduce the amount of code developers must write to accomplish common tasks.
22
+ <p>
23
+ Also included in <a href="QuickBaseClient.rb">QuickBaseClient.rb</a> is a simple utility that allows users to type commands at a prompt to access and manipulate QuickBase applications. Commands may be recorded into files and 'replayed' later. <a href="QuickBaseClient.rb">QuickBaseClient.rb</a> contains a tiny web server that can 'replay' command files specified in a browser Address box or in a link in a web page.
24
+ </p>
25
+
26
+ <h3>Who is responsible for <a href="QuickBaseClient.rb">QuickBaseClient.rb</a>?</h3>
27
+
28
+ <a href="QuickBaseClient.rb">QuickBaseClient.rb</a> was created by Gareth Lewis who is an Intuit employee but isn't a member of the QuickBase team. It is currently maintained by Gareth outside his normal work hours.
29
+
30
+ <h3>Who should use <a href="QuickBaseClient.rb">QuickBaseClient.rb</a>?</h3>
31
+ <ol>
32
+ <li>People responsible for maintaining or enhancing QuickBase applications, especially people with programming experience.
33
+ <li>Software developers who want to include QuickBase in the 'back end' for applications.
34
+ <li>Non-programmers who use small programs written for them may find it straightforward to make minor changes to the programs that
35
+ use <a href="QuickBaseClient.rb">QuickBaseClient.rb</a>.
36
+ <li>Any QuickBase user willing to learn the commands available in the 'CommandLineClient' utility in <a href="QuickBaseClient.rb">QuickBaseClient.rb</a>.
37
+ </ol>
38
+
39
+ <h3>What kinds of things can <a href="QuickBaseClient.rb">QuickBaseClient.rb</a> be used for?</h3>
40
+
41
+ <ol>
42
+ <li>Creating large numbers of records that vary slightly. An example is creating a record for every day
43
+ between two dates entered by the user.
44
+ <li>Modifying fields in a large numbers of records, especially when 'search and replace' is insufficient. An example is to prepend 'Mr. ' to a 'Name' field
45
+ if a 'Male' box is checked.
46
+ <li>Setting fields based on data in multiple other records or tables. For example, a field could total the number of records in a
47
+ table specifed by the user that contain a value specified by the user.
48
+ <li>Creating records automatically at specified times or when certain events occur, such as when a computer is turned on, after a
49
+ particular user enters a record in another database or clicks a link field in a QuickBase record, or to make QuickBase send an email every hour until a certain time.
50
+ <li>Transforming records into useful formats not directly supported by QuickBase, such as RSS, PDF or JSON files, and storing them in QuickBase.
51
+ <li>Typing a single command instead of going through a series of steps to accomplish a daily task. For example, uploading the latest copy
52
+ of a spreadsheet into particular database record by typing 'upf'.
53
+ <li>Integrating QuickBase with other applications, including applications not written in Ruby. An example might be an instant messenger written
54
+ in C# that saves instant message sessions in QuickBase. Another example is to update a stock price field in QuickBase by reading
55
+ it from another website.
56
+ <li>Emailing data from QuickBase using your own 'From:' email address.
57
+ <li>Triggering any of the above by clicking a link in any web page or by typing the link into a browser Address box.
58
+ For example, clicking a link in a QuickBase record could upload the latest copy of a file from another user's computer into a different QuickBase table.
59
+ </ol>
60
+
61
+ <p>
62
+ Like the Java, Perl and Visual Basic SDKs for QuickBase, <a href="QuickBaseClient.rb">QuickBaseClient.rb</a> is limited by the amount of functionality that
63
+ QuickBase allows external programs to access via its HTTP API. Like those SDK languages, Ruby is a full-fledged programming
64
+ language with unlimited ability to create and transform data and present it in different formats. The 'sweet spot' for
65
+ these SDKs and <a href="QuickBaseClient.rb">QuickBaseClient.rb</a> is small applications and utilities that are straightforward to create, integrate with
66
+ QuickBase and other applications, and manipulate QuickBase data in ways that are difficult to accomplish through the QuickBase UI.
67
+ Ruby's particular sweet spot is similar to Perl's: utilities with limited UI requirements that automate tedious
68
+ data manipulation tasks or that link applications together. Ruby owes a lot to Perl, but its Smalltalk heritage makes
69
+ Ruby a conceptually (and visually!) cleaner language and especially pleasant to work in.
70
+
71
+
72
+ <h3>What should <a href="QuickBaseClient.rb">QuickBaseClient.rb</a> <i>not</i> be used for?</h3>
73
+ <ol>
74
+ <li>Anything that is much easier to do 'manually' in the browser.
75
+ </ol>
76
+
77
+ <h3>What is required to get started with <a href="QuickBaseClient.rb">QuickBaseClient.rb</a>?</h3>
78
+ <ol>
79
+ <li>The Ruby language interpreter. There is a great <a href="http://rubyinstaller.rubyforge.org/wiki/wiki.pl">One-click Ruby installer for Windows</a>.
80
+ For other operating systems, go to the <a href="http://www.ruby-lang.org/en/">Ruby homepage</a>
81
+ <li>Access to <a href="http://www.quickbase.com">QuickBase</a> (of course!).
82
+ <li>The <a href="QuickBaseClient.rb">QuickBaseClient.rb</a> file.
83
+ <li><a href="QuickBaseClient.rb">QuickBaseClient.rb</a> will make a lot more sense once you've read the <a href="https://www.quickbase.com/up/6mztyxu8/g/rc7/en/va/QuickBaseAPI.htm">QuickBase HTTP API Reference document</a>.
84
+ <li>If you are new to Ruby, the best book to read is <a href="http://pragmaticprogrammer.com/titles/ruby/index.html">Programming Ruby</a>. The first edition
85
+ of the book is <a href="http://www.rubycentral.com/book/index.html">free online</a> and is also installed as part of the <a href="http://rubyinstaller.rubyforge.org/wiki/wiki.pl">One-click Ruby installer for Windows</a>.
86
+ <li>Any text editor can be used to write Ruby programs, but the (free!) Scite editor installed with the <a href="http://rubyinstaller.rubyforge.org/wiki/wiki.pl">One-click Ruby installer for Windows</a> has
87
+ good support for editing and running Ruby programs, and the ActiveState Komodo product is likely to be very good.
88
+ </ol>
89
+ <p>
90
+ Please remember that it's always a good idea to back up important data before trying out any program or utility that modifies the data.
91
+ In QuickBase, an application can be copied using the <b>Go To</b> menu, selecting Miscellaneous, then 'Copy with Data'. It is also possible to
92
+ copy applications using this Ruby wrapper.
93
+
94
+ <h3>A simple Ruby program that uses <a href="QuickBaseClient.rb">QuickBaseClient.rb</a></h3>
95
+
96
+ <font color="blue">
97
+ <pre>
98
+ require 'QuickBaseClient'
99
+ qbc = QuickBase::Client.new( "my_username", "my_password", "My QuickBase Database" )
100
+ qbc.makeSVFile( "MyCSVFile.csv" )
101
+ qbc.signOut
102
+ </pre>
103
+ </font>
104
+ <font color="black">
105
+
106
+ <h3>A command file that achieves the same results</h3>
107
+
108
+ <font color="blue">
109
+ <pre>
110
+ signin my_username my_password
111
+ open My QuickBase Database
112
+ exportfile MyCSVFile.csv
113
+ quit
114
+ </pre>
115
+ </font>
116
+ <font color="black">
117
+
118
+ <h3>An explanation of the program and the command file</h3>
119
+
120
+ <b>The program:</b>
121
+ <br>
122
+ <br>
123
+ <font color="blue">
124
+ require 'QuickBaseClient'
125
+ </font>
126
+ <font color="black">
127
+ <br>
128
+ This line tells Ruby to find <a href="QuickBaseClient.rb">QuickBaseClient.rb</a> and make its contents available for this program.
129
+ <br>
130
+ <br>
131
+
132
+ <font color="blue">
133
+ qbc = QuickBase::Client.new( "my_username", "my_password", "My QuickBase Database" )
134
+ </font>
135
+ <font color="black">
136
+ <br>
137
+ This line signs into QuickBase using the specified user name and password using the QuickBase API_Authenticate call, and finds the application
138
+ named "My QuickBase Database" using the API_FindDBbyName call. If the username and password are valid, subsequent requests to QuickBase
139
+ include a 'ticket' instead of the username and password. QuickBase::Client keeps the ticket in its @ticket
140
+ variable. The active QuickBase application or table has an id, which you can see in your browser's Address box when a
141
+ QuickBase application is open. QuickBase::Client keeps this id in @dbid so that it doesn't have to be specified
142
+ for every request to the active table.
143
+ <br>
144
+
145
+ <br>
146
+ <br>
147
+ <font color="blue">
148
+ qbc.makeSVFile( "MyCSVFile.csv" )
149
+ </font>
150
+ <font color="black">
151
+ <br>
152
+ This line runs a query to retrieve all the records and fields from "My QuickBase Database" and write
153
+ the results to a CSV (comma-separated values) file called MyCSVFile.csv. The field names are
154
+ written on the first line of the file. Fields that contain a comma are surrounded by quotes. To change the
155
+ field separator from a comma to something else, a second parameter can be supplied, e.g. <font color="blue">qbc.makeSVFile( "MyTSVFile.txt", "\t" )</font>
156
+ will create a TAB-delimited file.
157
+ <font color="black">
158
+
159
+ <br>
160
+ <br>
161
+ <font color="blue">
162
+ qbc.signOut
163
+ </font>
164
+ <font color="black">
165
+ <br>
166
+ This line signs out of QuickBase.
167
+ <br>
168
+ <br>
169
+ <b>The command file:</b>
170
+ <br>
171
+ <br>
172
+ <font color="blue">
173
+ signin my_username my_password
174
+ </font>
175
+ <font color="black">
176
+ <br>
177
+ This line signs into QuickBase as the user "my_username", with the password "my_password".
178
+
179
+ <br>
180
+ <br>
181
+ <font color="blue">
182
+ open My QuickBase Database
183
+ </font>
184
+ <font color="black">
185
+ <br>
186
+ This line makes "My QuickBase Database" the active application.
187
+
188
+ <br>
189
+ <br>
190
+ <font color="blue">
191
+ exportfile MyCSVFile.csv
192
+ </font>
193
+ <font color="black">
194
+
195
+ <br>
196
+ This line queries all the records and fields from "My QuickBase Database"
197
+ and writes the results to MyCSVFile.csv.
198
+
199
+
200
+ <br>
201
+ <br>
202
+ <font color="blue">
203
+ quit
204
+ </font>
205
+ <font color="black">
206
+
207
+ <br>
208
+ This line automatically signs out QuickBase then ends the command session.
209
+
210
+ <h3>Running the program and the command file</h3>
211
+ <b>To run the program:-</b>
212
+ <ol>
213
+ <li>
214
+ Open the <a href="qbc.makeCSVFile.rb">qbc.makeCSVFile.rb</a> file.
215
+ <li>Change the username, password, application name to something valid that you can access.
216
+ <li>Change 'MyCSVFile.csv' to another file name, if you prefer.
217
+ <li>At the operating system prompt, type <font color="blue">ruby qbc.makeCSVFile.rb</font><font color="black">.
218
+ </ol>
219
+
220
+ <b>To run the command file:-</b>
221
+ <ol>
222
+ <li>
223
+ Open the <a href="qbc.makeCSVFile.qbc">qbc.makeCSVFile.qbc</a> file.
224
+ <li>Change the username, password, application name to something valid that you can access.
225
+ <li>Change 'MyCSVFile.csv' to another file name, if you prefer.
226
+ <li>At the operating system prompt, type <font color="blue">ruby <a href="QuickBaseClient.rb">QuickBaseClient.rb</a> run qbc.makeCSVFile.qbc</font><font color="black">.
227
+ </ol>
228
+
229
+ <h2>Running an interactive command session</h2>
230
+ To run an interactive command session:-
231
+ <ol>
232
+ <li>Open the operating system prompt window
233
+ <li>Change to the folder containing the file <a href="QuickBaseClient.rb">QuickBaseClient.rb</a>
234
+ <li>Type <font color="blue">ruby <a href="QuickBaseClient.rb">QuickBaseClient.rb</a> run</font><font color="black"> at the operating system prompt.
235
+ </ol>
236
+ You should see
237
+ <br>
238
+ <font color="blue">
239
+ <pre>
240
+ Enter a command from the list of available commands.
241
+ The list of commands may change after each command.
242
+ Type TABs, commas, or spaces between parts of a command.
243
+ Use double-quotes if your commands contain TABs, commas or spaces.
244
+
245
+ e.g. addfield "my text field" text
246
+
247
+
248
+ Commands available:
249
+
250
+ quit(q): End this command session
251
+ usage: Show how to use this program
252
+ ruby 'rubycode': run a line of ruby language code
253
+ run(r) 'filename': run the commands in a file
254
+ record 'filename': records your commands in a file
255
+ signin(si) 'username,password': Sign into QuickBase
256
+ uselog(ul) 'log file': Logs requests and responses to a file
257
+
258
+ Enter a command:
259
+ </pre>
260
+ <br>
261
+ <font color="black">
262
+ You will most likely want to run 'signin username password' as the next command.
263
+ After that, you will see:-
264
+ <font color="blue">
265
+ <pre>
266
+ Commands available:
267
+
268
+ quit(q): End this command session
269
+ usage: Show how to use this program
270
+ ruby 'rubycode': run a line of ruby language code
271
+ run(r) 'filename': run the commands in a file
272
+ record 'filename': records your commands in a file
273
+ create 'application name,description': Create an application
274
+ listapps(la) : Lists the applications you can access
275
+ open(o) 'application name': Open an application
276
+ print(p) : Prints the results of the last command
277
+ signout(so) : Sign out of QuickBase
278
+ uselog(ul) 'log file': Logs requests and responses to a file
279
+
280
+ Enter a command:
281
+ </pre>
282
+ <font color="black">
283
+ You will most likely want to run 'signin username password' as the next command.
284
+ After that, you will see:-
285
+ <font color="blue">
286
+ <pre>
287
+ Commands available:
288
+
289
+ quit(q): End this command session
290
+ usage: Show how to use this program
291
+ ruby 'rubycode': run a line of ruby language code
292
+ run(r) 'filename': run the commands in a file
293
+ record 'filename': records your commands in a file
294
+ addfield(af) 'field name,field type': Add a field to the active table
295
+ addfieldchoices 'field name,[choice1,choice2]': Add value choices for a field
296
+ addrecord(ar) : Add a record to the active table
297
+ changerecords 'field,value,testfld,test,testval': Conditionally set field value
298
+ copy 'name,desc,keep data?': Copy an application, with/out data
299
+ create 'application name,description': Create an application
300
+ deleteallrecords : Delete all records
301
+ deletefield 'field name': Delete a field from the active table
302
+ deleterecords 'test field,test,test value': Conditionally delete records
303
+ deletetable : Delete the active table
304
+ exportfile(ef) 'file name': Export records to a CSV file
305
+ importfile(if) 'file name': Import records from a CSV file
306
+ listapps(la) : Lists the applications you can access
307
+ open(o) 'application name': Open an application
308
+ print(p) : Prints the results of the last command
309
+ select(sel) 'query name': Select records using a query name
310
+ signout(so) : Sign out of QuickBase
311
+ uploadfile(ulf) 'file name,file attachment field name': Upload a file into a new record
312
+ uselog(ul) 'log file': Logs requests and responses to a file
313
+
314
+ Enter a command:
315
+ </pre>
316
+ <font color="black">
317
+
318
+ When a particular record is 'active', the 'setfield' and 'updatefile' commands are added to
319
+ the above list.
320
+ <p>
321
+ For Ruby programmers: in addition to the above commands, any method in QuickBase::Client can be
322
+ also be run as a command. e.g. typing <font color="blue">_getRecordInfo &quot;1&quot;</font><font color="black"> will get the details of the record from
323
+ the active table that has the Record ID# of &quot;1&quot;. The same results can be obtained by typing
324
+ <font color="blue">ruby _getRecordInfo( &quot;1&quot; )</font><font color="black"> .
325
+
326
+ <font color="black">
327
+
328
+
329
+ <h2>Running a command file from a browser Address box or a link in a web page</h2>
330
+ <ol>
331
+ <li>At a prompt, type <font color="blue">ruby <a href="QuickBaseClient.rb">QuickBaseClient.rb</a> runwebclient</font><font color="black">
332
+ <li>Open a browser and type <font color="blue">http://127.0.0.1:2358/qbc/qbc.makeCSVFile.qbc</font><font color="black"> into the Address box.
333
+ </ol>
334
+ "127.0.0.1" tells a browser to look on the user's own machine for a web server. This means that people on different computers
335
+ would all have to have QuickBaseClient.rb and qbc.makeCSVFile.qbc on their computer, and qbc.makeCSVFile.qbc <i>could</i> do different
336
+ things for each user. It is more likely that everyone will expect the same behavior when a specific URL is entered or clicked,
337
+ and that most people will not have QuickBaseClient.rb or Ruby on their computer. To run command files that are on a particular machine:-
338
+ <ol>
339
+ <li>Find out the IP address or web-accessible name of the machine.
340
+ <li>On that machine, type <font color="blue">ruby <a href="QuickBaseClient.rb">QuickBaseClient.rb</a> runwebclient &lt;IP Address&gt;</font><font color="black">
341
+ <li>In the browser Address box or web page link, use <font color="blue">http://&lt;IP Address&gt;:2358/qbc/qbc.makeCSVFile.qbc</font><font color="black">.
342
+ </ol>
343
+
344
+ <h2><a href="QuickBaseClient.rb">QuickBaseClient.rb</a> Cookbook: Small programs for common tasks</h2>
345
+ <p>
346
+ You can find these examples and more in the <a href="https://www.quickbase.com/db/bbtt9cjr7?a=dr&r=ka&rl=5ea">QuickBase API Cookbook</a> <a href="https://www.quickbase.com/db/bcdcajmrf">(Latest 'read-only' version)</a>.
347
+ </p>
348
+ <p>
349
+ Note that all the examples below can also be run by typing each line in an interactive command session.
350
+ For the <b>Program</b> versions, simply type <font color="blue">ruby </font><font color="black"> at the beginning of each line.
351
+ </p>
352
+
353
+ <comment> -------------------------------------------------------------------------</comment>
354
+ <table border="1">
355
+ <tr>
356
+ <td>
357
+ <h3><center>Uploading a document into a new record</center></h3>
358
+ </td>
359
+ </tr>
360
+ <tr>
361
+ <td>
362
+ <center><b>Program</b></center>
363
+ </td>
364
+ <td>
365
+ <center><b>Command File</b></center>
366
+ </td>
367
+ </tr>
368
+ <tr>
369
+ <td>
370
+ <font color="blue">
371
+ require 'QuickBaseClient'
372
+ <br>qbc = QuickBase::Client.new( "my_username", "my_password", "my_application" )
373
+ <font color="green">
374
+ <br># "Documents" is a table in "my_application"
375
+ <br># "Author" and "Desc" are additional field values to set in the record
376
+ </font><font color="blue">
377
+ <br>qbc.lookupChdbid( "Documents" )
378
+ <br>qbc.uploadFile( qbc.dbid, "my_file.doc", "Document", { "Author" => "my_name", "Desc" => "Latest revision" } )
379
+ <br>qbc.signOut
380
+ </font><font color="black">
381
+ </td>
382
+ <td>
383
+ <font color="blue">
384
+ si my_username my_password
385
+ <br>o my_application
386
+ <br>use Documents
387
+ <br>ulf my_file.doc Document
388
+ <br>so
389
+ </font><font color="black">
390
+ </td>
391
+ </tr>
392
+ </table>
393
+
394
+ <comment> -------------------------------------------------------------------------</comment>
395
+ <p>
396
+ <table border="1">
397
+ <tr>
398
+ <td>
399
+ <h3><center>Updating a document in an existing record</center></h3>
400
+ </td>
401
+ </tr>
402
+ <tr>
403
+ <td>
404
+ <center><b>Program</b></center>
405
+ </td>
406
+ <td>
407
+ <center><b>Command File</b></center>
408
+ </td>
409
+ </tr>
410
+ <tr>
411
+ <td>
412
+ <font color="blue">
413
+ require 'QuickBaseClient'
414
+ <br>qbc = QuickBase::Client.new( "my_username", "my_password", "my_application" )
415
+ <br>qbc.lookupChdbid( "Documents" )
416
+ <font color="green">
417
+ <br># "12" is the number of the record (Record ID#) to be modified
418
+ <br># "Document" is the name of the field containing a file attachment
419
+ <br># "Version" and "Date" are additional field values to modify in the record
420
+ </font><font color="blue">
421
+ <br>qbc.updateFile( qbc.dbid, "12", "my_file.doc", "Document", { "Version" => "6", "Note" => "Updated 01/30/2006" } )
422
+ <br>qbc.signOut
423
+ </font><font color="black">
424
+ </td>
425
+ <td>
426
+ <font color="blue">
427
+ si my_username my_password
428
+ <br>o my_application
429
+ <br>use Documents
430
+ <br>udf my_file.doc Document
431
+ <br>so
432
+ </font><font color="black">
433
+ </td>
434
+ </tr>
435
+ </table>
436
+
437
+ <comment> -------------------------------------------------------------------------</comment>
438
+ <p>
439
+ <table border="1">
440
+ <tr>
441
+ <td>
442
+ <h3><center>Making a backup copy of an application</center></h3>
443
+ </td>
444
+ </tr>
445
+ <tr>
446
+ <td>
447
+ <center><b>Program</b></center>
448
+ </td>
449
+ <td>
450
+ <center><b>Command File</b></center>
451
+ </td>
452
+ </tr>
453
+ <tr>
454
+ <td>
455
+ <font color="blue">
456
+ require 'QuickBaseClient'
457
+ <br>qbc = QuickBase::Client.new( "my_username", "my_password", "my_application" )
458
+ <font color="green">
459
+ <br># "true" at the end means copy all the data, not just the structure of the database
460
+ </font><font color="blue">
461
+ <br>qbc.cloneDatabase( qbc.dbid, "my_application_backup", "backup of my_application", true )
462
+ <br>qbc.signOut
463
+ </font><font color="black">
464
+ </td>
465
+ <td>
466
+ <font color="blue">
467
+ si my_username my_password
468
+ <br>o my_application
469
+ <br>copy my_application_backup "backup of my_application"
470
+ <br>so
471
+ </font><font color="black">
472
+ </td>
473
+ </tr>
474
+ </table>
475
+
476
+ <comment> -------------------------------------------------------------------------</comment>
477
+ <p>
478
+ <table border="1">
479
+ <tr>
480
+ <td>
481
+ <h3><center>Deleting all the records that meet a certain condition</center></h3>
482
+ </td>
483
+ </tr>
484
+ <tr>
485
+ <td>
486
+ <center><b>Program</b></center>
487
+ </td>
488
+ <td>
489
+ <center><b>Command File</b></center>
490
+ </td>
491
+ </tr>
492
+ <tr>
493
+ <td>
494
+ <font color="blue">
495
+ require 'QuickBaseClient'
496
+ <br>qbc = QuickBase::Client.new( "my_username", "my_password", "my_application" )
497
+ <font color="green">
498
+ <br># delete all records with a "Status" field value equal to "closed"
499
+ </font><font color="blue">
500
+ <br>qbc.deleteRecords( "Status", "==", "closed" )
501
+ <br>qbc.signOut
502
+ </font><font color="black">
503
+ </td>
504
+ <td>
505
+ <font color="blue">
506
+ si my_username my_password
507
+ <br>o my_application
508
+ <br>deleterecords Status == closed
509
+ <br>so
510
+ </font><font color="black">
511
+ </td>
512
+ </tr>
513
+ </table>
514
+
515
+ <comment> -------------------------------------------------------------------------</comment>
516
+ <p>
517
+ <table border="1">
518
+ <tr>
519
+ <td>
520
+ <h3><center>Modifying all the records that meet a certain condition</center></h3>
521
+ </td>
522
+ </tr>
523
+ <tr>
524
+ <td>
525
+ <center><b>Program</b></center>
526
+ </td>
527
+ <td>
528
+ <center><b>Command File</b></center>
529
+ </td>
530
+ </tr>
531
+ <tr>
532
+ <td>
533
+ <font color="blue">
534
+ require 'QuickBaseClient'
535
+ <br>qbc = QuickBase::Client.new( "my_username", "my_password", "my_application" )
536
+ <font color="green">
537
+ <br># set the checkbox field "Inactive" to "true" in all records with a "Status" field value equal to "closed"
538
+ </font><font color="blue">
539
+ <br>qbc.changeRecords( "Inactive", "true", "Status", "==", "closed" )
540
+ <br>qbc.signOut
541
+ </font><font color="black">
542
+ </td>
543
+ <td>
544
+ <font color="blue">
545
+ si my_username my_password
546
+ <br>o my_application
547
+ <br>changerecords Inactive true Status == closed
548
+ <br>so
549
+ </font><font color="black">
550
+ </td>
551
+ </tr>
552
+ </table>
553
+
554
+ <comment> -------------------------------------------------------------------------</comment>
555
+ <p>
556
+ <table border="1">
557
+ <tr>
558
+ <td>
559
+ <h3><center>Making the records in a table match the contents of a CSV file</center></h3>
560
+ </td>
561
+ </tr>
562
+ <tr>
563
+ <td>
564
+ <center><b>Program</b></center>
565
+ </td>
566
+ <td>
567
+ <center><b>Command File</b></center>
568
+ </td>
569
+ </tr>
570
+ <tr>
571
+ <td>
572
+ <font color="blue">
573
+ require 'QuickBaseClient'
574
+ <br>qbc = QuickBase::Client.new( "my_username", "my_password", "my_application" )
575
+ <br>qbc.lookupChdbid( "Imported data" )
576
+ <font color="green">
577
+ <br># delete all the records in the "Imported data" table then
578
+ <br># import new data from a CSV file. The field names must be at the top of the file.
579
+ </font><font color="blue">
580
+ <br>qbc._purgeRecords
581
+ <br>qbc.importCSVFile( "ImportedData.csv" )
582
+ <br>qbc.signOut
583
+ </font><font color="black">
584
+ </td>
585
+ <td>
586
+ <font color="blue">
587
+ si my_username my_password
588
+ <br>o my_application
589
+ <br>use Imported Data
590
+ <br>deleteallrecords
591
+ <br>importfile ImportedData.csv
592
+ <br>so
593
+ </font><font color="black">
594
+ </td>
595
+ </tr>
596
+ </table>
597
+
598
+ <comment> -------------------------------------------------------------------------</comment>
599
+ <p>
600
+ <table border="1">
601
+ <tr>
602
+ <td>
603
+ <h3><center>Making the records in a table match the contents of a Microsoft Excel spreadsheet</center></h3>
604
+ </td>
605
+ </tr>
606
+ <tr>
607
+ <td>
608
+ <center><b>Program</b></center>
609
+ </td>
610
+ <td>
611
+ <center><b>Command File</b></center>
612
+ </td>
613
+ </tr>
614
+ <tr>
615
+ <td>
616
+ <font color="blue">
617
+ require 'QuickBaseClient'
618
+ <br>qbc = QuickBase::Client.new( "my_username", "my_password", "my_application" )
619
+ <br>qbc.lookupChdbid( "Imported Excel data" )
620
+ <font color="green">
621
+ <br># delete all the records in the "Imported Excel data" table then
622
+ <br># import new data from an Excel file. The field names must be at the top of the file.
623
+ <br># 'h' is the letter of the last column to import.
624
+ <br># Note: any commas (',') in the data are converted to semi-colons (';').
625
+ </font><font color="blue">
626
+ <br>qbc._purgeRecords
627
+ <br>qbc._importFromExcel( "ImportedExcelData.xls", 'h' )
628
+ <br>qbc.signOut
629
+ </font><font color="black">
630
+ </td>
631
+ <td>
632
+ <font color="blue">
633
+ si my_username my_password
634
+ <br>o my_application
635
+ <br>use Imported Excel Data
636
+ <br>deleteallrecords
637
+ <br>importexcelfile ImportedExcelData.xls h
638
+ <br>so
639
+ </font><font color="black">
640
+ </td>
641
+ </tr>
642
+ </table>
643
+
644
+ <comment> -------------------------------------------------------------------------</comment>
645
+ <p>
646
+ <table border="1">
647
+ <tr>
648
+ <td>
649
+ <h3><center>Deleting duplicate records from a table</center></h3>
650
+ </td>
651
+ </tr>
652
+ <tr>
653
+ <td>
654
+ <center><b>Program</b></center>
655
+ </td>
656
+ <td>
657
+ <center><b>Command File</b></center>
658
+ </td>
659
+ </tr>
660
+ <tr>
661
+ <td>
662
+ <font color="blue">
663
+ require 'QuickBaseClient'
664
+ <br>qbc = QuickBase::Client.new( "my_username", "my_password", "my_application" )
665
+ <font color="green">
666
+ <br># Except for the most recent records, delete all the records with
667
+ <br># the same values for 'First Name' and 'Last Name'
668
+ </font><font color="blue">
669
+ <br>qbc.deleteDuplicateRecords( [ "First Name", "Last Name" ] )
670
+ <br>qbc.signOut
671
+ </font><font color="black">
672
+ </td>
673
+ <td>
674
+ <font color="blue">
675
+ si my_username my_password
676
+ <br>ruby deleteDuplicateRecords( [ "First Name", "Last Name" ] )
677
+ <br>so
678
+ </font><font color="black">
679
+ </td>
680
+ </tr>
681
+ </table>
682
+
683
+ <comment> -------------------------------------------------------------------------</comment>
684
+ <p>
685
+ <table border="1">
686
+ <tr>
687
+ <td>
688
+ <h3><center>Making multiple copies of a record</center></h3>
689
+ </td>
690
+ </tr>
691
+ <tr>
692
+ <td>
693
+ <center><b>Program</b></center>
694
+ </td>
695
+ <td>
696
+ <center><b>Command File</b></center>
697
+ </td>
698
+ </tr>
699
+ <tr>
700
+ <td>
701
+ <font color="blue">
702
+ require 'QuickBaseClient'
703
+ <br>qbc = QuickBase::Client.new( "my_username", "my_password", "my_application" )
704
+ <font color="green">
705
+ <br># make 6 copies of record 1
706
+ </font><font color="blue">
707
+ <br>qbc.copyRecord( "1", 6 )
708
+ <br>qbc.signOut
709
+ </font><font color="black">
710
+ </td>
711
+ <td>
712
+ <font color="blue">
713
+ si my_username my_password
714
+ <br>ruby qbc.copyRecord( "1", 6 )
715
+ <br>so
716
+ </font><font color="black">
717
+ </td>
718
+ </tr>
719
+ </table>
720
+
721
+ <h2>Programs for more complex tasks</h2>
722
+
723
+ <h3>Adding records for every day between two dates</h3>
724
+ <pre>
725
+ <font color="blue">
726
+ require 'QuickBaseClient'
727
+ require 'Date'
728
+
729
+ qbc = QuickBase::Client.new( "my_username", "my_password", "my_application" )
730
+
731
+ d = Date.new( 2006, 1, 1 )
732
+ d.upto( Date.new( 2007, 1, 1 ) ){ |date|
733
+
734
+ ymd = date.to_s.split( /-/ )
735
+ mdy = "#{ymd[1]}-#{ymd[2]}-#{ymd[0]}"
736
+
737
+ qbc.clearFieldValuePairList
738
+ fvl = qbc.addFieldValuePair( "Date field", nil, nil, "#{mdy}" )
739
+
740
+ qbc.addRecord( datefield, fvl )
741
+ }
742
+ </font><font color="black">
743
+ </pre>
744
+
745
+ <h3>Updating the latest copy of a file in a particular Quickbase record every hour</h3>
746
+ <pre>
747
+ <font color="blue">
748
+ require 'QuickBaseClient'
749
+
750
+ loop {
751
+ qbc = QuickBase::Client.new( "my_username", "my_password", "my_application" )
752
+ qbc.lookupChdbid( "Documents" ) # the table containing the files
753
+
754
+ <font color="green"># "12" is the number of the record (Record ID#) to be modified</font><font color="blue">
755
+ <font color="green"># "Document" is the name of the field containing a file attachment</font><font color="blue">
756
+ <font color="green"># "Version" and "Date" are additional field values to modify in the record</font><font color="blue">
757
+
758
+ qbc.updateFile( qbc.dbid, "12", "my_file.doc", "Document", { "Version" => "6", "Note" => "Updated 01/30/2006" } )
759
+
760
+ qbc.signOut
761
+ qbc = nil
762
+
763
+ # wait one hour
764
+ sleep(60*60)
765
+ }
766
+ </font><font color="black">
767
+ </pre>
768
+
769
+ <h3>Automatically removing all the records from a particular Quickbase table every hour</h3>
770
+ <pre>
771
+ <font color="blue">
772
+ require 'QuickBaseClient'
773
+
774
+ loop {
775
+ qbc = QuickBase::Client.new( "my_username", "my_password", "my_application" )
776
+ qbc.lookupChdbid( "my_table" ) # the table to empty
777
+ qbc._purgeRecords
778
+ qbc.signOut
779
+ qbc = nil
780
+ sleep(60*60)
781
+ }
782
+ </font><font color="black">
783
+ </pre>
784
+
785
+ <h3>Creating an RSS view of a Quickbase table and uploading it into a QuickBase record</h3>
786
+ <pre>
787
+ <font color="blue">
788
+ require 'QuickBaseClient'
789
+
790
+ qbc = QuickBase::Client.new( "my_username", "my_password", "my_application" )
791
+ qbc.lookupChdbid( "my_table" )
792
+
793
+ <font color="green"># get all the records from the table using the 'List Changes' query</font><font color="blue">
794
+ qbc.doQuery( qbc.dbid, nil, nil, "List Changes" )
795
+
796
+ rssText = "&lt;?xml version=\"1.0\" ?&gt;\n"
797
+ rssText &lt;&lt; " &lt;rss version=\"2.0\"&gt;\n"
798
+ rssText &lt;&lt; " &lt;channel&gt;\n"
799
+
800
+ rssText &lt;&lt; " &lt;title>my_table - RSS view&lt;/title&gt;\n"
801
+
802
+ rssText &lt;&lt; " &lt;link&gt;\n"
803
+ rssText &lt;&lt; qbc.requestURL
804
+ rssText &lt;&lt; "\n &lt;/link&gt;\n"
805
+
806
+ rssText &lt;&lt; " &lt;description&gt;(#{Time.now})&lt;/description&gt;\n"
807
+
808
+ qbc.records.each { |record|
809
+ if record.is_a?( REXML::Element) and record.name == "record"
810
+
811
+ itemTitle = ""
812
+ itemLink = ""
813
+ itemText = ""
814
+
815
+ record.each{ |field|
816
+ if field.is_a?( REXML::Element)
817
+ case field.attributes[ "id" ]
818
+
819
+ <font color="green"># the field with the QuickBase id "6" contains the title for on RSS item</font><font color="blue">
820
+ when "6" then itemTitle = field.text if field.has_text?
821
+
822
+ <font color="green"># the field with the QuickBase id "10" contains the link to the record itself</font><font color="blue">
823
+ when "10" then itemLink = field.text if field.has_text?
824
+
825
+ <font color="green"># the field with the QuickBase id "26" contains the main text from the record</font><font color="blue">
826
+ when "26" then itemText = field.text if field.has_text?
827
+ end
828
+ end
829
+ }
830
+
831
+ <font color="green"># build the text for one RSS item</font><font color="blue">
832
+ rssText &lt;&lt; " &lt;item&gt;\n"
833
+ rssText &lt;&lt; " &lt;title&gt;#{qbc.encodeXML(itemTitle)}&lt;/title&gt;\n"
834
+ rssText &lt;&lt; " &lt;link>#{qbc.encodeXML(itemLink)}&lt;/link&gt;\n"
835
+ rssText &lt;&lt; " &lt;description>#{qbc.encodeXML(itemText)}&lt;/description&gt;\n"
836
+ rssText &lt;&lt; " &lt;/item&gt;"
837
+
838
+ end
839
+ }
840
+
841
+ rssText &lt;&lt; " &lt;/channel&gt;\n"
842
+ rssText &lt;&lt; " &lt;/rss&gt;\n"
843
+
844
+ <font color="green"># Write all the RSS text for the table into a file on the local hard drive</font><font color="blue">
845
+ File.open( "my_table.rss.xml", "w" ) { |file| file.write( rssText ) }
846
+
847
+ <font color="green"># Switch to a different table in "my_application" that already contains RSS files</font><font color="blue">
848
+ qbc.lookupChdbid( "rss table" )
849
+
850
+ <font color="green"># Put the file we've just created into record 4, into the file attachment field called "RSS File"</font><font color="blue">
851
+ qbc.updateFile( qbc.dbid, "4", "my_table.rss.xml", "RSS File" )
852
+
853
+ qbc.signOut
854
+ </font><font color="black">
855
+ </pre>
856
+
857
+ <h2><a href="QuickBaseClient.rb">QuickBaseClient.rb</a> Reference</h2>
858
+ <h3>Class QuickBase::Client</h3>
859
+ <b>API wrapper methods</b>
860
+ <pre>
861
+ These methods closely mimic the 'API_' requests as specified in the <a href="https://www.quickbase.com/up/6mztyxu8/g/rc7/en/va/QuickBaseAPI.htm">QuickBase HTTP API Reference document</a>.
862
+ Each method expects the 'Input Parameters' of the equivalent HTTP API request.
863
+ Each method returns the 'Output Parameters' of the equivalent HTTP API response.
864
+ (Ruby methods can return multiple values)
865
+ Input and Output Parameters are all stored in '@' member variables.
866
+ This makes it easy to reuse parameters across multiple requests.
867
+ Methods returning lists can be called with an iteration block, e.g. doQuery(){|record|, puts record } .
868
+
869
+ Each method with dbid as the first parameter has a corresponding method with '_' before the name.
870
+ The '_' methods re-use @dbid instead of a requiring the dbid parameter.
871
+ </pre>
872
+ <ol>
873
+ <li><font color="blue">def addField( dbid, label, type, mode = nil )</font><font color="black">
874
+ <br>Adds a new field to a table. dbid = the table ID, label = text to appear on screen for this field, type = the field type.
875
+ <li><font color="blue">def addRecord( dbid, fvlist = nil, disprec = nil, fform = nil, ignoreError = nil, update_id = nil )</font><font color="black">
876
+ <br>Adds a new record to a table. fvlist is an instance of a FieldValuePair list. Use addFieldValuePair() to build that list of fields
877
+ <br>to use for this parameter.
878
+ <li><font color="blue">def addReplaceDBPage( dbid, pageid, pagename, pagetype, pagebody, ignoreError = nil )</font><font color="black">
879
+ <br>Add or replace a page associated with a table.
880
+ <li><font color="blue">def addUserToRole( dbid, userid, roleid )</font><font color="black">
881
+ <br>Add a user to a role in an application. The dbid must be an application dbid, not a table dbid.
882
+ <li><font color="blue">def authenticate( username, password, hours = nil )</font><font color="black">
883
+ <br>Signs into QuickBase using the specified username and password.
884
+ <br>Subsequent QuickBase requests use the @ticket that is set as a result of this call.
885
+ <li><font color="blue">def changePermission( dbid, uname, view, modify, create, delete, saveviews, admin )</font><font color="black">
886
+ <br>Create, update, delete access rights for a user. <b>NOTE: API_ChangePermission is no longer a valid QuickBase HTTP API request.</b>
887
+ <li><font color="blue">def changeRecordOwner( dbid, rid, newowner )</font><font color="black">
888
+ <br>Change the owner of a record.
889
+ <li><font color="blue">def changeUserRole( dbid, userid, roleid, newroleid )</font><font color="black">
890
+ <br>Change the role of a user in a particular application. The dbid must be an application dbid, not a table dbid.
891
+ <li><font color="blue">def cloneDatabase( dbid, newdbname, newdbdesc, keepData )</font><font color="black">
892
+ <br>Copy an application, with ot without data.
893
+ <li><font color="blue">createDatabase( dbname, dbdesc )</font><font color="black">
894
+ <br>Create a new application.
895
+ <li><font color="blue">def createTable( pnoun, application_dbid = @dbid )</font><font color="black">
896
+ <br>Add a table to an application. pnoun should be a plural noun, such as 'Employees'. The application_dbid must be an application dbid, not a table dbid.
897
+ <li><font color="blue">def deleteDatabase( dbid )</font><font color="black">
898
+ <br>Delete an application.
899
+ <li><font color="blue">def deleteField( dbid, fid )</font><font color="black">
900
+ <br>Remove a field from a table.
901
+ <li><font color="blue">def deleteRecord( dbid, rid )</font><font color="black">
902
+ <br>Delete a record.
903
+ <li><font color="blue">def doQuery( dbid, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )</font><font color="black">
904
+ <br>Retrieve a list of records. By default, all records will be retrieved with all columns.
905
+ <li><font color="blue">def _doQueryName( queryName )</font><font color="black">
906
+ <br>This is not a direct API wrapper. It is a simple way to use a named query (e.g. 'List All') for the active table.
907
+ <li><font color="blue">def downLoadFile( dbid, rid, fid, vid = "0" )</font><font color="black">
908
+ <br>Downloads a file.
909
+ <li><font color="blue">def editRecord( dbid, rid, fvlist, disprec = nil, fform = nil, ignoreError = nil, update_id = nil )</font><font color="black">
910
+ <br>Modifies an exsiting record. fvlist is an instance of a FieldValuePair list.
911
+ <br>Use addFieldValuePair() to build the @fvlist list of fields to use for this parameter.
912
+ <li><font color="blue">def fieldAddChoices( dbid, fid, choice )</font><font color="black">
913
+ <br>Adds choices to a multiple-choice text field.
914
+ <li><font color="blue">def fieldRemoveChoices( dbid, fid, choice )</font><font color="black">
915
+ <br>Removes choices from a multiple-choice text field.
916
+ <li><font color="blue">def findDBByname( dbname )</font><font color="black">
917
+ <br>Set the active application using its name. e.g. 'QuickBase Community Forum'.
918
+ <li><font color="blue">def genAddRecordForm( dbid, fvlist = nil )</font><font color="black">
919
+ <br>Retrieves the HTML for adding a record to a table.
920
+ <li><font color="blue">def genResultsTable( dbid, query = nil, clist = nil, slist = nil, jht = nil, jsa = nil, options = nil )</font><font color="black">
921
+ <br>Retrieves the HTML for displaying the results of a query.
922
+ <li><font color="blue">def getAppDTMInfo( dbid )</font><font color="black">
923
+ <br>The fastest way to get the last time that an application was modified and each of its tables was last modified, or the last time one particular table was modified.
924
+ <li><font color="blue">def getDBInfo( dbid )</font><font color="black">
925
+ <br>Retrieves the properties for table.
926
+ <li><font color="blue">def getDBPage( dbid, pageid, pagename = nil )</font><font color="black">
927
+ <br>Retrieves a page associated with a table.
928
+ <li><font color="blue">def getDBvar( dbid, varname )</font><font color="black">
929
+ <br>Retrieves the value of an application variable. The dbid must be for an application , not a table.
930
+ <li><font color="blue">def getNumRecords( dbid )</font><font color="black">
931
+ <br>Retrieves the number of records in a table.
932
+ <li><font color="blue">def getOneTimeTicket()</font><font color="black">
933
+ <br>Get a QuickBase ticket that is valid only for the next 5 minutes.
934
+ <li><font color="blue">def getRecordAsHTML( dbid, rid, jht = nil )</font><font color="black">
935
+ <br>Retrieves a record in HTML format.
936
+ <li><font color="blue">def getRecordInfo( dbid, rid )</font><font color="black">
937
+ <br>Retrieves all the field values for a specified record.
938
+ <li><font color="blue">def getRoleInfo( dbid )</font><font color="black">
939
+ <br>Retrieves the list of roles defined for an application. The dbid must be for an application, not a table.
940
+ <li><font color="blue">def getSchema( dbid )</font><font color="black">
941
+ <br>Retrieves all the information about the fields in a table.
942
+ <li><font color="blue">getServerStatus</font><font color="black">
943
+ <br>Retrieves information about the QuickBase server.
944
+ <li><font color="blue">def getUserInfo( email = nil )</font><font color="black">
945
+ <br>Retrieves information about a particular user. Defaults to the user logged in via the API.
946
+ <li><font color="blue">def getUserRole( dbid, userid )</font><font color="black">
947
+ <br>Retrieves information about a particular user's role in an application. The dbid must be for an application, not a table.
948
+ <li><font color="blue">def grantedDBs( withembeddedtables = nil, excludeparents = nil, adminOnly = nil )</font><font color="black">
949
+ <br>Retrieves a list of applications accessible by the authenticated user.
950
+ <li><font color="blue">def importFromCSV( dbid, records_csv, clist, skipfirst = nil )</font><font color="black">
951
+ <br>Imports CSV data into a table. records_csv is a string containing the data.
952
+ <li><font color="blue">def listDBPages(dbid)</font><font color="black">
953
+ <br>Get the list of pages associated with an application. The dbid must be for an application, not a table.
954
+ <li><font color="blue">def provisionUser( dbid, roleid, email, fname, lname )</font><font color="black">
955
+ <br>Set up the information for a new QuickBase user, in preparation for calling sendInvitation(). The dbid must be for an application, not a table.
956
+ <li><font color="blue">def purgeRecords( dbid, query = nil, qid = nil, qname = nil )</font><font color="black">
957
+ <br>Deletes all the records from a table.
958
+ <li><font color="blue">def removeUserFromRole( dbid, userid, roleid )</font><font color="black">
959
+ <br>Removes a user from a particular role in a particular application. The dbid must be for an application, not a table.
960
+ <li><font color="blue">def renameApp( dbid, newappname )</font><font color="black">
961
+ <br>Rename an application. The dbid must be for an application, not a table.
962
+ <li><font color="blue">def runImport( dbid, id )</font><font color="black">
963
+ <br>Run a predefined QuickBase Import to get data into a particular table. The id is the numeric identifier of the import.
964
+ <li><font color="blue">def sendInvitation( dbid, userid )</font><font color="black">
965
+ <br>Send an email inviting a user to access an application. The dbid must be for an application, not a table.
966
+ <li><font color="blue">def setDBvar( dbid, varname, value )</font><font color="black">
967
+ <br>Set the value of an application variable. The dbid must be for an application, not a table.
968
+ <li><font color="blue">def setFieldProperties( dbid, properties, fid )</font><font color="black">
969
+ <br>Modifies the properties of a field in a table.
970
+ <li><font color="blue">def signOut()</font><font color="black">
971
+ <br>Signout from QuickBase.
972
+ <li><font color="blue">def userRoles( dbid )</font><font color="black">
973
+ <br>Get the list of roles for the users with access to a specific application.The dbid must be for an application, not a table.
974
+ </ol>
975
+
976
+ <b>Helper methods</b>
977
+ <pre>
978
+ These methods are focused on reducing the amount of code you
979
+ have to write to get stuff done using the QuickBase::Client.
980
+ </pre>
981
+ <ol>
982
+ <li><font color="blue">def addOrEditRecord( dbid, fvlist, rid = nil, disprec = nil, fform = nil, ignoreError = nil, update_id = nil )</font><font color="black">
983
+ <br>Use this if you aren't sure whether a particular record already exists or not.
984
+
985
+ <li><font color="blue">def getRecord(rid, dbid = @dbid)</font><font color="black">
986
+ <br>Get a record as a Hash, using the record id and dbid .
987
+
988
+
989
+ <li><font color="blue">def iterateDBPages(dbid)</font><font color="black">
990
+ <br>Loop through the list of Pages for an application.
991
+
992
+ <li><font color="blue">def getDBPagesAsArray(dbid)</font><font color="black">
993
+ <br>Get an array Pages for an application. Each item in the array is a Hash.
994
+
995
+ <li><font color="blue">def Client.processDatabase( username, password, appname, chainAPIcalls = nil )</font><font color="black">
996
+ <pre>
997
+ This class method
998
+
999
+ - creates a QuickBase::Client,
1000
+ - signs into QuickBase
1001
+ - connects to a specific application
1002
+ - runs code in the associated block
1003
+ - signs out of QuickBase
1004
+
1005
+ e.g. QuickBase::Client.processDatabase( "user", "password", "my DB" ) { |qbClient,dbid| qbClient.getDBInfo( dbid ) }
1006
+ </pre>
1007
+ <li><font color="blue">def chainAPIcallsBlock()</font><font color="black">
1008
+ <pre>
1009
+ This method changes all the API_ wrapper methods to return 'self' instead of their
1010
+ normal return values. The change is in effect only within the associated block.
1011
+ This allows mutliple API_ calls to be 'chained' together without needing 'qbClient' in front of each call.
1012
+
1013
+ e.g. qbClient.chainAPIcallsBlock {
1014
+ qbClient
1015
+ .addField( @dbid, "a text field", "text" )
1016
+ .addField( @dbid, "a choice field", "text" )
1017
+ .fieldAddChoices( @dbid, @fid, %w{ one two three four five } )
1018
+ }
1019
+ </pre>
1020
+ <li><font color="blue">def setActiveRecord( dbid, rid )</font><font color="black">
1021
+ <br>Set the active database and record for subsequent method calls.
1022
+
1023
+ <li><font color="blue">def setFieldValue( fieldName, fieldValue )</font><font color="black">
1024
+ <br>Change a named field's value in the active record.
1025
+ <br>e.g. setFieldValue( "Location", "Miami" )
1026
+
1027
+ <li><font color="blue">def setFieldValues( fields )</font><font color="black">
1028
+ <br>Change several named fields' values in the active record, e.g. setFieldValue( {"Location" => "Miami", "Phone" => "343-4567" } )
1029
+
1030
+ <li><font color="blue">def changeRecords( fieldNameToSet, fieldValueToSet, fieldNameToTest, test, fieldValueToTest )</font><font color="black">
1031
+ <pre>
1032
+ Change a field's value in multiple records.
1033
+ If the optional test field/operator/value are supplied, only records matching the test
1034
+ field will be modified, otherwise all records will be modified.
1035
+
1036
+ e.g. changeRecords( "Status", "special", "Account Balance", ">", "100000.00" )
1037
+
1038
+ </pre>
1039
+ <li><font color="blue">def deleteRecords( fieldNameToTest = nil, test = nil, fieldValueToTest = nil)</font><font color="black">
1040
+ <pre>
1041
+ Delete all records in the active table that match
1042
+ the field/operator/value. e.g. deleteRecords( "Status", "==", "inactive" ).
1043
+ To delete ALL records, call deleteRecords() with no parameters.
1044
+ This is the same as calling _purgeRecords.
1045
+ </pre>
1046
+ <li><font color="blue">def getAllValuesForFields( dbid, fieldNames, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )</font><font color="black">
1047
+ <pre>
1048
+ Get all the values for one or more fields from a specified table.
1049
+ e.g. getAllValuesForFields( "dhnju5y7", [ "Name", "Phone" ] )
1050
+ The results are returned in Hash, e.g. { "Name" => values[ "Name" ], "Phone" => values[ "Phone" ] }
1051
+ The parameters after 'fieldNames' are passed directly to the doQuery() API_ call.
1052
+ </pre>
1053
+
1054
+
1055
+ <li><font color="blue">def getAllValuesForFieldsAsArray( dbid, fieldNames = nil, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )</font><font color="black">
1056
+ <pre>
1057
+ Get all the values for one or more fields from a specified table, as an Array of records.
1058
+ This also formats the field values instead of returning the raw value.
1059
+ </pre>
1060
+
1061
+ <li><font color="blue">def editRecords(dbid,fieldValuesToSet,query=nil,qid=nil,qname=nil)</font><font color="black">
1062
+ <pre>
1063
+ Set the values of fields in all records returned by a query.
1064
+ fieldValuesToSet must be a Hash of fieldnames+values, e.g. {"Location" => "Miami", "Phone" => "343-4567"}
1065
+ </pre>
1066
+
1067
+ <li><font color="blue">def iterateRecords( dbid, fieldNames, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )</font><font color="black">
1068
+ <pre>
1069
+ Loop through records returned from a query. Each record is a field+value Hash.
1070
+ e.g. iterateRecords( "dhnju5y7", ["Name","Address"] ) { |values| puts values["Name"], values["Address"] }
1071
+ </pre>
1072
+
1073
+ <li><font color="blue">def iterateFilteredRecords( dbid, fieldNames, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )</font><font color="black">
1074
+ <pre>
1075
+ Same as iterateRecords but with fields optionally filtered by Ruby regular expressions.
1076
+ e.g. iterateFilteredRecords( "dhnju5y7", [{"Name" => "[A-E].+}","Address"] ) { |values| puts values["Name"], values["Address"] }
1077
+ </pre>
1078
+
1079
+
1080
+ <li><font color="blue">def getFilteredRecords( dbid, fieldNames, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )</font><font color="black">
1081
+ <pre>
1082
+ e.g. getFilteredRecords( "dhnju5y7", [{"Name" => "[A-E].+}","Address"] ) { |values| puts values["Name"], values["Address"] }
1083
+ </pre>
1084
+
1085
+ <li><font color="blue">def iterateJoinRecords(tablesAndFields)</font><font color="black">
1086
+ <pre>
1087
+ Get records from two or more tables and/or queries with the same value in a
1088
+ 'join' field and loop through the joined results.
1089
+ The 'joinfield' does not have to have the same name in each table.
1090
+ Fields with the same name in each table will be merged, with the value from the last
1091
+ table being assigned. This is similar to an SQL JOIN.
1092
+ </pre>
1093
+
1094
+
1095
+
1096
+ <li><font color="blue">def getJoinRecords(tablesAndFields)</font><font color="black">
1097
+ <pre>
1098
+ Get an array of records from two or more tables and/or queries with the same value in a 'join' field.
1099
+ The 'joinfield' does not have to have the same name in each table.
1100
+ Fields with the same name in each table will be merged, with the value from the last
1101
+ table being assigned. This is similar to an SQL JOIN.
1102
+ </pre>
1103
+
1104
+
1105
+ <li><font color="blue">def iterateUnionRecords(tables,fieldNames)</font><font color="black">
1106
+ <pre>
1107
+ Get values from the same fields in two or more tables and/or queries and loop through the merged results.
1108
+ The merged records will be unique. This is similar to an SQL UNION.
1109
+ </pre>
1110
+
1111
+
1112
+ <li><font color="blue">def getUnionRecords(tables,fieldNames)</font><font color="black">
1113
+ <pre>
1114
+ Returns an Array of values from the same fields in two or more tables and/or queries.
1115
+ The merged records will be unique. This is similar to an SQL UNION.
1116
+ </pre>
1117
+
1118
+
1119
+
1120
+ <li><font color="blue">
1121
+ def iterateSummaryRecords( dbid, fieldNames,query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
1122
+ </font><font color="black">
1123
+ <pre>
1124
+ (The QuickBase API does not supply a method for this.)
1125
+ Loop through summary records, like the records in a QuickBase Summary report.
1126
+ Fields with 'Total' and 'Average' checked in the target table will be summed and/or averaged.
1127
+ Other fields with duplicate values will be merged into a single 'record'.
1128
+ The results will be sorted by the merged fields, in ascending order.
1129
+ e.g. -
1130
+ iterateSummaryRecords( "vavaa4sdd", ["Customer", "Amount"] ) {|record|
1131
+ puts "Customer: #{record['Customer']}, Amount #{record['Amount']}
1132
+ }
1133
+ would print the total Amount for each Customer, sorted by Customer.
1134
+ </pre>
1135
+
1136
+
1137
+ <li><font color="blue">
1138
+ def getSummaryRecords( dbid, fieldNames,query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
1139
+ </font><font color="black">
1140
+ <pre>
1141
+ Same as iterateSummaryRecords, but returns an array of records to be processed
1142
+ without necessarily looping through the records.
1143
+ </pre>
1144
+
1145
+
1146
+ <li><font color="blue">
1147
+ def iterateRecordInfos(dbid, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil)
1148
+ </font><font color="black">
1149
+ <pre>
1150
+ Loop through a list of records returned from a query.
1151
+ Each record will contain all the fields with values formatted for readability by QuickBase via API_GetRecordInfo.
1152
+ This is much slower than iterateRecords() because it every record is read in a separate call to QuickBase.
1153
+ </pre>
1154
+
1155
+ <li><font color="blue">
1156
+ def processRESTRequest(requestString)
1157
+ </font><font color="black">
1158
+ <pre>
1159
+ Returns table or record values using REST syntax. e.g. -
1160
+ puts processRESTRequest("8emtadvk/24105") # prints record 24105 from Community Forum
1161
+ puts processRESTRequest("8emtadvk") # prints name of table with dbid of '8emtadvk'
1162
+ puts qbc.processRESTRequest("6ewwzuuj/Function Name") # prints list of QuickBase Functions
1163
+ </pre>
1164
+
1165
+
1166
+ <li><font color="blue">
1167
+ def min( dbid, fieldNames, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
1168
+ </font><font color="black">
1169
+ <pre>
1170
+ Find the lowest value for one or more fields in the records returned by a query.
1171
+ e.g. minimumsHash = min("dfdfafff",["Date Sent","Quantity","Part Name"])
1172
+ </pre>
1173
+
1174
+
1175
+ <li><font color="blue">
1176
+ def max( dbid, fieldNames, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
1177
+ </font><font color="black">
1178
+ <pre>
1179
+ Find the lowest value for one or more fields in the records returned by a query.
1180
+ e.g. minimumsHash = min("dfdfafff",["Date Sent","Quantity","Part Name"])
1181
+ </pre>
1182
+
1183
+
1184
+ <li><font color="blue">
1185
+ def count( dbid, fieldNames, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
1186
+ </font><font color="black">
1187
+ <pre>
1188
+ Returns the number non-null values for one or more fields in the records returned by a query.
1189
+ e.g. countsHash = count("dfdfafff",["Date Sent","Quantity","Part Name"])
1190
+ </pre>
1191
+
1192
+
1193
+ <li><font color="blue">
1194
+ def sum( dbid, fieldNames, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
1195
+ </font><font color="black">
1196
+ <pre>
1197
+ Returns the sum of the values for one or more fields in the records returned by a query.
1198
+ e.g. sumsHash = sum("dfdfafff",["Date Sent","Quantity","Part Name"])
1199
+ </pre>
1200
+
1201
+
1202
+ <li><font color="blue">
1203
+ def average( dbid, fieldNames, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
1204
+ </font><font color="black">
1205
+ <pre>
1206
+ Returns the average of the values for one or more fields in the records returned by a query.
1207
+ e.g. averagesHash = sum("dfdfafff",["Date Sent","Quantity","Part Name"])
1208
+ </pre>
1209
+
1210
+
1211
+ <li><font color="blue">
1212
+ def applyPercentToRecords( dbid, numericField, percentField, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil)
1213
+ </font><font color="black">
1214
+ <pre>
1215
+ Query records, sum the values in a numeric field, calculate each record's percentage
1216
+ of the sum and put the percent in a percent field each record.
1217
+ </pre>
1218
+
1219
+
1220
+ <li><font color="blue">
1221
+ def applyDeviationToRecords( dbid, numericField, deviationField,
1222
+ </font><font color="black">
1223
+ <pre>
1224
+ Query records, get the average of the values in a numeric field, calculate each record's deviation
1225
+ from the average and put the deviation in a percent field each record.
1226
+ </pre>
1227
+
1228
+
1229
+ <li><font color="blue">
1230
+ def percent( inputValues )
1231
+ </font><font color="black">
1232
+ <pre>
1233
+ Given an array of two numbers, return the second number as a percentage of the first number
1234
+ </pre>
1235
+
1236
+
1237
+ <li><font color="blue">
1238
+ def deviation( inputValues )
1239
+ </font><font color="black">
1240
+ <pre>
1241
+ Given an array of two numbers, return the difference between the numbers as a positive number
1242
+ </pre>
1243
+
1244
+
1245
+ <li><font color="blue">
1246
+ def getFieldChoices(dbid,fieldName=nil,fid=nil)
1247
+ </font><font color="black">
1248
+ <pre>
1249
+ Get an array of the existing choices for a multiple-choice text field.
1250
+ </pre>
1251
+
1252
+
1253
+ <li><font color="blue">
1254
+ def getAllRecordIDs( dbid )
1255
+ </font><font color="black">
1256
+ <pre>
1257
+ Get an array of all the record IDs for a specified table.
1258
+ e.g. IDs = getAllRecordIDs( "dhnju5y7" ){ |id| puts "Record #{id}" }
1259
+ </pre>
1260
+
1261
+
1262
+ <li><font color="blue">
1263
+ def findDuplicateRecordIDs( fnames, fids, dbid = @dbid, ignoreCase = true )</font><font color="black">
1264
+ <pre>
1265
+ Finds records with the same values in a specified
1266
+ list of fields. The field list may be a list of field IDs or a list of field names.
1267
+ Returns a hash with the structure { "duplicated values" => [ rid, rid, ... ] }
1268
+ </pre>
1269
+
1270
+
1271
+ <li><font color="blue">
1272
+ </font><font color="black">
1273
+ <pre>
1274
+ </pre>
1275
+
1276
+
1277
+ <li><font color="blue">
1278
+ def deleteDuplicateRecords( fnames, fids = nil, options = nil, dbid = @dbid )</font><font color="black">
1279
+ <pre>
1280
+ Finds records with the same values in a specified
1281
+ list of fields and deletes all but the first or last duplicate record.
1282
+ The field list may be a list of field IDs or a list of field names.
1283
+ The 'options' parameter can be used to keep the oldest record instead of the
1284
+ newest record, and to control whether to ignore the case of field values when
1285
+ deciding which records are duplicates. Returns the number of records deleted.
1286
+ </pre>
1287
+
1288
+
1289
+ <li><font color="blue">
1290
+ def copyRecord( rid, numCopies = 1, dbid = @dbid )
1291
+ </font><font color="black">
1292
+ <pre>
1293
+ Make one or more copies of a record.
1294
+ </pre>
1295
+
1296
+
1297
+ <li><font color="blue">
1298
+ def importFromExcel( dbid, excelFilename, lastColumn = 'j', lastDataRow = 0, worksheetNumber = 1, fieldNameRow = 1, firstDataRow = 2, firstColumn = 'a' )
1299
+ </font><font color="black">
1300
+ <pre>
1301
+ Import data directly from an Excel file into a table. The field names are expected to be on line 1 by default.
1302
+ By default, data will be read starting from row 2 and ending on the first empty row.
1303
+ Commas in field values will be converted to semi-colons.
1304
+ e.g. importFromExcel( @dbid, "my_spreadsheet.xls", 'h' )
1305
+ </pre>
1306
+
1307
+ <li><font color="blue">def importCSVFile( filename, dbid = @dbid, targetFieldNames = nil )</font><font color="black">
1308
+ <pre>
1309
+ Add records from lines in a CSV file. If dbid is not specified, the active table will be used.
1310
+ values in subsequent lines. The file must not contain commas inside field names or values.
1311
+ </pre>
1312
+
1313
+ <li><font color="blue">def importTSVFile( filename, dbid = @dbid, targetFieldNames = nil )</font><font color="black">
1314
+ <pre>
1315
+ Import records from a text file in Tab-Separated-Values format.
1316
+ </pre>
1317
+
1318
+ <li><font color="blue">def importSVFile( filename, fieldSeparator = ",", dbid = @dbid, targetFieldNames = nil )</font><font color="black">
1319
+ <pre>
1320
+ Add records from lines in a separated values text file, using a specified field name/value separator.
1321
+
1322
+ e.g. importSVFile( "contacts.txt", "::", "dhnju5y7", [ "Name", "Phone", "Email" ] )
1323
+
1324
+ If targetFieldNames is not specified, the first line in the file
1325
+ must be a list of field names that match the values in subsequent lines.
1326
+
1327
+ If there are no commas in any of the field names or values, the file will be
1328
+ treated as if it were a CSV file and imported using the QuickBase importFromCSV API call.
1329
+ Otherwise, records will be added using addRecord() for each line.
1330
+ Lines with the wrong number of fields will be skipped.
1331
+ Double-quoted fields can contain the field separator, e.g. f1,"f,2",f3
1332
+ Spaces will not be trimmed from the beginning or end of field values.
1333
+ </pre>
1334
+ <li><font color="blue">def uploadFile( dbid, filename, fileAttachmentFieldName, additionalFieldsToSet = nil )</font><font color="black">
1335
+ <pre>
1336
+ Upload a file into a new record in a table. Additional field values can optionally be set.
1337
+ e.g. uploadFile( "dhnju5y7", "contacts.txt", "Contacts File", { "Notes" => "#{Time.now}" }
1338
+ </pre>
1339
+ <li><font color="blue">def updateFile( dbid, rid, filename, fileAttachmentFieldName, additionalFieldsToSet = nil )</font><font color="black">
1340
+ <pre>
1341
+ Update the file attachment in an existing record in a table. Additional field values can optionally be set.
1342
+ e.g. updateFile( "dhnju5y7", "6", "contacts.txt", "Contacts File", { "Notes" => "#{Time.now}" }
1343
+ </pre>
1344
+ <li><font color="blue">def logToFile( filename )</font><font color="black">
1345
+ <pre>
1346
+ Log requests to QuickBase and responses from QuickBase in a file.
1347
+ Useful for utilities that run unattended.
1348
+ </pre>
1349
+
1350
+ <li><font color="blue">def eachRecord( records = @records )</font><font color="black">
1351
+ <pre>
1352
+ Iterate @records XML and yield only &lt;record&gt; elements.
1353
+ </pre>
1354
+
1355
+
1356
+ <li><font color="blue">def doSQLInsert(sqlString)</font><font color="black">
1357
+ <pre>
1358
+ Translate a simple SQL INSERT statement to a QuickBase addRecord call.
1359
+ Note: This method is here primarily for Rails integration.
1360
+ Note: This assumes, like SQL, that your column (i.e. field) names do not contain spaces.
1361
+ </pre>
1362
+
1363
+
1364
+ <li><font color="blue">def doSQLUpdate(sqlString)</font><font color="black">
1365
+ <pre>
1366
+ Translate a simple SQL UPDATE statement to a QuickBase editRecord call.
1367
+ Note: This method is here primarily for Rails integration.
1368
+ Note: This assumes, like SQL, that your column (i.e. field) names do not contain spaces.
1369
+ Note: This assumes that Record ID# is the key field in your table.
1370
+ </pre>
1371
+
1372
+ <li><font color="blue">def doSQLQuery( sqlString, returnOptions = nil )</font><font color="black">
1373
+ <pre>
1374
+ Translate a simple SQL SELECT statement to a QuickBase query and run it.
1375
+
1376
+ If any supplied field names are numeric, they will be treated as QuickBase field IDs if
1377
+ they aren't valid field names.
1378
+
1379
+ e.g. doSQLQuery( "SELECT FirstName,Salary FROM Contacts WHERE LastName = "Doe" ORDER BY FirstName )
1380
+ e.g. doSQLQuery( "SELECT * FROM Books WHERE Author = "Freud" )
1381
+
1382
+ Note: This method is here primarily for Rails integration.
1383
+ Note: This assumes, like SQL, that your column (i.e. field) names do not contain spaces.
1384
+ </pre>
1385
+
1386
+
1387
+ </ol>
1388
+
1389
+ <b>'Plumbing' methods</b>
1390
+ <pre>
1391
+ These methods implement the core functionality to make the API_ wrapper methods
1392
+ and Helper methods work. Most programs will not need to use these methods directly
1393
+ and should avoid doing so.
1394
+ </pre>
1395
+ <ol>
1396
+ <li><font color="blue">def initialize( username = nil, password = nil, appname = nil, useSSL = true, printRequestsandReponses = false, stopOnError = false, showTrace = false, org = "www" )</font><font color="black">
1397
+ <pre>
1398
+ Set printRequestsandReponses to true to view the XML sent to QuickBase and return from QuickBase.
1399
+ This can be very useful during debugging.
1400
+
1401
+ Set stopOnError to true to discontinue sending requests to QuickBase after an error has occured with a request.
1402
+
1403
+ Set showTrace to true to view the complete stack trace of your running program. This should only be
1404
+ necessary as a last resort when a low-level exception has occurred.
1405
+ </pre>
1406
+
1407
+ <li><font color="blue">def Client.init( options )</font><font color="black">
1408
+ <br>Class method to create an instance of QuickBase::Client using a Hash of parameters. This will often be nicer to use than new().
1409
+
1410
+ <li><font color="blue">def debugHTTPConnection()</font><font color="black">
1411
+ <br>Causes useful information to be printed to the screen for every HTTP request.
1412
+
1413
+
1414
+ <li><font color="blue">def setHTTPConnection( useSSL, org = "www" )</font><font color="black">
1415
+ <br>initializes the connection to QuickBase.
1416
+
1417
+ <li><font color="blue">def setqbhost( useSSL, org = "www" )</font><font color="black">
1418
+ <br>sets the QuickBase URL and port to use for requests.
1419
+
1420
+ <li><font color="blue">def setHTTPConnectionAndqbhost( useSSL, org = "www" )</font><font color="black">
1421
+ <br>initializes the connection to QuickBase and sets the QuickBase URL and port to use for requests.
1422
+
1423
+ <li><font color="blue">def clientMethods()</font><font color="black">
1424
+ <br>Return an array of all the public methods of this class.
1425
+ <br>Used by CommandLineClient to verify commands entered by the user.
1426
+
1427
+ <li><font color="blue">def sendRequest( api_Request, xmlRequestData = nil )</font><font color="black">
1428
+ <br>Sends requests to QuickBase and processes the reponses.
1429
+
1430
+ <li><font color="blue">def resetErrorInfo()</font><font color="black">
1431
+ <br>Resets error info before QuickBase requests are sent.
1432
+
1433
+ <li><font color="blue">def getDBforRequestURL( api_Request )</font><font color="black">
1434
+ <br>Determines whether the URL for a QuickBase request
1435
+ <br>is for a specific database table or not, and returns the appropriate string
1436
+ <br>for that portion of the request URL.
1437
+
1438
+ <li><font color="blue">def getAuthenticationXMLforRequest()</font><font color="black">
1439
+ <br>Returns the request XML for either a ticket or a username and password.
1440
+
1441
+ <li><font color="blue">def isHTMLRequest?( api_Request )</font><font color="black">
1442
+ <br>Returns whether a request will return HTML rather than XML.
1443
+
1444
+ <li><font color="blue">def toggleTraceInfo( showTrace )</font><font color="black">
1445
+ <br>Turns program stack tracing on or off. If followed by a block,
1446
+ <br>the tracing will be toggled on or off at the end of the block.
1447
+
1448
+ <li><font color="blue">def printRequest( url, headers, xml )</font><font color="black">
1449
+ <br>Called by sendRequest if @printRequestsandReponses is true.
1450
+
1451
+ <li><font color="blue">def printResponse( code, xml )</font><font color="black">
1452
+ <br>Called by sendRequest if @printRequestsandReponses is true.
1453
+
1454
+ <li><font color="blue">def printLastError</font><font color="black">
1455
+ <br>Prints the error info, if any, for the last request sent to QuickBase.
1456
+
1457
+ <li><font color="blue">def processResponse( responseXML )</font><font color="black">
1458
+ <br>Except for requests that return HTML, called by sendRequest to process the XML responses returned from QuickBase.
1459
+
1460
+ <li><font color="blue">def getErrorInfoFromResponse()</font><font color="black">
1461
+ <br>Extracts error info from XML responses returned by QuickBase.
1462
+
1463
+ <li><font color="blue">def parseResponseXML( xml )</font><font color="black">
1464
+ <br>Called by processResponse to put the XML from QuickBase into a DOM tree using the REXML module that comes with Ruby.
1465
+
1466
+ <li><font color="blue">def getResponseValue( field )</font><font color="black">
1467
+ <br>Gets the value for a specific field at the top level of the XML returned from QuickBase.
1468
+
1469
+ <li><font color="blue">def getResponsePathValue( path )</font><font color="black">
1470
+ <br>Gets the value of a field using an XPath spec., e.g. field/name.
1471
+
1472
+ <li><font color="blue">def getResponsePathValues( path )</font><font color="black">
1473
+ <br>Gets an array of values at an Xpath in the XML from QuickBase.
1474
+
1475
+ <li><font color="blue">def getResponseElements( path )</font><font color="black">
1476
+ <br>Gets an array of elements at an Xpath in the XML from QuickBase.
1477
+
1478
+ <li><font color="blue">def getResponseElement( path )</font><font color="black">
1479
+ <br>Gets the element at an Xpath in the XML from QuickBase.
1480
+
1481
+ <li><font color="blue">def getAttributeString( element )</font><font color="black">
1482
+ <br>Returns a string representation of the attributes of an XML element.
1483
+
1484
+ <li><font color="blue">def lookupField( fid )</font><font color="black">
1485
+ <br>Returns the XML element for a field definition.
1486
+ <br>getSchema() or doQuery() should be called before this.
1487
+
1488
+ <li><font color="blue">def lookupFieldData( fid )</font><font color="black">
1489
+ <br>returns the XML element for a field returned by a getRecordInfo call.
1490
+
1491
+ <li><font color="blue">def getFieldDataValue(fid)</font><font color="black">
1492
+ <br>Returns the value for a field returned by a getRecordInfo call.
1493
+
1494
+ <li><font color="blue">def getFieldDataPrintableValue(fid)</font><font color="black">
1495
+ <br> Returns the printable value for a field returned by a getRecordInfo call.
1496
+
1497
+ <li><font color="blue">def lookupFieldIDByName( fieldName )</font><font color="black">
1498
+ <br>Gets the ID for a field using the QuickBase field label.
1499
+
1500
+ <li><font color="blue">def getFieldNames( dbid = nil, lowerOrUppercase = "")</font><font color="black">
1501
+ <br>Gets an array of the field names for a table.
1502
+
1503
+ <li><font color="blue">def getFieldIDs(dbid = nil)</font><font color="black">
1504
+ <br>Gets an array of the field IDs for a table.
1505
+
1506
+ <li><font color="blue">def getApplicationVariables( dbid = nil )</font><font color="black">
1507
+ <br>Get a Hash of application variables.
1508
+
1509
+ <li><font color="blue">def getApplicationVariable( variableName, dbid = nil )</font><font color="black">
1510
+ <br>Get the value of an application variable.
1511
+
1512
+ <li><font color="blue">def lookupFieldNameFromID( fid )</font><font color="black">
1513
+ <br>Gets a field name (i.e. QuickBase field label) using a field ID.
1514
+ <br>getSchema() or doQuery() should be called before this.
1515
+
1516
+ <li><font color="blue">def lookupFieldName( element )</font><font color="black">
1517
+ <br>Returns the name of field given an "fid" XML element.
1518
+
1519
+ <li><font color="blue">def lookupFieldType( element )</font><font color="black">
1520
+ <br>Returns a QuickBase field type, given an XML "fid" element.
1521
+
1522
+ <li><font color="blue">def lookupFieldsByType( type )</font><font color="black">
1523
+ <br>Returns an array of XML field elements matching a QuickBase field type.
1524
+
1525
+ <li><font color="blue">def lookupFieldPropertyByName( fieldName, property )</font><font color="black">
1526
+ <br>Returns the value of a field property, or nil.
1527
+
1528
+ <li><font color="blue">def isRecordidField?( fid )</font><font color="black">
1529
+ <br>Returns whether a field ID is the ID for the key field in a QuickBase table.
1530
+
1531
+ <li><font color="blue">def isTotalField?(fieldName)</font><font color="black">
1532
+ <br>Returns whether a field will show a Total on reports.
1533
+
1534
+ <li><font color="blue">def isAverageField?(fieldName)</font><font color="black">
1535
+ <br>Returns whether a field will show an Average on reports.
1536
+
1537
+ <li><font color="blue">def formatFieldValue( value, type, options = nil )</font><font color="black">
1538
+ <br>Returns a human-readable string representation of a QuickBase field value.
1539
+ <br>Also required for subsequent requests to QuickBase.
1540
+
1541
+ <li><font color="blue">def printChildElements( element, indent = 0 )</font><font color="black">
1542
+ <br>Recursive method to print a simplified (yaml-like) tree of any XML element returned by QuickBase.
1543
+ <br>Translates field IDs into field names. Very useful during debugging.
1544
+
1545
+ <li><font color="blue">def processChildElements( element, leafElementsOnly, block )</font><font color="black">
1546
+ <br>Recursive method to process leaf and (optionally) parent elements of any XML element returned by QuickBase.
1547
+
1548
+ <li><font color="blue">def findElementByAttributeValue( elements, attribute_name, attribute_value )</font><font color="black">
1549
+ <br>Returns the first XML sub-element with the specified attribute value.
1550
+
1551
+ <li><font color="blue">def findElementsByAttributeValue( elements, attribute_name, attribute_value )</font><font color="black">
1552
+ <br>Returns an array of XML sub-elements with the specified attribute value.
1553
+
1554
+ <li><font color="blue">def findElementsByAttributeName( elements, attribute_name )</font><font color="black">
1555
+ <br>Returns an array of XML sub-elements with the specified attribute name.
1556
+
1557
+ <li><font color="blue">def lookupRecord( rid )</font><font color="black">
1558
+ <br>returns the XML element for a record with the specified ID.
1559
+
1560
+ <li><font color="blue">def lookupQuery( qid )</font><font color="black">
1561
+ <br>returns the XML element for a query with the specified ID.
1562
+
1563
+ <li><font color="blue">def formatChdbidName( tableName )</font><font color="black">
1564
+ <br>Given the name of a QuickBase table, returns the QuickBase representation of the table name.
1565
+
1566
+ <li><font color="blue">def lookupChdbid( tableName )</font><font color="black">
1567
+ <br>Makes the table with the specified name the active table.
1568
+
1569
+ <li><font color="blue">def getTableName(dbid)</font><font color="black">
1570
+ <br>Get the name of a table given its id.
1571
+
1572
+ <li><font color="blue">def getTableNames(dbid, lowercaseOrUpperCase = "")</font><font color="black">
1573
+ <br>Get a list of the names of the child tables of an application.
1574
+
1575
+ <li><font color="blue">def getTableIDs(dbid)</font><font color="black">
1576
+ <br>Get a list of the dbid's of the child tables of an application.
1577
+
1578
+ <li><font color="blue">def getNumTables(dbid)</font><font color="black">
1579
+ <br>Get the number of child tables of an application.
1580
+
1581
+ <li><font color="blue">def getReportNames(dbid = @dbid)</font><font color="black">
1582
+ <br>Get a list of the names of the reports (i.e. queries) for a table
1583
+
1584
+ <li><font color="blue">def toXML( tag, value = nil )</font><font color="black">
1585
+ <br>Returns the XML for a specific item included in a request to QuickBase.
1586
+
1587
+ <li><font color="blue">def isValidFieldType?( type )</font><font color="black">
1588
+ <br>Returns whether a given string represents a valid QuickBase field type.
1589
+
1590
+ <li><font color="blue">def isValidFieldProperty?( property )</font><font color="black">
1591
+ <br>Returns whether a given string represents a valid QuickBase field property.
1592
+
1593
+ <li><font color="blue">def addFieldValuePair( name, fid, filename, value )</font><font color="black">
1594
+ <br>Adds a field value to the list of fields to be set by the next addRecord() or editRecord() call to QuickBase.
1595
+ <br>name - label of the field value to be set
1596
+ <br>fid - id of the field to be set
1597
+ <br>filename - if the field is a file attachment field, the name of the file that should be displayed in QuickBase.
1598
+ <br>value - the value to set in this field. If the field is a file attachment field, the name of the file that should be uploaded into QuickBase.
1599
+
1600
+ <li><font color="blue">def replaceFieldValuePair( name, fid, filename, value )</font><font color="black">
1601
+ <br>Replaces a field value in the list of fields to be set by the next addRecord() or editRecord() call to QuickBase.
1602
+
1603
+ <li><font color="blue">def clearFieldValuePairList</font><font color="black">
1604
+ <br>clearFieldValuePairList: empty the list of field values used for the next addRecord() or editRecord() call to QuickBase.
1605
+
1606
+ <li><font color="blue">def verifyFieldList( fnames, fids = nil, dbid = @dbid )</font><font color="black">
1607
+ <br>Given an array of field names or field IDs and a table ID, builds an array of valid field IDs and field names.
1608
+ <br>Throws an exception when an invalid name or ID is encountered.
1609
+
1610
+ <li><font color="blue">def getQueryRequestXML( query = nil, qid = nil, qname = nil )</font><font color="black">
1611
+ <br>Builds the request XML for retrieving the results of a query.
1612
+
1613
+
1614
+
1615
+ <li>
1616
+ <font color="blue">getColumnListForQuery( id, name )
1617
+ </font><font color="black">
1618
+ <br>
1619
+ Returns the clist associated with a query.
1620
+
1621
+
1622
+ <li>
1623
+ <font color="blue">
1624
+ def getSortListForQuery( id, name )
1625
+ </font><font color="black">
1626
+ <br>
1627
+ Returns the slist associated with a query.
1628
+
1629
+
1630
+ <li>
1631
+ <font color="blue">
1632
+ verifyQueryOperator( operator, fieldType )
1633
+ </font><font color="black">
1634
+ <br>
1635
+ Returns a valid query operator.
1636
+
1637
+ <li>
1638
+ <font color="blue">
1639
+ def lookupBaseFieldTypeByName( fieldName )
1640
+ </font><font color="black">
1641
+ <br>
1642
+ Get a field's base type using its name.
1643
+
1644
+ <li>
1645
+ <font color="blue">
1646
+ def lookupFieldTypeByName( fieldName )
1647
+ </font><font color="black">
1648
+ <br>
1649
+ Get a field's type using its name.
1650
+
1651
+
1652
+
1653
+ <li><font color="blue">def formatImportCSV( csv )</font><font color="black">
1654
+ <br>Returns the string required for emebedding CSV data in a request.
1655
+
1656
+ <li><font color="blue">def formatDate( milliseconds, fmtString = nil, addDay = false )</font><font color="black">
1657
+ <br>Returns the humad-readable string represntation of a date, given the milliseconds version of the date.
1658
+ <br>Also needed for requests to QuickBase.
1659
+
1660
+ <li><font color="blue">def formatDuration( value, option = "hours" )</font><font color="black">
1661
+ <br>Converts milliseconds to hours and returns the value as a string.
1662
+
1663
+ <li>
1664
+ <font color="blue">
1665
+ def formatTimeOfDay(milliseconds, format = "%I:%M %p" )
1666
+ </font><font color="black">
1667
+ <br>
1668
+ Returns a string format for a time of day value.
1669
+
1670
+
1671
+ <li>
1672
+ <font color="blue">
1673
+ def formatCurrency( value, options = nil )
1674
+ </font><font color="black">
1675
+ <br>
1676
+ Returns a string format for a currency value.
1677
+
1678
+ <li>
1679
+ <font color="blue">
1680
+ def formatPercent( value, options = nil )
1681
+ </font><font color="black">
1682
+ <br>
1683
+ Returns a string format for a percent value, given the data from QuickBase.
1684
+
1685
+ <li><font color="blue">def dateToMS( dateString )</font><font color="black">
1686
+ <br>Returns the milliseconds representation of a date specified in mm-dd-yyyy format.
1687
+
1688
+ <li><font color="blue">def splitString( string, fieldSeparator = "," )</font><font color="black">
1689
+ <br>Converts a string into an array, given a field separator.
1690
+ <br>'"' followed by the field separator are treated the same way as just the field separator.
1691
+
1692
+ <li><font color="blue">def escapeXML( char )</font><font color="black">
1693
+ <br>returns the URL-encoded version of a non-printing character.
1694
+
1695
+ <li><font color="blue">def encodingStrings( reverse = false )</font><font color="black">
1696
+ <li>Returns the list of string substitutions to make to encode or decode field values used in XML.
1697
+
1698
+ <li><font color="blue">def encodeXML( text, doNPChars = false )</font><font color="black">
1699
+ <br>Modify the given string for use as a XML field value.
1700
+
1701
+ <li><font color="blue">def decodeXML( text )</font><font color="black">
1702
+ <br>Modify the given XML field value for use as a string.
1703
+
1704
+ <li><font color="blue">def resetrid</font><font color="black">
1705
+ <br>Set the @rid (active record ID) member variable to nil.
1706
+
1707
+ <li><font color="blue">def resetfid</font><font color="black">
1708
+ <br>set the @fid (active field ID) member variable to nil.
1709
+
1710
+ <li><font color="blue">def onChangedDbid</font><font color="black">
1711
+ <br>Reset appropriate member variables after a different table is accessed.
1712
+
1713
+ <li><font color="blue">def subscribe( event, handler )</font><font color="black">
1714
+ <br>Subscribe to a specified event published by QuickBase::Client.
1715
+
1716
+ <li><font color="blue">def setLogger( logger )</font><font color="black">
1717
+ <br>Set the instance of a QuickBase::Logger to be used by QuickBase::Client.
1718
+ <br>Closes the open log file if necessary.
1719
+
1720
+ </ol>
1721
+ <br>
1722
+ <b>Nested class</b>
1723
+ <br>
1724
+ <br>
1725
+ <font color="blue">class FieldValuePairXML</font><font color="black">
1726
+ <br>Encapsulates field values to be set and file uploads to be made during addRecord() and editRecord() calls.
1727
+ <br>
1728
+ <h3>Class QuickBase::EventHandler</h3>
1729
+ <pre>
1730
+ To subscribe to events fired by the Client class, derive from this
1731
+ class, override handle( event ), and call subscribe( event, self ).
1732
+ See Client.subscribe() for a list of events.
1733
+ </pre>
1734
+ <p>
1735
+ <b>Methods</b>
1736
+ <ol>
1737
+ <li><font color="blue">def handle( event )</font><font color="black">
1738
+ <br>Override this method to be notified of events fired by QuickBase::Client.
1739
+ Events fired are :-
1740
+ <ol>
1741
+ <li>onSendRequest
1742
+ <li>onProcessResponse
1743
+ <li>onSetActiveTable
1744
+ <li>onRequestSucceeded
1745
+ <li>onRequestFailed
1746
+ <li>onSetActiveRecord
1747
+ <li>onSetActiveField
1748
+ </ol>
1749
+ </ol>
1750
+
1751
+ <h3>Class QuickBase::Logger</h3>
1752
+ <pre>
1753
+ To log QuickBase requests and responses to a file, make an instance
1754
+ of this class and call Client.setLogger( loggerInstance ).
1755
+ Call Client.setLogger( nil ) to turn logging off.
1756
+ The log file is written in CSV format to make it importable by QuickBase.
1757
+ </pre>
1758
+ <b>Methods</b>
1759
+ <ol>
1760
+ <li><font color="blue">def initialize( filename, append = true )</font><font color="black">
1761
+ <br>Opens filename as a log file. filename will be appended to if it already exists, unless append is false.
1762
+ <li><font color="blue">def closeLogFile()</font><font color="black">
1763
+ <br>Closes the log file and resets all variables.
1764
+ <li><font color="blue">def changeLogFile( filename, append = true )</font><font color="black">
1765
+ <br>Closes a log file that may already be open and opens filename. filename will be appended to if it
1766
+ already exists, unless append is false.
1767
+ <li><font color="blue">def logRequest( dbidForRequestURL, api_Request, requestXML )</font><font color="black">
1768
+ <br>Called by QuickBase::Client to log requests to QuickBase.
1769
+ <li><font color="blue">def logResponse( error, responseXML )</font><font color="black">
1770
+ <br>Called by QuickBase::Client to log responses from QuickBase.
1771
+ <li><font color="blue">def getTimeString()</font><font color="black">
1772
+ <br>Called by the logger to format a timestamp string to write to the log file.
1773
+ </ol>
1774
+
1775
+ <h3>Class QuickBase::CommandLineClient &lt; Client</h3>
1776
+ <pre>
1777
+ This implements an extensible command line interface to QuickBase.
1778
+ Use setCommand() and setCommandAlias() to extend or modify the interface.
1779
+
1780
+ Call run() to use the command line interactively.
1781
+ Call run( filename ) to run the commands in a file.
1782
+ Commands entered during an interactive session can be recorded to a file.
1783
+
1784
+ In addition to the @commands loaded in initialize(), any public method
1785
+ from class Client can be used as a command, and any line of ruby code
1786
+ can be executed.
1787
+ </pre>
1788
+ <br>
1789
+ <b>Nested class</b>
1790
+ <br>
1791
+ <br>
1792
+ <font color="blue">class Command</font><font color="black">
1793
+ <br>
1794
+ <br>Contains the data for commands:-
1795
+ <br>
1796
+ <ol>
1797
+ <li><font color="blue">name</font><font color="black"> - name of the command shown to the user
1798
+ <li><font color="blue">desc</font><font color="black"> - description of the command shown to the user
1799
+ <li><font color="blue">prerequisite</font><font color="black"> - boolean expression controlling the availability of the command
1800
+ <li><font color="blue">args</font><font color="black"> - list of required parameters displayed to the user
1801
+ <li><font color="blue">code</font><font color="black"> - array of methods to call to run when this command is selected. Only the first method can expect any parameters.
1802
+ <li><font color="blue">prompt</font><font color="black"> - a prompt string that should accompany the command. nil by default.
1803
+ </ol>
1804
+ <br>
1805
+ <b>Methods</b>
1806
+ <ol>
1807
+ <li><font color="blue">def initialize()</font><font color="black">
1808
+ <br>Loads the default list of commands and their aliases.
1809
+ <li><font color="blue">def showUsage()</font><font color="black">
1810
+ <br>Displays a usage message.
1811
+ <li><font color="blue">def setCommand( name, desc, prerequisite, args, code, prompt = nil )</font><font color="black">
1812
+ <br>Add a command to the list of commands avaliable to the user.
1813
+ <li><font color="blue">def setCommandAlias( anAlias, cmd )</font><font color="black">
1814
+ <br>Sets the alias (abbreviation) for a command.
1815
+ <li><font color="blue">def evalAvailableCommands()</font><font color="black">
1816
+ <br>Build the list of available commands by testing the boolean expression associated with each command.
1817
+ <li><font color="blue">def cmdString( command, include_desc = true )</font><font color="black">
1818
+ <br>Builds the representation of a command displayed to the user.
1819
+ <li><font color="blue">def showAvailableCommands()</font><font color="black">
1820
+ <br>Builds the list of available commands and displays them.
1821
+ <li><font color="blue">def prompt( promptString )</font><font color="black">
1822
+ <br>If promptString is not nil, display the prompt string and wait for input from the user.
1823
+ <li><font color="blue">def run( filename = nil )</font><font color="black">
1824
+ <br>Runs the commands in a file, or runs a loop that displays the list of available commands and processes
1825
+ the user's input.
1826
+ </ol>
1827
+
1828
+
1829
+ <h3>Class QuickBase::WebClient &lt; CommandLineClient</h3>
1830
+ <pre>
1831
+ A web server that responds to requests to run command files
1832
+ present on the local machine. This extends QuickBase via URLs on web pages.
1833
+
1834
+ e.g. if there is an 'uploadSpreadsheet.qbc' command file next to this QuickBaseClient.rb
1835
+ file on your machine, it can be run from a web page by starting 'WebClient.new' on your
1836
+ machine and placing 'http://127.0.0.1:2358/qbc/uploadSpreadsheet.qbc' in a link on the
1837
+ web page.
1838
+
1839
+ Any request that does not include "/qbc/" will shut down the server.
1840
+ </pre>
1841
+ <b>Methods</b>
1842
+ <ol>
1843
+ <li><font color="blue">def initialize( runNow = true, ipAddress = 'localhost', port = 2358 )</font><font color="black">
1844
+ <br>Set the IP address and port, on which to run the web server, and optionally start the server.
1845
+ The IP address must be a valid address for the machine on which this server is run.
1846
+ <li><font color="blue">def stop()</font><font color="black">
1847
+ <br>Stops the web server.
1848
+ <li><font color="blue">def start( ipAddress = 'localhost', port = 2358 )</font><font color="black">
1849
+ <br>Starts the web server on a separate thread and processes requests to run command files.
1850
+ If the server is already running, it will be restarted.
1851
+ </ol>
1852
+
1853
+ <h2>Additional Ruby classes that build on <a href="QuickBaseClient.rb">QuickBase::Client</a></h2>
1854
+
1855
+ <ol>
1856
+ <li><a href="QuickBaseEventNotifier.rb">QuickBaseEventNotifier.rb</a>
1857
+ <li><a href="QuickBaseRSSGenerator.rb">QuickBaseRSSGenerator.rb</a>
1858
+ <li><a href="QuickBaseTwitterConnector.rb">QuickBaseTwitterConnector.rb</a>
1859
+ <li><a href="QuickBaseMisc.rb">QuickBaseMisc.rb</a>
1860
+ <li><a href="QuickBaseTextData.rb">QuickBaseTextData.rb</a>
1861
+ <li><a href="QuickBaseEmailer.rb">QuickBaseEmailer.rb</a>
1862
+ </ol>
1863
+
1864
+ <h2>Appendices</h2>
1865
+
1866
+ <h3>Appendix 1: Submitting enhancement requests and bugs</h3>
1867
+ Please submit enhancement requests in the <a href="https://www.quickbase.com/db/8emtadvk?a=dr&r=ztj&rl=cjtm">QuickBase Community Forum</a>.
1868
+
1869
+ <h3>Appendix 2: To Do List and future directions</h3>
1870
+ <b>To Do:-</b>
1871
+ <ol>
1872
+ <li>Expand test code to cover all methods and the most common cases.
1873
+ <li>Make it as easy as possible for people to get started with QuickBaseClient.rb.
1874
+ </ol>
1875
+ <b>Future directions:-</b>
1876
+ <ol>
1877
+ <li>Add extensible classes to convert response XML to other formats. Start with the most useful formats.
1878
+ <li>Add extensible classes to convert data and code into requests. Start with the most useful formats.
1879
+ <li>Write a QuickBase adapter for Rails - DONE! Please see <a href="quickbase_adapter.rb.htm">quickbase_adapter.rb.htm</a>.
1880
+ </ol>
1881
+ <h3>Appendix 3: Design goals behind the creation of <a href="QuickBaseClient.rb">QuickBaseClient.rb</a></h3>
1882
+ <ol>
1883
+ <li>Since this project is being done outside normal work hours, the work is prioritized as if it
1884
+ will have to stop at any time.
1885
+ <li>The first goal was to wrap the QuickBase HTTP API in a Ruby class in a way that minimizes the amount of additional documentation
1886
+ needed by users of the Ruby class. The assumption is that many developers will prefer working in Ruby to working in the other
1887
+ QuickBase SDK languages.
1888
+ <li>The second goal is to write test code that reduces the need for manual regression testing of the Ruby class.
1889
+ <li>Next is the addition of methods that reduce the amount of code developers have to write to perform
1890
+ common tasks using QuickBaseClient.rb. This will be ongoing.
1891
+ <li>Next is the implementation of a small program that provides almost immediate benefit to users. The QuickBase::CommandLineClient
1892
+ serves this purpose and also helps in testing QuickBase::Client and understanding what additional functionality would
1893
+ be worth developing.
1894
+ </ol>
1895
+ </body>
1896
+ </html>