Method: FrOData::Query#find

Defined in:
lib/frodata/query.rb

#find(key) ⇒ FrOData::Entity?

Find the Entity with the supplied key value.

Parameters:

  • key (to_s)

    primary key to lookup

Returns:



34
35
36
37
38
39
40
41
42
# File 'lib/frodata/query.rb', line 34

def find(key)
  entity = @entity_set.new_entity
  key_property = entity.get_property(entity.primary_key)
  key_property.value = key

  pathname = "#{entity_set.name}(#{key_property.url_value})"
  query = [pathname, assemble_criteria].compact.join('?')
  execute(query).first
end