commit 1fd0051c116e747a88b2f7ab723911fdaa8b3f67
Author: fago <nuppla@zites.net>
Date:   Tue Oct 23 18:38:25 2012 +0200

    Fixed creating other entity types than nodes that have bundles.

diff --git a/restws.entity.inc b/restws.entity.inc
index f3e409b..ee74e72 100644
--- a/restws.entity.inc
+++ b/restws.entity.inc
@@ -164,11 +164,11 @@ class RestWSEntityResourceController implements RestWSQueryResourceControllerInt
     // Make sure that bundle information is present on entities that have
     // bundles.
     $entity_info = entity_get_info($this->entityType);
-    if (isset($entity_info['bundle keys'])) {
-      foreach ($entity_info['bundle keys'] as $bundle_key) {
-        if (!array_key_exists($bundle_key, $values)) {
-          throw new RestWSException('Missing bundle: ' . $bundle_key, 406);
-        }
+    if (!empty($entity_info['entity keys']['bundle'])) {
+      $bundle_key = $entity_info['entity keys']['bundle'];
+      $entity = $wrapper->value();
+      if (empty($entity->$bundle_key)) {
+        throw new RestWSException('Missing bundle: ' . $bundle_key, 406);
       }
     }
 
