class Restforce::Attachment

Public Instance Methods

Body() click to toggle source

Public: Returns the body of the attachment.

Examples

attachment = client.query('select Id, Name, Body from Attachment').first
File.open(attachment.Name, 'wb') { |f| f.write(attachment.Body) }
Calls superclass method
# File lib/restforce/attachment.rb, line 11
def Body
  ensure_id && ensure_body
  @client.get(super).body
end

Private Instance Methods

ensure_body() click to toggle source
# File lib/restforce/attachment.rb, line 18
def ensure_body
  return true if self.Body?

  raise 'You need to query the Body for the record first.'
end