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
@@ -0,0 +1,10 @@
1
+ require 'QuickBaseClient'
2
+
3
+ qbc = QuickBase::Client.new
4
+
5
+ # download the QuickBaseClient.rb.zip from record 24105 in the QuickBase Community Forum
6
+ # '41' is the field ID of the File Attachment field
7
+ qbc.downLoadFile("8emtadvk", "24105", "41" )
8
+
9
+ # have to write the downloaded data before it exists on your local disk
10
+ File.open( "The.Latest.QuickBaseClient.rb.zip", "wb" ){|f|f.write(qbc.fileContents)}
@@ -0,0 +1,81 @@
1
+
2
+ require 'QuickBaseClient'
3
+
4
+ def downloadFiles1(username,password,cwd)
5
+ qbc = QuickBase::Client.new(username,password)
6
+ dbid = qbc.findDBByName(cwd)
7
+ qbc.getSchema(dbid)
8
+ dbid = qbc.lookupChdbid(cwd.dup)
9
+ downloadFiles3(qbc,username,password,dbid,"File Attachment")
10
+ end
11
+
12
+ def downloadFiles2(username,password,dbid,fieldName)
13
+ qbc = QuickBase::Client.new(username,password)
14
+ qbc.getSchema(dbid)
15
+ downloadFiles3(qbc,username,password,dbid,fieldName)
16
+ end
17
+
18
+ def downloadFiles3(qbc,username,password,dbid,fieldName)
19
+
20
+ fieldNames = qbc.getFieldNames(dbid)
21
+ clist = ""
22
+ fid = ""
23
+ fieldNames.each{|f|
24
+ id = qbc.lookupFieldIDByName(f)
25
+ fid = id.dup if f == fieldName
26
+ clist << id
27
+ clist << "."
28
+ }
29
+ clist[-1,1]=""
30
+
31
+ if fid == ""
32
+ fid = fieldName.dup
33
+ fieldName = qbc.lookupFieldNameFromID(fid)
34
+ end
35
+
36
+ qbc.iterateRecords(dbid,fieldNames,nil,nil,nil,clist,"3"){|r|
37
+ if r and r[fieldName] and r[fieldName].length > 0
38
+ next if r[fieldName].include?("https:") or r[fieldName].include?("http:")
39
+ puts "Downloading #{r[fieldName]}"
40
+ qbc.downLoadFile(dbid,r["Record ID#"],fid)
41
+ if qbc.fileContents
42
+ filename = r[fieldName]
43
+ File.open( filename, "wb" ){|f|
44
+ f.write(qbc.fileContents)
45
+ }
46
+ end
47
+ end
48
+ }
49
+ puts "\nFinished downloading files in QuickBase Record ID# order."
50
+ puts "(Later copies of files overwrite previous copies)."
51
+ puts "\nYou can repeat this download using downloadFilesToFolder.exe #{username} #{password} #{dbid} #{fid}."
52
+ end
53
+
54
+ def getInputAndRun
55
+ mycwd = Dir.pwd.gsub('/','\\')
56
+
57
+ if ARGV[3]
58
+ downloadFiles2(ARGV[0],ARGV[1],ARGV[2],ARGV[3])
59
+ else
60
+
61
+ print "\nPlease enter your QuickBase username: "
62
+ username = gets.chomp
63
+ print "\nPlease enter your QuickBase password: "
64
+ password = gets.chomp
65
+ print "\nEnter 'y' if to download the files from a '#{mycwd}' QuickBase application: "
66
+ y = gets.chomp
67
+
68
+ if y == "y" or y == "Y"
69
+ downloadFiles1(username,password,mycwd)
70
+ else
71
+ print "\nPlease enter the id of your QuickBase table: "
72
+ dbid = gets.chomp
73
+ print "\nPlease enter the name or id of the QuickBase File Attachment field in your table. (e.g. File): "
74
+ fieldName = gets.chomp
75
+ downloadFiles2(username,password,dbid,fieldName)
76
+ end
77
+ end
78
+
79
+ end
80
+
81
+ getInputAndRun
@@ -0,0 +1,64 @@
1
+
2
+ require 'QuickBaseTextData'
3
+
4
+ # download the Ingredients table in the QuickBase API Cookbook v2 to a text file
5
+ QuickBase::TextData.downloadData("username","password","bb2mad4ss")
6
+
7
+ =begin
8
+
9
+ The 'downloadData' line above will write a file called 'downloadedTextData.txt' in your current directory.
10
+ The contents will be something close to the text below. You can edit the text and send it back to QuickBase
11
+ using QuickBase::TextData.uploadData("username","password","downloadedTextData.txt")
12
+
13
+ dbid:bb2mad4ss
14
+ record:1
15
+ Name:Ruby wrapper for QuickBase HTTP API
16
+ Description:This is a Ruby language wrapper for the QuickBase HTTP API. It includes routines for all everything in the API, plus additional routines to reduce the amount of code you have to write to get things done using the QuickBase API.
17
+ File Attachment:
18
+ URL:https://www.quickbase.com/db/8emtadvk?a=dr&r=ztj&rl=cjtm
19
+ Contact E-mail:
20
+ record:2
21
+ Name:QuickBase HTTP API
22
+ Description:
23
+ File Attachment:
24
+ URL:https://www.quickbase.com/up/6mztyxu8/g/rc7/en/va/QuickBaseAPI.htm
25
+ Contact E-mail:
26
+ record:3
27
+ Name:One-Click Ruby Installer for Windows
28
+ Description:This is a [one-click, self-contained Windows installer] that contains the Ruby language itself, dozens of popular extensions and packages, a syntax-highlighting editor and execution environment, and a Windows help file that contains the full text of the book, Programming Ruby: The Pragmatic Programmer's Guide.
29
+ File Attachment:
30
+ URL:http://rubyinstaller.rubyforge.org/wiki/wiki.pl
31
+ Contact E-mail:
32
+ record:4
33
+ Name:Visual Basic SDK
34
+ Description:
35
+ File Attachment:
36
+ URL:https://www.quickbase.com/db/6mztyxu8?a=dr&r=c4
37
+ Contact E-mail:
38
+ record:5
39
+ Name:Perl SDK
40
+ Description:
41
+ File Attachment:
42
+ URL:https://www.quickbase.com/db/6mztyxu8?a=dr&r=c5
43
+ Contact E-mail:
44
+ record:6
45
+ Name:Javascript SDK
46
+ Description:
47
+ File Attachment:
48
+ URL:https://www.quickbase.com/db/6mztyxu8?a=dr&r=c8
49
+ Contact E-mail:
50
+ record:7
51
+ Name:Java SDK
52
+ Description:
53
+ File Attachment:
54
+ URL:https://www.quickbase.com/db/6mztyxu8?a=dr&r=c6
55
+ Contact E-mail:
56
+ record:8
57
+ Name:Excel
58
+ Description:
59
+ File Attachment:
60
+ URL:
61
+ Contact E-mail:
62
+
63
+
64
+ =end
@@ -0,0 +1,11 @@
1
+
2
+ require 'QuickBaseClient'
3
+
4
+ qbc = QuickBase::Client.new(ARGV[0],ARGV[1])
5
+ qbc.getSchema(ARGV[2])
6
+ File.open("#{ARGV[2]}.schema.xml","w"){|f|f.write(qbc.qdbapi)}
7
+
8
+ # run this using 'ruby dumpSchema.rb <username> <password> <tableID>'
9
+ # e.g. 'ruby dumpSchema.rb fred@flinstone wilma 8emtadvk'
10
+
11
+
@@ -0,0 +1,8 @@
1
+ require 'QuickBaseClient'
2
+
3
+ qbc = QuickBase::Client.new( "my_username", "my_password", "my_application" )
4
+
5
+ # make 6 copies of record 1
6
+ qbc.copyRecord( "1", 6 )
7
+
8
+ qbc.signOut
@@ -0,0 +1,33 @@
1
+
2
+
3
+ require 'QuickBaseClient'
4
+
5
+ qbc = QuickBase::Client.new
6
+
7
+ puts "\n\nDescription of QuickBase API Cookbook application:\n\n"
8
+
9
+ puts qbc.bcdcajmrf.xml_desc
10
+
11
+ puts "\n\nIngredients from the QuickBase API Cookbook:\n\n"
12
+
13
+ qbc.bcdcajmrh.qid_1.printChildElements(qbc.records)
14
+
15
+ puts "\n\nValue of field 6 from record 24105 in table 8emtadvk:\n\n"
16
+
17
+ puts qbc.dbid_8emtadvk.rid_24105.fid_6 # prints 'Ruby wrapper for QuickBase HTTP API'
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
@@ -0,0 +1,15 @@
1
+
2
+ require 'QuickBaseClient'
3
+ require 'Date'
4
+
5
+ # login and connect to the "Email Outbox" application
6
+ qbc = QuickBase::Client.new("username","password","Email Outbox")
7
+
8
+ # find the "Messages" table in the "Email Outbox" application
9
+ outboxMessagesTable = qbc.lookupChdbid("Messages")
10
+
11
+ today = Date.today
12
+ today = today.strftime("%m-%d-%Y")
13
+
14
+ # for every record that was created today, change the "from" field to "fred@bedrock.com" and the "to" field to "wilma@bedrock.com"
15
+ qbc.editRecords(outboxMessagesTable,{"from"=>"fred@bedrock.com","to"=>"wilma@bedrock.com"},"{'1'.EX.'#{today}'}")
@@ -0,0 +1,17 @@
1
+
2
+ require 'QuickBaseClient'
3
+
4
+ # change "username" "password" to your QuickBase username and password
5
+ qbc = QuickBase::Client.new("username","password")
6
+
7
+ communityForumRecords = qbc.getAllValuesForFields("8emtadvk",["Subject","Message"],"{'4'.CT.', John'}",nil,nil,"6.10",nil,"structured","num-10")
8
+
9
+ puts "\n --- Ten most recent QuickBase Community Forum Records owned by ', John' ---\n\n"
10
+
11
+ numRecords = communityForumRecords["Subject"].length
12
+ (0..(numRecords-1)).each{|index|
13
+ print "\n#{index+1})\nSubject: "
14
+ print communityForumRecords["Subject"][index]
15
+ puts "\nMessage:"
16
+ puts communityForumRecords["Message"][index].gsub!("<BR/>","\n")
17
+ }
@@ -0,0 +1,17 @@
1
+
2
+ require 'QuickBaseClient'
3
+
4
+ # change "username" "password" to your QuickBase username and password
5
+ qbc = QuickBase::Client.new("username","password")
6
+
7
+ communityForumRecords = qbc.getAllValuesForFields("8emtadvk",["Subject","Message"],"{'0'.CT.'ruby'}",nil,nil,"6.10")
8
+
9
+ puts "\n --- QuickBase Community Forum Records containing the word 'ruby' ---\n\n"
10
+
11
+ numRecords = communityForumRecords["Subject"].length
12
+ (0..(numRecords-1)).each{|index|
13
+ print "\nSubject: "
14
+ print communityForumRecords["Subject"][index]
15
+ puts "\nMessage:"
16
+ puts communityForumRecords["Message"][index].gsub!("<BR/>","\n")
17
+ }
@@ -0,0 +1,24 @@
1
+
2
+ require 'QuickBaseClient'
3
+
4
+ # change "username" "password" to your QuickBase username and password
5
+ qbc = QuickBase::Client.new("username","password")
6
+
7
+ # read and format the "currency" field from all the records in a table
8
+ qbc.iterateRecords("dbiddbid",["currency"]){|rec|
9
+ formattedValue = qbc.formatCurrency(rec['currency'],{"currencySymbol" => "$"})
10
+ puts "Raw currency value from QuickBase: #{rec['currency']}, Formatted value: #{formattedValue}"
11
+ }
12
+
13
+ =begin
14
+
15
+ Sample output from this script:
16
+
17
+ Raw currency value from QuickBase: 7.33, Formatted value: $7.33
18
+ Raw currency value from QuickBase: 0.33, Formatted value: $0.33
19
+ Raw currency value from QuickBase: 1.01, Formatted value: $1.01
20
+ Raw currency value from QuickBase: 1888888.00, Formatted value: $1888888.00
21
+ Raw currency value from QuickBase: 1111.1111, Formatted value: $1111.1111
22
+ Raw currency value from QuickBase: 23.23, Formatted value: $23.23
23
+
24
+ =end
@@ -0,0 +1,10 @@
1
+
2
+ require 'QuickBaseClient'
3
+
4
+ # change "username" "password" to your QuickBase username and password
5
+ qbc = QuickBase::Client.new("username","password")
6
+ createdFieldValue = qbc.getAllValuesForFields("8emtadvk",["Created"],"{'3'.EX.'24105'}")
7
+ createdFieldValue = createdFieldValue["Created"][0]
8
+ formattedCreatedFieldValue = qbc.formatDate(createdFieldValue)
9
+ puts "Message 24105 in the QuickBase Community Forum was created on #{formattedCreatedFieldValue} (#{createdFieldValue})."
10
+
@@ -0,0 +1,27 @@
1
+
2
+ require 'QuickBaseClient'
3
+
4
+ # change "username" "password" to your QuickBase username and password
5
+ qbc = QuickBase::Client.new("username","password")
6
+
7
+ # read and format the "duration" field from all the records in a table
8
+ qbc.iterateRecords("dbiddbid",["duration"]){|rec|
9
+ rawValue = rec['duration']
10
+ days = qbc.formatDuration(rawValue.dup,"days")
11
+ hours = qbc.formatDuration(rawValue.dup,"hours")
12
+ minutes = qbc.formatDuration(rawValue.dup,"minutes")
13
+ printf("Raw value: %-15s Days: %-10s Hours: %-10s Minutes: %-10s\n", rec['duration'], days, hours, minutes)
14
+ }
15
+
16
+ =begin
17
+
18
+ Sample output from this script:
19
+
20
+ Raw value: 172800000 Days: 2 Hours: 48 Minutes: 2880
21
+ Raw value: 285120000 Days: 3 Hours: 79 Minutes: 4752
22
+ Raw value: 2160000000 Days: 25 Hours: 600 Minutes: 36000
23
+ Raw value: 10658304000 Days: 123 Hours: 2960 Minutes: 177638
24
+ Raw value: 37152000 Days: 0 Hours: 10 Minutes: 619
25
+ Raw value: 86400000 Days: 1 Hours: 24 Minutes: 1440
26
+
27
+ =end
@@ -0,0 +1,24 @@
1
+
2
+ require 'QuickBaseClient'
3
+
4
+ # change "username" "password" to your QuickBase username and password
5
+ qbc = QuickBase::Client.new("username","password")
6
+
7
+ # read and format the "percent" field from all the records in a table
8
+ qbc.iterateRecords("dbiddbid",["percent"]){|rec|
9
+ formattedValue = qbc.formatPercent(rec['percent'])
10
+ puts "Raw percent value from QuickBase: #{rec['percent']}, Formatted value: #{formattedValue}"
11
+ }
12
+
13
+ =begin
14
+
15
+ Sample output from this script:
16
+
17
+ Raw percent value from QuickBase: 0.005, Formatted value: 0.5
18
+ Raw percent value from QuickBase: 0.12, Formatted value: 12
19
+ Raw percent value from QuickBase: 0.9999, Formatted value: 99.99
20
+ Raw percent value from QuickBase: 0.5, Formatted value: 50
21
+ Raw percent value from QuickBase: 0.13, Formatted value: 13
22
+ Raw percent value from QuickBase: 0.33123, Formatted value: 33.12
23
+
24
+ =end
@@ -0,0 +1,18 @@
1
+
2
+ require 'QuickBaseClient'
3
+
4
+ # change "username" "password" to your QuickBase username and password
5
+ qbc = QuickBase::Client.new("username","password")
6
+
7
+ cookbookRecords = qbc.getAllValuesForFields("bb2mad4sr",["Title","Keywords"])
8
+
9
+ puts "\n --- QuickBase API Cookbook v2 ---\n\n"
10
+
11
+ numRecords = cookbookRecords["Title"].length
12
+ (0..(numRecords-1)).each{|index|
13
+ print "Title: "
14
+ print cookbookRecords["Title"][index]
15
+ print " (Keywords: "
16
+ print cookbookRecords["Keywords"][index]
17
+ puts ")"
18
+ }
@@ -0,0 +1,29 @@
1
+
2
+
3
+ require 'QuickBaseClient'
4
+
5
+ qbc = QuickBase::Client.new
6
+
7
+ puts "\n\nDate/time information about the QuickBase Community Forum:\n\n"
8
+
9
+ qbc.getAppDTMInfo("bbqm84dzy")
10
+
11
+ puts "Time of request : #{qbc.formatFieldValue(qbc.requestTime.text,'timestamp')}"
12
+ puts "Time next request allowed : #{qbc.formatFieldValue(qbc.requestNextAllowedTime.text,'timestamp')}"
13
+ puts "Time application last modified : #{qbc.formatFieldValue(qbc.lastModifiedTime,'timestamp')}"
14
+ puts "Time any record last modified : #{qbc.formatFieldValue(qbc.lastRecModTime,'timestamp')}"
15
+
16
+
17
+ =begin
18
+
19
+ Output of the above script:
20
+
21
+ Date/time information about the QuickBase Community Forum:
22
+
23
+ Time of request : 05-03-2009 03:52 PM
24
+ Time next request allowed : 05-03-2009 03:52 PM
25
+ Time application last modified : 03-26-2009 01:55 PM
26
+ Time any record last modified : 05-02-2009 10:10 AM
27
+
28
+ =end
29
+
@@ -0,0 +1,5 @@
1
+ require 'QuickBaseClient'
2
+ qbc = QuickBase::Client.new("username","password","My Application Name")
3
+ puts qbc.getApplicationVariable("var")
4
+ p qbc.getApplicationVariable
5
+
@@ -0,0 +1,11 @@
1
+
2
+ require 'QuickBaseClient'
3
+
4
+ # change "username" "password" to your QuickBase username and password
5
+ qbc = QuickBase::Client.new("username","password")
6
+ qbc.printRequestsAndResponses=true
7
+ applicationDBID = qbc.findDBByname("QuickBase API Cookbook v2")
8
+ qbc.getSchema(applicationDBID)
9
+ childDBID = qbc.lookupChdbid("Ingredients")
10
+ puts "The dbid of the 'Ingredients' table in the QuickBase API Cookbook v2 application is #{childDBID}"
11
+
@@ -0,0 +1,6 @@
1
+ require 'QuickBaseClient'
2
+
3
+ qbc = QuickBase::Client.new
4
+ qbc.getSchema("8emtadvk")
5
+ puts "Columns for QuickBase Community Forum 'List all' report: #{qbc.getColumnListForQuery(nil,'List All')}"
6
+ puts "Columns for QuickBase Community Forum 'List all' report: #{qbc.getColumnListForQuery("1",nil)}"
@@ -0,0 +1,13 @@
1
+
2
+ require 'QuickBaseClient'
3
+
4
+ qbc = QuickBase::Client.new("username","password")
5
+
6
+ # get the available choices for the 'Ingredient 1' field in the
7
+ # 'Recipes' table of the 'QuickBase API Cookbook v2' application
8
+ choices = qbc.getFieldChoices( "bb2mad4sr", "Ingredient 1" )
9
+
10
+ if choices
11
+ puts "\n------ Ingredients choices from the QuickBase API Cookbook v2 ------\n\n"
12
+ puts choices.join("\n")
13
+ end