Skip to content

Commit

Permalink
Merge pull request #21 from ker0x/hotfix/issue-20
Browse files Browse the repository at this point in the history
[fix #20] Add ending slash to base_uri, change routes to relative paths
  • Loading branch information
ker0x authored Mar 10, 2017
2 parents a92c5fd + 19e79a1 commit db5843d
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ build:
tests:
override:
-
command: 'phpunit --coverage-clover=clover.xml'
command: 'vendor/bin/phpunit --coverage-clover=clover.xml'
coverage:
file: 'clover.xml'
format: 'clover'
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ before_script:
- sh -c "if [ '$COVERALLS' = '1' ]; then mkdir -p build/logs; fi"

script:
- sh -c "if [ '$COVERALLS' = '1' ]; then phpunit --stderr --coverage-clover build/logs/clover.xml; fi"
- sh -c "if [ '$COVERALLS' = '1' ]; then vendor/bin/phpunit --stderr --coverage-clover build/logs/clover.xml; fi"
- sh -c "if [ '$COVERALLS' = '1' ]; then php vendor/bin/coveralls -v; fi"
- sh -c "if [ '$DEFAULT' = '1' ]; then phpunit --stderr; fi"
- sh -c "if [ '$DEFAULT' = '1' ]; then vendor/bin/phpunit --stderr; fi"
- sh -c "if [ '$PHPCS' = '1' ]; then ./vendor/bin/phpcs -n -p --extensions=php --standard=PSR2 --ignore=vendor --ignore=tests . ; fi"

notifications:
Expand Down
10 changes: 8 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
"name": "kerox/messenger",
"type": "library",
"description": "PHP Library for Facebook Messenger",
"keywords": ["facebook", "messenger", "facebook messenger", "bot messenger", "api"],
"keywords": [
"facebook",
"messenger",
"facebook messenger",
"bot messenger",
"api"
],
"homepage": "https://github.com/ker0x/messenger",
"license": "MIT",
"authors": [
Expand All @@ -18,7 +24,7 @@
"guzzlehttp/guzzle": "^6.2"
},
"require-dev": {
"phpunit/phpunit": "^5.6",
"phpunit/phpunit": "^6.0",
"satooshi/php-coveralls": "^1.0",
"squizlabs/php_codesniffer": "^2.7"
},
Expand Down
4 changes: 2 additions & 2 deletions src/Api/Send.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function sendMessage(string $recipient, $message, string $notificationTyp
$this->isValidNotificationType($notificationType);

$request = new SendRequest($this->pageToken, $recipient, $message, null, $notificationType);
$response = $this->client->post('/me/messages', $request->build());
$response = $this->client->post('me/messages', $request->build());

return new SendResponse($response);
}
Expand All @@ -58,7 +58,7 @@ public function sendAction(string $recipient, string $action, string $notificati
$this->isValidNotificationType($notificationType);

$request = new SendRequest($this->pageToken, $recipient, null, $action, $notificationType);
$response = $this->client->post('/me/messages', $request->build());
$response = $this->client->post('me/messages', $request->build());

return new SendResponse($response);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Api/Thread.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct($pageToken, ClientInterface $client)
public function addSetting(ThreadSettings $threadSettings): ThreadResponse
{
$request = new ThreadRequest($this->pageToken, $threadSettings);
$response = $this->client->post('/me/thread_settings', $request->build());
$response = $this->client->post('me/thread_settings', $request->build());

return new ThreadResponse($response);
}
Expand All @@ -44,7 +44,7 @@ public function deleteSetting(string $type, string $state = null)
$threadSettings = new ThreadSettings($type, $state);

$request = new ThreadRequest($this->pageToken, $threadSettings);
$this->client->delete('/me/thread_settings', $request->build());
$this->client->delete('me/thread_settings', $request->build());
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Api/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function getProfile(string $userId, array $fields = null): UserResponse
}

$request = new UserRequest($this->pageToken, $fields);
$response = $this->client->get(sprintf('/%s', $userId), $request->build());
$response = $this->client->get(sprintf('%s', $userId), $request->build());

return new UserResponse($response);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function getChallenge()
public function sendSubscribe(): WebhookResponse
{
$request = new WebhookRequest($this->pageToken);
$response = $this->client->post('/me/subscribed_apps', $request->build());
$response = $this->client->post('me/subscribed_apps', $request->build());

return new WebhookResponse($response);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Messenger.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function __construct(string $appSecret, string $verifyToken, string $page

if ($client === null) {
$client = new Client([
'base_uri' => self::API_URL . self::API_VERSION,
'base_uri' => self::API_URL . self::API_VERSION . '/',
]);
}
$this->client = $client;
Expand Down

0 comments on commit db5843d

Please sign in to comment.