Method: Frodo::Concerns::API#select

Defined in:
lib/frodo/concerns/api.rb

#select(entity_set, id, fields) ⇒ Object

Public: Finds a single record and returns select fields.

entity_set - The set the entity belongs to id - The id of the record. If field is specified, id should be the id

of the external field.

fields - A String array denoting the fields to select. If nil or empty array

is passed, all fields are selected.


221
222
223
224
225
226
227
228
229
# File 'lib/frodo/concerns/api.rb', line 221

def select(entity_set, id, fields)
  query = service[entity_set].query

  fields.each{|field| query.select(field)}
  url_chunk = query.find(id)

  body = api_get(url_chunk).body
  build_entity(entity_set, body)
end