module Restforce::Concerns::API

def select(sobject, id, select, field = nil)


field - External ID field to use (default: nil).
is passed, all fields are selected.
select - A String array denoting the fields to select. If nil or empty array
of the external field.
id - The id of the record. If field is specified, id should be the id
sobject - The String name of the sobject.

Public: Finds a single record and returns select fields.
def select(sobject, id, select, field = nil)
  path = if field
           "sobjects/#{sobject}/#{field}/#{ERB::Util.url_encode(id)}"
         else
           "sobjects/#{sobject}/#{ERB::Util.url_encode(id)}"
         end
  path = "#{path}?fields=#{select.join(',')}" if select&.any?
  api_get(path).body
end