ipp_quickbase_devkit 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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
@@ -0,0 +1,21 @@
1
+
2
+ require 'QuickBaseClient'
3
+
4
+ qbc = QuickBase::Client.new("username","password")
5
+
6
+ # get Fred's QuickBase user info
7
+ qbc.getUserInfo("fred_flintstone@internet.com")
8
+
9
+ fredsUserID = qbc.userid.dup
10
+
11
+ # Assume "10" is the id of the Viewer role in the application with the "bbqm84dzy" id
12
+ qbc.addUserToRole( "bbqm84dzy", fredsUserID, "10" )
13
+
14
+ # Assume "11" is the id of the Participant role in the application with the "bbqm84dzy" id
15
+ qbc.changeUserRole( "bbqm84dzy", fredsUserID, "10", "11" )
16
+
17
+ # Remove Fred from the Participant Role
18
+ qbc.removeUserFromRole( "bbqm84dzy", fredsUserID, "11" )
19
+
20
+
21
+
@@ -0,0 +1,10 @@
1
+
2
+ require 'QuickBaseClient'
3
+
4
+ qbc = QuickBase::Client.new("username","password")
5
+
6
+ # Attempt to change Name to Fred in record 7
7
+ # If there is no record 7, add a new record and set the Name to Fred.
8
+ qbc.addFieldValuePair("Name",nil,nil,"Fred")
9
+ qbc.addOrEditRecord("dbiddbid",qbc.fvlist,"7")
10
+
@@ -0,0 +1,55 @@
1
+ require 'QuickBaseObjects'
2
+
3
+ qbob = QuickBase::Objects::Builder.new("username","password")
4
+
5
+ myApplication = qbob.application("My Application")
6
+
7
+ puts "\n\nApplication name:\n"
8
+ puts myApplication.name
9
+
10
+ puts "\n\nApplication roles:\n"
11
+ myApplication.roles.each_value{|role|puts "name: #{role.name}, id: #{role.id}, access: #{role.access}"}
12
+
13
+ puts "\n\nApplication users:\n"
14
+ myApplication.users.each_value{|user|puts "id: #{user.id}"}
15
+
16
+ puts "\n\nApplication variables:\n"
17
+ myApplication.variables.each_value{|variable|puts "#{variable.name}: #{variable.value}"}
18
+
19
+ puts "\n\nValue of application variable 'TestVariable':\n"
20
+ puts myApplication.vTestVariable
21
+
22
+ puts "\n\nSet the value of application variable 'TestVariable':\n"
23
+ myApplication.vTestVariable="New value for test variable"
24
+
25
+ puts "\n\nApplication pages:\n"
26
+ myApplication.pages.each_value{|page|puts page.name}
27
+
28
+ puts "\n\nDefault application page:\n"
29
+ puts myApplication.pDefault_Dashboard.name
30
+
31
+ puts "\n\nTables from My Application:\n"
32
+ myApplication.tables.each_value{|table|puts table.name}
33
+
34
+ puts "\n\nQueries from the Contacts table:\n"
35
+ myApplication.tContacts.queries.each_value{|query|puts query.name}
36
+
37
+ puts "\n\nProperties of the List All query from the Contacts table:\n"
38
+ myApplication.tContacts.qList_All.properties.each_pair{|key,value|puts "#{key}: #{value}" }
39
+
40
+ puts "\n\nNames from the List All query from the Contacts table:\n"
41
+ records = myApplication.tContacts.qList_All.run
42
+ records.each{|record| puts record.fName}
43
+
44
+ puts "\n\nColumns of the List All query from the Contacts table:\n"
45
+ puts myApplication.tContacts.qList_All.qyclst
46
+
47
+ puts "\n\nFields from the Contacts table:\n"
48
+ myApplication.tContacts.fields.each_value{|field|puts field.name}
49
+
50
+ puts "\n\nField ID of the Phone field in the Contacts table:\n"
51
+ puts myApplication.tContacts.fPhone.id
52
+
53
+ puts "\n\nName of field 7 from the Contacts table:\n"
54
+ puts myApplication.tContacts.fields["7"].name
55
+
@@ -0,0 +1,10 @@
1
+ require 'QuickBaseClient'
2
+
3
+ qbc = QuickBase::Client.new(ENV["quickbase_username"],ENV["quickbase_password"])
4
+ qbc.iterateRecords("bdcvpsxpy",qbc.getFieldNames("bdcvpsxpy")){|record|
5
+ nameAndNumber = eval(record['ruby formula 1']) || "<name and number>"
6
+ qbc.clearFieldValuePairList
7
+ qbc.addFieldValuePair("name+number",nil,nil,nameAndNumber)
8
+ qbc.editRecord("bdcvpsxpy", record['Record ID#'],qbc.fvlist)
9
+ }
10
+
@@ -0,0 +1,27 @@
1
+
2
+ require 'QuickBaseClient'
3
+
4
+ qbc = QuickBase::Client.new("username","password")
5
+
6
+ qbc.iterateRecords("bcct3jb3b",["number"]){|record|
7
+ puts "number: #{record['number']}"
8
+ }
9
+
10
+ average = qbc.average("bcct3jb3b",["number"])
11
+ puts "average: #{average['number']}"
12
+
13
+ =begin
14
+
15
+ number: 62
16
+ number: 21
17
+ number: 76
18
+ number: 13
19
+ number: 34
20
+ number: 2
21
+ number: 66
22
+ number: 2
23
+ number: 3
24
+ average: 31.0
25
+
26
+
27
+ =end
@@ -0,0 +1,8 @@
1
+ require 'QuickBaseClient'
2
+
3
+ qbc = QuickBase::Client.new( "my_username", "my_password", "my_application" )
4
+
5
+ # "true" at the end means copy all the data, not just the structure of the database
6
+ qbc.cloneDatabase( qbc.dbid, "my_application_backup", "backup of my_application", true )
7
+
8
+ qbc.signOut
@@ -0,0 +1,53 @@
1
+ require 'QuickBaseClient'
2
+
3
+ qbc = QuickBase::Client.new
4
+
5
+ # get the schema for the QuickBase Community Forum
6
+ firstTime=true
7
+ 2.times {
8
+
9
+ totalTime = Time.now
10
+
11
+ 8.times {
12
+ getSchemaTime = Time.now
13
+ qbc.getSchema("bbqm84dzy")
14
+ puts "getSchema took #{Time.now-getSchemaTime} seconds"
15
+ }
16
+
17
+ puts "\nTotal time: #{Time.now-totalTime} seconds"
18
+
19
+ qbc.signOut
20
+ qbc = QuickBase::Client.new
21
+ qbc.cacheSchemas = true
22
+ puts "Caching schema..." if firstTime
23
+ firstTime = false
24
+ }
25
+
26
+ =begin
27
+
28
+ Sample output of the above script:-
29
+
30
+ getSchema took 1.438 seconds
31
+ getSchema took 0.515 seconds
32
+ getSchema took 0.5 seconds
33
+ getSchema took 0.485 seconds
34
+ getSchema took 0.515 seconds
35
+ getSchema took 0.532 seconds
36
+ getSchema took 0.484 seconds
37
+ getSchema took 0.5 seconds
38
+
39
+ Total time: 4.969 seconds
40
+ Caching schema...
41
+ getSchema took 0.515 seconds
42
+ getSchema took 0.016 seconds
43
+ getSchema took 0.015 seconds
44
+ getSchema took 0.0 seconds
45
+ getSchema took 0.016 seconds
46
+ getSchema took 0.0 seconds
47
+ getSchema took 0.016 seconds
48
+ getSchema took 0.031 seconds
49
+
50
+ Total time: 0.609 seconds
51
+
52
+ =end
53
+
@@ -0,0 +1,11 @@
1
+ require 'QuickBaseClient'
2
+
3
+ qbc = QuickBase::Client.new(ENV["quickbase_username"],ENV["quickbase_password"])
4
+
5
+ runningTotal = 0
6
+ qbc.iterateRecords("bdcvpsxpy",qbc.getFieldNames("bdcvpsxpy"),nil,nil,"List All by Date Created"){|record|
7
+ runningTotal += record['number'].to_i
8
+ qbc.clearFieldValuePairList
9
+ qbc.addFieldValuePair("running total",nil,nil,runningTotal.to_s)
10
+ qbc.editRecord("bdcvpsxpy",record['Record ID#'],qbc.fvlist)
11
+ }
@@ -0,0 +1,73 @@
1
+ require 'QuickBaseClient'
2
+ require 'Date'
3
+
4
+ if ARGV.length < 4
5
+ puts "\n Usage: ruby copyrecords.rb <username> <password> <sourceTableDBID> <targetTableDBID>\n"
6
+ puts "\n e.g. ruby copyrecords.rb myusername mypassword xxxxxxxxx yyyyyyyyy\n."
7
+ puts "\n Adds copies of records from a main table to a history table."
8
+ puts "\n This script assumes the field names match between the two tables.\n"
9
+ exit
10
+ end
11
+
12
+ qbc = QuickBase::Client.new( ARGV[0], ARGV[1] )
13
+
14
+ #Uncomment the following line to see the data being sent to QuickBase and returned from QuickBase
15
+ #qbc.printRequestsAndResponses = true
16
+
17
+ #fieldNames is the list of fields values you want to copy
18
+ #Change the list to match your real field names.
19
+
20
+ fieldNames = Array.new
21
+ fieldNames = [ "Record ID#", "Date Updated", "Title", "Description", "MutipleChoiceField" ]
22
+
23
+ puts "Adding copies of all source table records to target table"
24
+
25
+ #fieldValues is a hash of arrays of field values from all records in the source table
26
+ qbc.getSchema( ARGV[2] )
27
+ fieldValues = qbc.getAllValuesForFields( ARGV[2], fieldNames )
28
+ numRecs = fieldValues[ "Record ID#" ].length
29
+
30
+ #for each record (i) retrieved from the source table...
31
+ (0..numRecs.to_i-1).each{ |i|
32
+
33
+ #clear previously uploaded field values
34
+ qbc.clearFieldValuePairList
35
+
36
+ #loop through the list of field values for record i
37
+ fieldValues.each { |fieldName,valueArray|
38
+
39
+ # get the value of fieldName in record i
40
+ value = valueArray[i]
41
+
42
+ # copy the field name - it will need to be changed for some fields
43
+ targetFieldName = fieldName.dup
44
+
45
+ # date fields must be converted from the numeric version to a format that can be sent back to QuickBase
46
+ value = qbc.formatDate( value, nil, true ) if targetFieldName == "Date Updated"
47
+
48
+ # put the source table's Record ID# in a different field in the target table
49
+ # (you could do this for any field that has a different name in the target table)
50
+ targetFieldName = "Source Record ID #" if targetFieldName == "Record ID#"
51
+
52
+ # the values of multiple choice fields must be in the list of available choices
53
+ if targetFieldName == "MutipleChoiceField"
54
+ qbc._fieldNameAddChoices( targetFieldName, value )
55
+ end
56
+
57
+ # add the field value to the list of fields to be uploaded to the target table
58
+ qbc.addFieldValuePair( targetFieldName, nil, nil, value )
59
+ }
60
+
61
+ puts "Adding record #{i} of #{numRecs.to_i-1}"
62
+ qbc.addRecord( ARGV[3], qbc.fvlist )
63
+
64
+ # print any error message from QuickBase, if there was one
65
+ if !qbc.requestSucceeded
66
+ qbc.printLastError
67
+ end
68
+
69
+ }
70
+
71
+ # signout of QuickBase
72
+ qbc.signOut
73
+
@@ -0,0 +1,26 @@
1
+
2
+ require 'QuickBaseClient'
3
+
4
+ qbc = QuickBase::Client.new("username","password")
5
+
6
+ qbc.iterateRecords("bcct3jb3b",["number"]){|record|
7
+ puts "number: #{record['number']}"
8
+ }
9
+
10
+ count = qbc.count("bcct3jb3b",["number"])
11
+ puts "count: #{count['number']}"
12
+
13
+ =begin
14
+
15
+ number: 62
16
+ number: 21
17
+ number: 76
18
+ number: 13
19
+ number: 34
20
+ number: 2
21
+ number: 66
22
+ number: 2
23
+ number: 3
24
+ count: 9
25
+
26
+ =end
@@ -0,0 +1,42 @@
1
+
2
+ require 'QuickBaseClient'
3
+ require 'QuickBaseMisc'
4
+
5
+ qbc = QuickBase::Client.new
6
+
7
+ i = 0
8
+ recordViewLinks = ""
9
+ qbc.iterateRecords("8emtadvk",["Message ID#","Subject"]){|msg|
10
+ if i < 15
11
+ r = QuickBase::Misc.decimalToBase32(msg['Message ID#'])
12
+ recordViewLinks << "<a href=\"https://www.quickbase.com/db/8emtadvk?a=dr&r=#{r}\" target=\"RecordContainer\">#{msg['Subject']}</a><br>"
13
+ end
14
+ i += 1
15
+ }
16
+
17
+ html = <<EndHTML
18
+
19
+ <html>
20
+ <head>
21
+ <style type="text/css">
22
+ td { white-space: nowrap; vertical-align: top }
23
+ </style>
24
+ </head>
25
+ <body>
26
+ <table border="1" >
27
+ <tr><td><b>Community Forum Records</b><td><td></tr>
28
+ <tr>
29
+ <td>
30
+ #{recordViewLinks}
31
+ </td>
32
+ <td>
33
+ <iframe name="RecordContainer" Width="800" Height="650" />
34
+ </td>
35
+ </tr>
36
+ </table>
37
+ </body>
38
+ </html>
39
+
40
+ EndHTML
41
+
42
+ File.open("QuickBaseCommunityForumRecordViewer.html","w"){|f|f.write(html)}
@@ -0,0 +1,35 @@
1
+
2
+ require 'QuickBaseClient'
3
+
4
+ qbc = QuickBase::Client.new
5
+
6
+ reportsHTML = ""
7
+ reportNames = qbc.getReportNames("8emtadvk")
8
+ reportNames.each{|reportName|
9
+ report = qbc.lookupQueryByName(reportName)
10
+ reportID = report.attributes["id"]
11
+ reportsHTML << "<a href=\"https://www.quickbase.com/db/8emtadvk?a=q&qid=#{reportID}\" target=\"ReportContainer\" >#{reportName}</a><BR>"
12
+ }
13
+
14
+ html = "<html>"
15
+ html << "<head>"
16
+ html << "<style type=\"text/css\">"
17
+ html << "td { white-space: nowrap; vertical-align: top }"
18
+ html << "</style>"
19
+ html << "</head>"
20
+ html << "<body>"
21
+ html << "<table border=\"1\" >"
22
+ html << "<tr><td><b>Community Forum Reports</b><td><td></tr>"
23
+ html << "<tr>"
24
+ html << "<td><b>"
25
+ html << reportsHTML
26
+ html << "</b></td>"
27
+ html << "<td>"
28
+ html << "<iframe name=\"ReportContainer\" Width=\"700\" Height=\"800\" />"
29
+ html << "</td>"
30
+ html << "</tr>"
31
+ html << "</table>"
32
+ html << "</body>"
33
+ html << "</html>"
34
+
35
+ File.open("QuickBaseCommunityForumReports.html","w"){|f|f.write(html)}
@@ -0,0 +1,12 @@
1
+
2
+ require 'QuickBaseClient'
3
+
4
+ # Add an Authors table to a Books application
5
+
6
+ qbc = QuickBase::Client.new( "username","password","Books")
7
+
8
+ qbc.createTable("Authors")
9
+
10
+ qbc._addField("Name", "text")
11
+
12
+
@@ -0,0 +1,25 @@
1
+
2
+ require 'QuickBaseClient'
3
+
4
+ qbc = QuickBase::Client.new("username","password")
5
+
6
+ qbc.applyDeviationToRecords("bcc9qcnxw","number","deviation")
7
+
8
+ numberAverage = qbc.average("bcc9qcnxw",["number"])
9
+ puts "number average: #{numberAverage['number']}"
10
+
11
+ qbc.iterateRecords("bcc9qcnxw",["number","deviation"]){|record|
12
+ puts "number: #{record['number']}, deviation: #{record['deviation']}"
13
+ }
14
+
15
+ =begin
16
+
17
+ Sample output of above script:-
18
+
19
+ number average: 31.0
20
+ number: 20, deviation: 11
21
+ number: 36, deviation: 5
22
+ number: 56, deviation: 25
23
+ number: 12, deviation: 19
24
+
25
+ =end
@@ -0,0 +1,97 @@
1
+ require 'QuickBaseClient'
2
+ require 'cgi'
3
+
4
+ if ARGV.length < 2
5
+ puts "\n Usage: ruby downloadCookbook.rb <username> <password>\n"
6
+ puts "\n This script copies the recipes from the QuickBase API Cookbook to your local drive.\n"
7
+ exit
8
+ end
9
+
10
+ qbc = QuickBase::Client.new( ARGV[0], ARGV[1] )
11
+
12
+ fieldsToDownload = [ "Record ID#", "Title", "Keywords", "Problem", "Solution", "Discussion", "See Also", "File Attachment", "Ingredient 1", "Ingredient 2", "Ingredient 3", "Chef" ]
13
+
14
+ # this is the original QuickBase API Cookbook v3 recipes table
15
+ fieldValues = qbc.getAllValuesForFields( "bcdcajmrg", fieldsToDownload, nil, nil, "List All" )
16
+
17
+ numRecs = fieldValues[ "Record ID#" ].length
18
+
19
+ cwd=Dir.getwd
20
+ fileprefix = "#{cwd}/cookbookfiles/"
21
+ Dir.mkdir( fileprefix ) if !File.exists?( fileprefix )
22
+ Dir.chdir( fileprefix )
23
+
24
+ File.open( "QuickBaseAPICookbook.html", "w" ) { |outputFile |
25
+
26
+ outputFile.write( "<HTML><HEAD><TITLE>QuickBase API Cookbook v3</TITLE></HEAD><BODY><H1><a href=\"https://www.quickbase.com/db/bcdcajmrg\">QuickBase API Cookbook v3</a></H1>" )
27
+
28
+ (0..numRecs.to_i-1).each{ |i|
29
+
30
+ link = ""
31
+ title = ""
32
+ keywords = ""
33
+ problem = ""
34
+ solution = ""
35
+ discussion =""
36
+ seeAlso = ""
37
+ file = ""
38
+ ingredient1 = ""
39
+ ingredient2 = ""
40
+ ingredient3 = ""
41
+ chef = ""
42
+ recordID = ""
43
+
44
+ fieldValues.each { |fieldName,valueArray|
45
+
46
+ # get the value of fieldName in record i
47
+ value = valueArray[i]
48
+
49
+ value.gsub!("<BR/>","\n")
50
+
51
+ case fieldName
52
+ when "Record ID#"
53
+ link = "https://www.quickbase.com/db/bcdcajmrg?a=dr&rid=#{value}"
54
+ recordID = value.dup
55
+ when "Title" then title = "#{CGI.escapeHTML(value)}"
56
+ when "Keywords" then keywords = "<h3>Keywords</h3>#{CGI.escapeHTML(value)}<br>"
57
+ when "Problem" then problem = "<h3>Problem:</h3>#{CGI.escapeHTML(value)}<br>"
58
+ when "Solution" then solution = "<h3>Solution:</h3><pre>#{CGI.escapeHTML(value)}</pre><br>"
59
+ when "Discussion" then discussion = "<h3>Discussion:</h3>#{CGI.escapeHTML(value)}<br>"
60
+ when "See Also" then seeAlso = "<h3>See Also:</h3>#{CGI.escapeHTML(value)}<br>"
61
+ when "File Attachment"
62
+ if value.length > 0
63
+ fileToWrite = "#{fileprefix}#{value}"
64
+ #file = "<h3>File Attachment:</h3><a href=\"file:///#{fileprefix}#{value}\">#{fileprefix}#{value}</a><br>"
65
+ file = "<h3>File Attachment:</h3><a href=\"#{value}\">#{value}</a><br>"
66
+ qbc.downLoadFile(qbc.dbid, recordID, "12" )
67
+ fileContents = qbc.fileContents.dup
68
+ if fileContents.length > 0
69
+ fileContents.gsub!( "\r\n", "\n" )
70
+ File.open( fileToWrite, "w" ){|f|f.write(fileContents) }
71
+ end
72
+ end
73
+ when "Ingredient 1" then ingredient1 = "<h3>Ingredients:</h3>#{CGI.escapeHTML(value)}, "
74
+ when "Ingredient 2" then ingredient2 = "#{CGI.escapeHTML(value)}, "
75
+ when "Ingredient 3" then ingredient3 = "#{CGI.escapeHTML(value)}<br>"
76
+ when "Chef" then chef = "<h3>Chef:</h3>#{CGI.escapeHTML(value)}<br>"
77
+ end
78
+ }
79
+
80
+ title = "<h2><a href=\"#{link}\">#{title}</a>"
81
+
82
+ outputFile.write( title )
83
+ outputFile.write( keywords )
84
+ outputFile.write( problem )
85
+ outputFile.write( solution )
86
+ outputFile.write( discussion )
87
+ outputFile.write( seeAlso )
88
+ outputFile.write( file )
89
+ outputFile.write( ingredient1)
90
+ outputFile.write( ingredient2 )
91
+ outputFile.write( ingredient3 )
92
+ outputFile.write( chef )
93
+ outputFile.write( "<HR>" )
94
+ }
95
+ outputFile.write( "</BODY>" )
96
+
97
+ }