/**
  * 
  * @param string $json
  * @return \webignition\Model\Stripe\Object\Object
  * @throws \InvalidArgumentException
  * @throws \OutOfRangeException
  */
 public static function create($json)
 {
     $entity = json_decode($json);
     if (is_null($entity)) {
         throw new \InvalidArgumentException("Invalid JSON", 1);
     }
     if (self::isObjectEntity($entity)) {
         $type = $entity->object;
     } elseif (self::isPeriodEntity($entity)) {
         $type = 'period';
     }
     if ($type == 'event') {
         return EventFactory::create($json);
     }
     $modelClass = self::getModelClassFromObjectName($type);
     if (is_null($modelClass)) {
         throw new \OutOfRangeException('No model class found for object "' . $type . '"', 1);
     }
     if ($type == 'line_item') {
         $modelClass = $modelClass[$entity->type];
     }
     return new $modelClass($json);
 }
 public function testCustomerUpdated()
 {
     $event = Factory::create($this->getFixture('customer.updated.json'));
     $this->assertInstanceOf('webignition\\Model\\Stripe\\Event\\Customer\\Updated', $event);
 }