Unable to download file attachments using the downLoadFile method in the QuickBaseClient.rb gem

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered

Hi! I'm using the very useful QuickBaseClient gem (https://www.quickbase.com/up/bcdcajmrj/g/rf/ei/va/QuickBaseClient.rb) to automate some tasks and so far it's great, except I'm running into trouble with one of the methods. 

I'm trying to use this recipe (https://www.quickbase.com/db/bcdcajmrg?a=dr&r=3&rl=sy) to download a file attachment from an app I manage. My version of the code looks like this:

contracts_dbid = "xxxxxxxxx"

qbc = QuickBase::Client.new(  "qbadmin@xxx.org", "XxXxXxX", nil, true, false, false, false, "xxx")

qbc.downLoadFile(contracts_dbid, "1352", "8")

File.open( "Test.pdf", "wb" ){|f|f.write(qbc.fileContents)}


This actually download the file attachment to my hard drive as expected, but when I take a look at the file on my drive, its size is 0 bytes. I'm not sure what, if anything, I'm doing wrong. Any help would be appreciated!

Photo of Shaun Grey

Shaun Grey

  • 0 Points

Posted 3 years ago

  • 0
  • 1
Photo of Blake Harrison - DataBlender

Blake Harrison - DataBlender, Champion

  • 100 Points 100 badge 2x thumb
Shaun - That's a very old Ruby gem and I'm not sure it's being maintained any longer. I would suggest searching on GitHub for more current gems.
Photo of Shaun Grey

Shaun Grey

  • 0 Points
After poring through the source code, I think I figured out the solution to this, or at the very least, a workaround. Simply add "require 'httpclient'" to the top of your code and it works like a charm.



Hopefully this helps someone else!