Class: OracleHcm::Attachment
- Defined in:
- lib/oracle_hcm/attachment.rb
Overview
An Attachment is a child resource of a Document Record (or Document of Record), and stores upload file data and metadata.
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
-
#download ⇒ Object
Download the file via a readable IO object.
Methods inherited from Resource
cached_property, #canonical_id, child_resource, #initialize, #link, property, #resource_name, resource_name, #resource_url, #uri
Constructor Details
This class inherits a constructor from OracleHcm::Resource
Instance Method Details
#download ⇒ Object
Download the file via a readable IO object.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# 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..on_data = Proc.new do |chunk, total_bytes| io << chunk end end if res.success? io.rewind io else nil end end |