class Xeroizer::Record::Attachment

Public Instance Methods

get(filename = nil) click to toggle source

Retrieve the attachment data. @param [String] filename optional filename to store the attachment in instead of returning the data.

# File lib/xeroizer/models/attachment.rb, line 82
def get(filename = nil)
  data = parent.application.http_get(parent.application.client, url)
  if filename
    File.open(filename, "wb") { | fp | fp.write data }
    nil
  else
    data
  end
end