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,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
+ qbc.doQuery("6ewwzuuj")
8
+
9
+ puts "\n --- QuickBase Formula Functions Reference ---\n\n"
10
+
11
+ recordNumber = 1
12
+ qbc.eachRecord(qbc.records){|record|
13
+ puts "\n --- Record #{recordNumber} ---"
14
+ recordNumber += 1
15
+ qbc.eachField(record){|field|
16
+ print qbc.lookupFieldNameFromID(field.attributes["id"])
17
+ print ": "
18
+ if field.has_text?
19
+ text = field.text.dup
20
+ text.gsub!("<BR/>","\n") if text.include?("<BR/>")
21
+ puts text
22
+ end
23
+ }
24
+ }
@@ -0,0 +1,9 @@
1
+
2
+ require 'QuickBaseClient'
3
+
4
+ qbc = QuickBase::Client.new("username","password")
5
+
6
+ # run pre-defined Import #3 into table bcdcajmrf
7
+
8
+ qbc.runImport("bcdcajmrf","3")
9
+
@@ -0,0 +1,41 @@
1
+ require 'QuickBaseTwitterConnector'
2
+
3
+ QuickBase::TwitterConnector.new
4
+
5
+ =begin
6
+
7
+ This is a example of what you will see.
8
+ The Twitter Connector will run in a loop, checking for new information every few minutes.
9
+ Probably the most useful feature of this Connector is the ability to send two types of
10
+ automated response, static text and the results from simple REST queries.
11
+ Remember that Twitter only accepts the first 140 characters of text.
12
+
13
+ The Connector automatically creates a QuickBase application using your QuickBase
14
+ username and your Twitter username.
15
+
16
+ ----------------------------------------------------------------------------------
17
+
18
+ Please enter the Quickbase username to use for this session: fred_flintstone@internet.com
19
+ Please enter the Quickbase password to use for this session: wilma
20
+ Please enter the Twitter username to use for this session: fred_flintstone
21
+ Please enter the Twitter password to use for this session: wilma
22
+
23
+
24
+ Please enter a number to select the connection type:
25
+
26
+ 1 - Send Twitter messages to QuickBase.
27
+ 2 - Send QuickBase messages to Twitter.
28
+ 3 - Exchange messages between QuickBase and Twitter.
29
+ 4 - Send automated replies from QuickBase to Twitter.
30
+ 5 - All the above.
31
+
32
+ 5
33
+
34
+
35
+ Getting 'friends' Twitter Status since Fri, 28 Mar 2008 13:47:24 -0700.
36
+ Getting Direct Messages from Twitter since Fri, 28 Mar 2008 13:47:24 -0700.
37
+ Sending messages from QuickBase to Twitter added since Fri, 28 Mar 2008 13:47:24 -0700.
38
+ Getting Direct Messages from Twitter since Fri, 28 Mar 2008 13:47:24 -0700.
39
+ Automated Direct Message sent to wilma_flintstone: what's for dinner?: rex ribs
40
+
41
+ =end
@@ -0,0 +1,33 @@
1
+ require 'QuickBaseClient'
2
+
3
+ if ARGV[0] and File.exist?(ARGV[0]) and ARGV[0].rindex("\\")
4
+ username = ARGV[1] || ENV["quickbase_username"]
5
+ password = ARGV[2] || ENV["quickbase_password"]
6
+ if username.nil?
7
+ print "Please enter your QuickBase user name: "
8
+ username = gets.chop
9
+ end
10
+ if password.nil?
11
+ print "Please enter your QuickBase password: "
12
+ password = gets.chop
13
+ end
14
+ qbc = QuickBase::Client.new(username, password)
15
+ folder = ARGV[0][0,ARGV[0].rindex("\\")]
16
+ file = ARGV[0][ARGV[0].rindex("\\")+1,ARGV[0].length]
17
+ dbid = qbc.findDBByName(folder)
18
+ if dbid.nil?
19
+ dbid = qbc.createDatabase(folder,"Files uploaded from #{folder}")
20
+ qbc.addField(dbid, "Description","text")
21
+ qbc.addField(dbid, "File Attachment","file")
22
+ else
23
+ qbc.getSchema(dbid)
24
+ dbid = qbc.lookupChdbid(folder.dup)
25
+ end
26
+ Dir.chdir(folder)
27
+ qbc.uploadFile(dbid,file.dup,"File Attachment")
28
+ else
29
+ puts "\n\nusage: ruby sendToQuickBase.rb <filepath> [username] [password]"
30
+ puts "\ne.g. ruby sendToQuickBase.rb c:\temp\mySpecialFile"
31
+ puts "\nYou can omit your username and password if they are in environment"
32
+ puts "variables 'quickbase_username' and 'quickbase_password'.\n\n"
33
+ end
@@ -0,0 +1,6 @@
1
+
2
+ require 'QuickBaseClient'
3
+
4
+ qbc = QuickBase::Client.new("username","password","My Appointments")
5
+
6
+ qbc._setDBvar("HourlyRate","350.00")
@@ -0,0 +1,8 @@
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
+ puts "Show the XML request and response while getting info about the QuickBase Community Forum database."
8
+ qbc.getDBInfo("8emtadvk")
@@ -0,0 +1,11 @@
1
+
2
+ require 'QuickBaseClient'
3
+ qbc = QuickBase::Client.new("username","password","QuickBase Community Forum")
4
+ recs = qbc.doSQLQuery("SELECT Subject,Message FROM Messages WHERE Subject = 'Ruby wrapper for QuickBase HTTP API'",:Array)
5
+ recs.each{ |rec|
6
+ subject = rec['Subject']
7
+ message = rec['Message']
8
+ message.gsub!("<BR/>","\n")
9
+ puts "Subject: --------------- #{subject} ---------------\nMessage: #{message}\n\n"
10
+ }
11
+
@@ -0,0 +1,10 @@
1
+ require 'QuickBaseClient.rb'
2
+
3
+ begin
4
+ qbc = QuickBase::Client.new("username","password")
5
+ qbc.stopOnError=true
6
+ qbc.doQuery( "bad_database_id" ) # make a bad request
7
+ qbc.doQuery( "bb2mad4sr" ) # QuickBase API Cookbook v2
8
+ rescue StandardError => exception
9
+ puts "\n\n ***** Something went wrong during a request to QuickBase: ****\n#{exception}"
10
+ end
@@ -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
+ sum = qbc.sum("bcct3jb3b",["number"])
11
+ puts "sum: #{sum['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
+ sum: 279.0
25
+
26
+ =end
@@ -0,0 +1,42 @@
1
+
2
+ require 'rubygems'
3
+ gem 'twitter4r', '>=0.3.0'
4
+ require 'twitter'
5
+
6
+ require 'QuickBaseClient'
7
+
8
+ print "Please enter your QuickBase username: "
9
+ quickbase_username = gets.chop
10
+ print "Please enter your QuickBase password: "
11
+ quickbase_password = gets.chop
12
+ qbc = QuickBase::Client.new(quickbase_username,quickbase_password)
13
+
14
+ dbid = qbc.findDBByName("Twitter messages (#{quickbase_username})" )
15
+ if dbid.nil?
16
+ dbid = qbc.createDatabase("Twitter messages (#{quickbase_username})", "This is a list of messages from Twitter.")
17
+ qbc.addField(dbid,"Twitter_Screen_Name", "text")
18
+ qbc.addField(dbid,"Twitter_Message", "text")
19
+ else
20
+
21
+ messagesToMoveToTwitter = []
22
+ qbc.iterateRecords(dbid,["Record ID#","Twitter_Screen_Name","Twitter_Message"]){|record|
23
+ if record["Twitter_Screen_Name"].nil? or record["Twitter_Screen_Name"] == "" and record["Twitter_Message"] and record["Twitter_Message"] != ""
24
+ messagesToMoveToTwitter << record["Twitter_Message"]
25
+ qbc.deleteRecord(dbid,record["Record ID#"])
26
+ end
27
+ }
28
+
29
+ if messagesToMoveToTwitter.length > 0
30
+ print "Please enter your Twitter username: "
31
+ twitter_username = gets.chop
32
+ print "Please enter your Twitter password: "
33
+ twitter_password = gets.chop
34
+ twitter_client = Twitter::Client.new(:login => twitter_username, :password => twitter_password )
35
+
36
+ messagesToMoveToTwitter.each {|message|
37
+ Twitter::Status.create(:text => message,:client => twitter_client)
38
+ }
39
+
40
+ end
41
+
42
+ end
@@ -0,0 +1,36 @@
1
+
2
+ require 'rubygems'
3
+ gem 'twitter4r', '>=0.3.0'
4
+ require 'twitter'
5
+
6
+ # ----------------------------------------------------------------------
7
+ require 'QuickBaseClient'
8
+
9
+ print "Please enter your QuickBase username: "
10
+ quickbase_username = gets.chop
11
+
12
+ print "Please enter your QuickBase password: "
13
+ quickbase_password = gets.chop
14
+
15
+ qbc = QuickBase::Client.new(quickbase_username,quickbase_password)
16
+ dbid = qbc.findDBByName("Twitter messages (#{quickbase_username})" )
17
+ if dbid.nil?
18
+ dbid = qbc.createDatabase("Twitter messages (#{quickbase_username})", "This is a list of messages from Twitter.")
19
+ qbc.addField(dbid,"Twitter_Screen_Name", "text")
20
+ qbc.addField(dbid,"Twitter_Message", "text")
21
+ end
22
+
23
+ # ----------------------------------------------------------------------
24
+ print "Please enter your Twitter username: "
25
+ twitter_username = gets.chop
26
+
27
+ print "Please enter your Twitter password: "
28
+ twitter_password = gets.chop
29
+
30
+ twitter_client = Twitter::Client.new(:login => twitter_username, :password => twitter_password )
31
+ timeline = twitter_client.timeline_for(:public) do |status|
32
+ qbc.clearFieldValuePairList
33
+ qbc.addFieldValuePair("Twitter_Screen_Name",nil,nil,status.user.screen_name)
34
+ qbc.addFieldValuePair("Twitter_Message",nil,nil,status.text)
35
+ qbc.addRecord(dbid,qbc.fvlist)
36
+ end
@@ -0,0 +1,20 @@
1
+ require 'QuickBaseClient'
2
+
3
+ #sign into your application using your user name and password
4
+ qbc = QuickBase::Client.new( "my_username", "my_password", "my_application" )
5
+
6
+ # If your application is a multi-table application, switch to the correct target table using lookupChdbid
7
+ qbc.lookupChdbid( "Imported data" )
8
+
9
+ # delete all the records in the "Imported data" table then
10
+ # import new data from a CSV file. The field names must be at the top of the file.
11
+
12
+ # Uncomment the following line to make your QuickBase table
13
+ # have the same contents as your CSV file.
14
+ #qbc._purgeRecords
15
+
16
+ # (change 'ImportedData.csv' to a real file name)
17
+ qbc.importCSVFile( "ImportedData.csv" )
18
+
19
+ #sign out of QuickBase
20
+ qbc.signOut
@@ -0,0 +1,22 @@
1
+
2
+ require 'QuickBaseClient'
3
+
4
+ #sign into a QuickBase application using your user name and password
5
+ qbc = QuickBase::Client.new( "my_username", "my_password", "my_application" )
6
+
7
+ # if your application is a multi-table application, switch
8
+ # to the right table
9
+ qbc.lookupChdbid( "Imported Excel data" )
10
+
11
+ # delete all the records in the "Imported Excel data" table then
12
+ # import new data from an Excel file. The field names must be at the top of the file.
13
+ # 'h' is the letter of the last column to import.
14
+ # Note: any commas (',') in the data are converted to semi-colons (';').
15
+ # Uncomment the following line if you want to make your QuickBase table match the contents of your Excel file.
16
+
17
+ #qbc._purgeRecords
18
+
19
+ qbc._importFromExcel( "ImportedExcelData.xls", 'h' )
20
+
21
+ #sign out of QuickBase
22
+ qbc.signOut
@@ -0,0 +1,18 @@
1
+ require 'QuickBaseClient'
2
+
3
+ loop {
4
+ qbc = QuickBase::Client.new( "my_username", "my_password", "my_application" )
5
+ qbc.lookupChdbid( "Documents" ) # the table containing the files
6
+
7
+ # "12" is the number of the record (Record ID#) to be modified
8
+ # "Document" is the name of the field containing a file attachment
9
+ # "Version" and "Date" are additional field values to modify in the record
10
+
11
+ qbc.updateFile( qbc.dbid, "12", "my_file.doc", "Document", { "Version" => "6", "Note" => "Updated 01/30/2006" } )
12
+
13
+ qbc.signOut
14
+ qbc = nil
15
+
16
+ # wait one hour
17
+ sleep(60*60)
18
+ }
@@ -0,0 +1,8 @@
1
+
2
+ require 'QuickBaseClient'
3
+
4
+ qbc = QuickBase::Client.new( "username", "password" )
5
+
6
+ # upload the local file "cookbookfiles.zip" into the 'File Attachment' field in a new record
7
+ # in the 'Etc.' table in the QuickBase API Cookbook v2
8
+ qbc.uploadFile( "bb2mad4su", "cookbookfiles.zip", "File Attachment" )
@@ -0,0 +1,69 @@
1
+
2
+ require 'QuickBaseClient'
3
+
4
+ def uploadFiles1(username,password,cwd)
5
+ qbc = QuickBase::Client.new(username,password)
6
+ dbid = qbc.findDBByName(cwd)
7
+ if dbid.nil?
8
+ puts "Creating a QuickBase application called '#{cwd}'."
9
+ dbid = qbc.createDatabase(cwd,"Files uploaded from #{username}\'s #{cwd} folder.")
10
+ qbc.addField(dbid, "Description","text")
11
+ qbc.addField(dbid, "File Attachment","file")
12
+ else
13
+ puts "\nUsing the existing QuickBase application called '#{cwd}'.\n"
14
+ qbc.getSchema(dbid)
15
+ dbid = qbc.lookupChdbid(cwd.dup)
16
+ end
17
+ uploadFiles3(qbc,dbid,"File Attachment",cwd)
18
+ puts "\nYou can repeat this upload using uploadFilesFromFolder.exe #{username} #{password} #{dbid} file_attachment"
19
+ end
20
+
21
+ def uploadFiles2(username,password,dbid,fieldName,cwd)
22
+ qbc = QuickBase::Client.new(username,password)
23
+ uploadFiles3(qbc,dbid,fieldName,cwd)
24
+ puts "\nYou can repeat this upload using uploadFilesFromFolder.exe #{username} #{password} #{dbid} #{fieldName.gsub( /\W/, '_' )}."
25
+ end
26
+
27
+ def uploadFiles3(qbc,dbid,fieldName,cwd)
28
+ Dir.foreach(cwd){|file|
29
+ next if file == "." or file == ".."
30
+ renamedFile = file.dup
31
+ renamedFile.gsub!("&","And")
32
+ renamedFile.gsub!("'"," ")
33
+ if renamedFile != file
34
+ File.rename(file,renamedFile)
35
+ end
36
+ puts "Uploading #{renamedFile}"
37
+ qbc.uploadFile(dbid,renamedFile,fieldName)
38
+ }
39
+ puts "\nFinished uploading files."
40
+ end
41
+
42
+ def getInputAndRun
43
+ mycwd = Dir.pwd.gsub('/','\\')
44
+
45
+ if ARGV[3]
46
+ uploadFiles2(ARGV[0],ARGV[1],ARGV[2],ARGV[3],mycwd)
47
+ else
48
+
49
+ print "\nPlease enter your QuickBase username: "
50
+ username = gets.chomp
51
+ print "\nPlease enter your QuickBase password: "
52
+ password = gets.chomp
53
+ print "\nEnter 'y' if to use or create a '#{mycwd}' QuickBase application for the files: "
54
+ y = gets.chomp
55
+
56
+ if y == "y" or y == "Y"
57
+ uploadFiles1(username,password,mycwd)
58
+ else
59
+ print "\nPlease enter the id of your target QuickBase table: "
60
+ dbid = gets.chomp
61
+ print "\nPlease enter the name of the QuickBase File Attachment field in your table. (e.g. File): "
62
+ fieldName = gets.chomp
63
+ uploadFiles2(username,password,dbid,fieldName,mycwd)
64
+ end
65
+ end
66
+
67
+ end
68
+
69
+ getInputAndRun
@@ -0,0 +1,12 @@
1
+
2
+ require 'QuickBaseClient'
3
+
4
+ #There are two ways to set the URL for your company
5
+
6
+ # 1)
7
+ qbc1 = QuickBase::Client.new( "fred_flinstone@internet.com", "wilma", nil, true, false, false, false, "mycompany" )
8
+
9
+ # 2)
10
+ qbc2 = QuickBase::Client.new( "fred_flinstone@internet.com", "wilma")
11
+ qbc2.setqbhost( true, "mycompany" )
12
+
@@ -0,0 +1,49 @@
1
+
2
+
3
+ require 'QuickBaseClient'
4
+
5
+ qbc = QuickBase::Client.new("username","password","My Application")
6
+
7
+ qbc._userRoles() { |user|
8
+ qbc.printChildElements( user )
9
+ }
10
+
11
+ =begin
12
+
13
+ Approximate output of above script:
14
+
15
+ user (id=3453444.csw ):
16
+ name = Fred Flintstone
17
+ lastAccess = 1241207132457
18
+ firstName = Fred
19
+ lastName = Flintstone
20
+ roles :
21
+ role (id=18 ):
22
+ name = Participant with Modify Own
23
+ access (id=3 ) = Basic Access
24
+ user (id=345434444.bpw5 ):
25
+ name = Wilma Flintstone
26
+ lastAccess = 1240232570603
27
+ firstName = Wilma
28
+ lastName = Flintstone
29
+ roles :
30
+ role (id=18 ):
31
+ name = Participant with Modify Own
32
+ access (id=3 ) = Basic Access
33
+ user (id=24343444.bh ):
34
+ name = Top Sales
35
+ lastAccess = 1236700941307
36
+ firstName = Top
37
+ lastName = Sales
38
+ roles :
39
+ role (id=18 ):
40
+ name = Participant with Modify Own
41
+ access (id=3 ) = Basic Access
42
+ user (id=111.ckbs ):
43
+ name = Anonymous
44
+ roles :
45
+ role (id=11 ):
46
+ name = Participant
47
+ access (id=3 ) = Basic Access
48
+ =end
49
+