Skip to content

Commit

Permalink
Closes T527 - getPixels returns PixelsResponse containing pending pixels
Browse files Browse the repository at this point in the history
  • Loading branch information
TomK committed May 20, 2015
1 parent dd0e7c1 commit 384a6a6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 20 deletions.
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
"homepage": "http://fortifi.co",
"license": "BSD-3-Clause",
"require": {
"fortifi/fortifi-api": "~1.1",
"fortifi/fortifi-api": "~1.3",
"league/oauth2-client": "~0.10.1",
"packaged/helpers": "~0.6"
"packaged/helpers": "~0.11"
},
"require-dev": {
"phpunit/phpunit": "4.2"
"fortifi/fortifi-api": "dev-master as 1.4",
"phpunit/phpunit": "~4.6"
},
"autoload": {
"psr-4": {
Expand Down
23 changes: 6 additions & 17 deletions src/Models/Visitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
use Fortifi\FortifiApi\Affiliate\Payloads\Action\PostActionPayload;
use Fortifi\FortifiApi\Affiliate\Payloads\Action\ReversalPayload;
use Fortifi\FortifiApi\Affiliate\Responses\Action\PostActionResponse;
use Fortifi\FortifiApi\Affiliate\Responses\Pixels\PixelsResponse;
use Fortifi\FortifiApi\Foundation\Responses\BoolResponse;
use Fortifi\FortifiApi\Helpers\Affiliate\AffiliatePixelModel;

class Visitor extends FortifiModel
{
protected $_visitorId;
protected $_alias;
protected $_pixels = [];

/**
* @param $visitorId
Expand Down Expand Up @@ -130,23 +131,11 @@ public function reverseAction(
/**
* Retrieve queued pixels
*
* @param bool $loadFromApi set to false to only retrieve pixels from
* triggerAction requests
* @param bool $clear Clear pixels from the queue on retrieval
*
* @return array
* @return PixelsResponse
*/
public function getPixels($loadFromApi = false, $clear = true)
public function getPixels()
{
if(!$loadFromApi)
{
$return = (array)$this->_pixels;
if($clear)
{
$this->_pixels = [];
}
return $return;
}
return [];
$endpoint = new AffiliatePixelModel($this->_getApi());
return $endpoint->getPending($this->_visitorId);
}
}

0 comments on commit 384a6a6

Please sign in to comment.