Commit 788fbdd5bd74aba50adcfe129f1d8808474c8491

Authored by Alex Savenko
1 parent 5285e167

ga output

app/library/App/Bootstrap/CollectionBootstrap.php
@@ -4,11 +4,10 @@ namespace App\Bootstrap; @@ -4,11 +4,10 @@ namespace App\Bootstrap;
4 4
5 use App\BootstrapInterface; 5 use App\BootstrapInterface;
6 use App\Collections\ExportCollection; 6 use App\Collections\ExportCollection;
  7 +use App\Resources\AllPositionResource;
7 use App\Resources\GaResource; 8 use App\Resources\GaResource;
8 use App\Resources\ProjectResource; 9 use App\Resources\ProjectResource;
9 use App\Resources\UserResource; 10 use App\Resources\UserResource;
10 -use App\Resources\AlbumResource;  
11 -use App\Resources\PhotoResource;  
12 use Phalcon\Config; 11 use Phalcon\Config;
13 use Phalcon\DiInterface; 12 use Phalcon\DiInterface;
14 use PhalconRest\Api; 13 use PhalconRest\Api;
@@ -19,9 +18,8 @@ class CollectionBootstrap implements BootstrapInterface @@ -19,9 +18,8 @@ class CollectionBootstrap implements BootstrapInterface
19 { 18 {
20 $api 19 $api
21 ->resource(new GaResource('/ga')) 20 ->resource(new GaResource('/ga'))
  21 + ->resource(new AllPositionResource('/ap'))
22 ->resource(new UserResource('/users')) 22 ->resource(new UserResource('/users'))
23 - //->resource(new AlbumResource('/albums'))  
24 - //->resource(new PhotoResource('/photos'))  
25 ->resource(new ProjectResource('/projects')) 23 ->resource(new ProjectResource('/projects'))
26 ->collection(new ExportCollection('/export')); 24 ->collection(new ExportCollection('/export'));
27 } 25 }
app/library/App/Controllers/AllPositionController.php 0 → 100644
  1 +<?php
  2 +/**
  3 + * Created by PhpStorm.
  4 + * User: Alex Savenko
  5 + * Date: 22.02.2017
  6 + * Time: 20:18
  7 + */
  8 +
  9 +namespace App\Controllers;
  10 +
  11 +
  12 +
  13 +use PhalconRest\Mvc\Controllers\CrudResourceController;
  14 +use xf3\AllPositions;
  15 +
  16 +class AllPositionController extends CrudResourceController
  17 +{
  18 + const API_KEY = '150bb253651622507341cd7845f5b9d2';
  19 +
  20 + public function testAction() {
  21 +
  22 + $APObj = new AllPositions(self::API_KEY);
  23 +
  24 + $project_info = $APObj->get_project(418068);
  25 +
  26 + return $project_info;
  27 +
  28 + }
  29 +
  30 +}
0 \ No newline at end of file 31 \ No newline at end of file
app/library/App/Controllers/GaController.php
@@ -10,7 +10,6 @@ namespace App\Controllers; @@ -10,7 +10,6 @@ namespace App\Controllers;
10 10
11 11
12 use App\Model\Project; 12 use App\Model\Project;
13 -use App\Model\User;  
14 use Google_Client; 13 use Google_Client;
15 use Google_Service_AnalyticsReporting; 14 use Google_Service_AnalyticsReporting;
16 use Google_Service_AnalyticsReporting_DateRange; 15 use Google_Service_AnalyticsReporting_DateRange;
app/library/App/Resources/AllPositionResource.php 0 → 100644
  1 +<?php
  2 +/**
  3 + * Created by PhpStorm.
  4 + * User: Alex Savenko
  5 + * Date: 22.02.2017
  6 + * Time: 20:29
  7 + */
  8 +
  9 +namespace App\Resources;
  10 +
  11 +
  12 +use PhalconRest\Api\ApiResource;
  13 +
  14 +class AllPositionResource extends ApiResource
  15 +{
  16 +
  17 + public function initialize() {
  18 +
  19 + $this
  20 + ->name('Google Analytics')
  21 + ->expectsJsonData()
  22 + //->transformer(ModelTransformer::class)
  23 + ->itemKey('ap')
  24 + ->collectionKey('ap')
  25 + ->deny(AclRoles::UNAUTHORIZED)
  26 + ->handler(GaController::class)
  27 +
  28 + ->endpoint(ApiEndpoint::get('', 'testAction')
  29 + ->allow(AclRoles::USER)
  30 + ->description('Returns data from AllPosition Api.')
  31 + )
  32 + ;
  33 +
  34 + }
  35 +
  36 +}
0 \ No newline at end of file 37 \ No newline at end of file