public function loadsResourceAfterUserChange()
 {
     $users = IformResource::users();
     $this->assertInstanceOf('Iform\\Resources\\User\\Users', $users);
     $element = IformResource::elements(8989898);
     $this->assertInstanceOf('Iform\\Resources\\Element\\Elements', $element);
 }
 public function testFetchesAllWithMultipleGrammar()
 {
     $pages = IformResource::pages();
     $grammar = 'name(~"%' . 'test' . '%")' . ',name:<';
     $pages = json_decode($pages->where($grammar)->withAllFields()->fetchAll(), true);
     $this->assertContains('a', $pages[0]['name']);
 }
 public function testSharesInstanceOfRequestHandler()
 {
     $page = IformResource::pages();
     $this->assertInstanceOf('Iform\\Resources\\Page\\Pages', $page);
     $element = IformResource::elements(8989898);
     $this->assertInstanceOf('Iform\\Resources\\Element\\Elements', $element);
 }
 public function testValidatesDuplicateSotsPassed()
 {
     $elements = IformResource::options(405538);
     $json = '[{"id": "269024947","sort_order": "0"}, {"id": "269024950","sort_order": "0"}]';
     $params = json_decode($json, true);
     $update = json_decode($elements->updateAll($params), true);
     $this->assertArrayHasKey('error_message', $update[1]);
 }
 public function testValidatesDuplicateSotsPassed()
 {
     $elements = IformResource::elements(801697);
     $json = '[{"id": "20620195","sort_order": "0"}, {"id": "20594276","sort_order": "0"}]';
     $params = json_decode($json, true);
     $update = json_decode($elements->updateAll($params), true);
     $this->assertArrayHasKey('error_message', $update[1]);
 }
 /**
  * Fetch element and filter fields for record
  *
  * @return string
  */
 protected function getAllFields()
 {
     $fields = array();
     $elemResource = IformResource::elements($this->pageId);
     $elements = json_decode($elemResource->withAllFields()->fetchAll(), true);
     foreach ($elements as $element) {
         if (!$this->notCollectedType($element['data_type'])) {
             array_push($fields, $element['name']);
         }
     }
     return implode(",", array_merge(self::$baseRecord, $fields));
 }
 public function testDeletesAll()
 {
     $recordResource = IformResource::records($this->pageId);
     $ids = $recordResource->where('id(>="1")')->deleteAll();
 }
<?php

// make sure to include zerion autoloader
require_once 'iform/zerion_autoload.php';
// the auto loader will fetch this classes
// all file loading will be taken care of for you
use Iform\Resources\IformResource;
use Iform\Creds\Config;
// find this credentials in the api apps section of iformbuilder admin tool
$config = array('profile' => 'your profile id', 'server' => 'your server name', 'client' => 'your client key', 'secret' => 'your secret key');
// pass config to api method
Config::api($config);
//user container to initialize resource
//connection and jwt authentication will be take care of through the iForm resource container!
$pages = IformResource::pages();
// Now your ready to interact with the api!
// Grab the first ten pages in your account
// return json by default
echo $pages->first(10)->fetchAll();
 public function testFetchesAll()
 {
     $profile = IformResource::profile();
     $results = $profile->withAllFields()->first(10)->fetchAll();
 }
 public function testDelete()
 {
     $elements = IformResource::elements(794890);
 }
 function __construct($body = null)
 {
     parent::__construct($body);
     $this->model = IformResource::pages();
 }