Ejemplo n.º 1
0
<?php

/**
 * Boilerplate for GDS examples
 *
 * @author Tom Walder <*****@*****.**>
 */
require_once '../vendor/autoload.php';
require_once 'config/setup.php';
require_once 'Book.php';
// We'll need a Google_Client, use our convenience method
$obj_client = GDS\Gateway\GoogleAPIClient::createGoogleClient(GDS_APP_NAME, GDS_SERVICE_ACCOUNT_NAME, GDS_KEY_FILE_PATH);
// Gateway requires a Google_Client and Dataset ID
$obj_gateway = new GDS\Gateway\GoogleAPIClient($obj_client, GDS_DATASET_ID);
// Define our Model Schema
$obj_book_schema = (new GDS\Schema('Book'))->addString('title')->addString('author')->addString('isbn', TRUE);
// Store requires a Gateway and Schema
$obj_book_store = new GDS\Store($obj_book_schema, $obj_gateway);
Ejemplo n.º 2
0
 /**
  * Test create Gateway
  */
 public function testCreateGateway()
 {
     $obj_client = GDS\Gateway\GoogleAPIClient::createClientFromJson(dirname(__FILE__) . '/base/service.json');
     $obj_gateway = new GDS\Gateway\GoogleAPIClient($obj_client, 'Dataset');
     $this->assertInstanceOf('\\GDS\\Gateway\\GoogleAPIClient', $obj_gateway);
 }