class OracleHcm::Attachment

An Attachment is a child resource of a Document Record (or Document of Record), and stores upload file data and metadata.

Public Instance Methods

download() click to toggle source

Download the file via a readable IO object.

# File lib/oracle_hcm/attachment.rb, line 13
def download
  io = StringIO.new
  res = client.connection.get do |req|
    req.url uri(rel: "enclosure")
    req.options.on_data = Proc.new do |chunk, total_bytes|
      io << chunk
    end
  end
  if res.success?
    io.rewind
    io
  else
    nil
  end
end