Method: Restforce::Concerns::API#select
- Defined in:
- lib/restforce/concerns/api.rb
#select(sobject, id, select, field = nil) ⇒ Object
Public: Finds a single record and returns select fields.
sobject - The String name of the sobject. id - The id of the record. If field is specified, id should be the id
of the external field.
select - A String array denoting the fields to select. If nil or empty array
is passed, all fields are selected.
field - External ID field to use (default: nil).
451 452 453 454 455 456 457 458 459 460 461 |
# File 'lib/restforce/concerns/api.rb', line 451 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 |