Skip to content
This repository has been archived by the owner on Dec 30, 2020. It is now read-only.

Commit

Permalink
Merge pull request #109 from seregazhuk/develop
Browse files Browse the repository at this point in the history
Pins like fix
  • Loading branch information
seregazhuk committed Jun 9, 2016
2 parents 6e26a46 + c95cd27 commit d5ed1b2
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 28 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Change Log
All notable changes to this project will be documented in this file.

## [3.2.3] - 2016-06-09
### Fixes:
- Pins like/dislike
- Response error check

## [3.2.2] - 2016-06-05
### Updated:
- Keywords provider
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Providers/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ protected function execPostRequest($requestOptions, $resourceUrl, $returnData =
return $this->response->getData($response);
}

return $this->response->checkResponse($response);
return $this->response->checkErrorInResponse($response);
}

/**
Expand Down
12 changes: 1 addition & 11 deletions src/Api/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,6 @@ public function notEmpty($response)
return !empty($this->getData($response));
}

/**
* @param array $response
*
* @return bool
*/
public function checkResponse($response)
{
return $this->notEmpty($response) && $this->checkErrorInResponse($response);
}

/**
* Check for error info in api response and save
* it.
Expand Down Expand Up @@ -145,7 +135,7 @@ public function parseSearchResponse($response, $bookmarksUsed = true)
*/
public function getPaginationData($response)
{
if (!$this->checkResponse($response)) {
if (!$this->notEmpty($response) && !$this->checkErrorInResponse($response)) {
return [];
}

Expand Down
9 changes: 0 additions & 9 deletions src/Contracts/ResponseInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,6 @@ public function getBookmarksFromResponse($response);
*/
public function getPaginationData($res);

/**
* Checks if response is empty or has errors.
*
* @param $response
*
* @return mixed
*/
public function checkResponse($response);

/**
* Parses Pinterest search API response for data and bookmarks
* for next pagination page.
Expand Down
4 changes: 2 additions & 2 deletions src/Helpers/UrlHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class UrlHelper
const RESOURCE_REPIN = '/resource/RepinResource/create/';
const RESOURCE_USER_FOLLOWERS = '/resource/UserFollowersResource/get/';
const RESOURCE_DELETE_PIN = '/resource/PinResource/delete/';
const RESOURCE_LIKE_PIN = '/resource/PinLikeResource2/create/';
const RESOURCE_UNLIKE_PIN = '/resource/PinLikeResource2/delete/';
const RESOURCE_LIKE_PIN = '/resource/PinLikeResource/create/';
const RESOURCE_UNLIKE_PIN = '/resource/PinLikeResource/delete/';
const RESOURCE_COMMENT_PIN = '/resource/PinCommentResource/create/';
const RESOURCE_COMMENT_DELETE_PIN = '/resource/PinCommentResource/delete/';
const RESOURCE_PIN_INFO = '/resource/PinResource/get/';
Expand Down
4 changes: 2 additions & 2 deletions tests/ConversationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function sendMessage()
$this->setResponse($response);
$this->assertTrue($this->provider->sendMessage($userId, $message));

$this->setResponse(null);
$this->setResponse($this->createErrorApiResponse());
$this->assertFalse($this->provider->sendMessage($userId, $message));
}

Expand All @@ -44,7 +44,7 @@ public function sendEmail()
$this->setResponse($response);
$this->assertTrue($this->provider->sendEmail($email, $message));

$this->setResponse(null);
$this->setResponse($this->createErrorApiResponse());
$this->assertFalse($this->provider->sendEmail($email, $message));
}

Expand Down
6 changes: 3 additions & 3 deletions tests/PinsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function editPin()
$this->setResponse($response);
$this->assertNotFalse($this->provider->edit(1, 'new', 'changed'));

$this->setResponse(null);
$this->setResponse($this->createErrorApiResponse());
$this->assertFalse($this->provider->edit(1, 'new', 'changed'));
}

Expand All @@ -104,7 +104,7 @@ public function deletePin()
$this->setResponse($response);
$this->assertNotFalse($this->provider->delete(1));

$this->setResponse(null);
$this->setResponse($this->createErrorApiResponse());
$this->assertFalse($this->provider->delete(1));
}

Expand All @@ -115,7 +115,7 @@ public function getPinInfo()
$this->setResponse($response);
$this->assertNotNull($this->provider->info(1));

$this->setResponse(null);
$this->setResponse($this->createErrorApiResponse());
$this->assertFalse($this->provider->info(1));
}

Expand Down

0 comments on commit d5ed1b2

Please sign in to comment.