Sha256: 6a2b12f452824508cf224a8509eefacdb8e103c77d8245ab201da1e6fb758a41

Contents?: true

Size: 506 Bytes

Versions: 9

Compression:

Stored size: 506 Bytes

Contents

module Restforce
  class Document < Restforce::SObject
    # Public: Returns the body of the document.
    #
    # Examples
    #
    #   document = client.query('select Id, Name, Body from Document').first
    #   File.open(document.Name, 'wb') { |f| f.write(document.Body) }
    def Body
      ensure_id && ensure_body
      @client.get(super).body
    end

    private

    def ensure_body
      return true if self.Body?
      raise 'You need to query the Body for the record first.'
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
restforce-2.5.4 lib/restforce/document.rb
restforce-2.5.3 lib/restforce/document.rb
restforce-2.5.2 lib/restforce/document.rb
restforce-2.5.1 lib/restforce/document.rb
logstash-input-salesforce-3.0.0 vendor/jruby/1.9/gems/restforce-2.4.2/lib/restforce/document.rb
restforce-2.5.0 lib/restforce/document.rb
restforce-2.4.2 lib/restforce/document.rb
restforce-2.4.1 lib/restforce/document.rb
restforce-2.4.0 lib/restforce/document.rb