8000 Update oembed API method endpoint · skynet/codebird-php@282cb07 · GitHub
[go: up one dir, main page]

Skip to content

Commit 282cb07

Browse files
committed
Update oembed API method endpoint
Fix jublo#161.
1 parent 4dd4e5e commit 282cb07

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
codebird-php - changelog
22
========================
33

4+
3.2.0 (not yet released)
5+
+ #161 Update oembed API method endpoint
6+
47
3.1.0 (2016-02-15)
58
+ #143 Add support for proxy types
69
+ #152 Throw Exception on failed remote media download

src/codebird.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* A Twitter library in PHP.
77
*
88
* @package codebird
9-
* @version 3.1.0
9+
* @version 3.2.0-dev
1010
* @author Jublo Solutions <support@jublo.net>
1111
* @copyright 2010-2016 Jublo Solutions <support@jublo.net>
1212
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License 3.0
@@ -72,6 +72,7 @@ class Codebird
7272
'sandbox' => 'https://ads-api-sandbox.twitter.com/0/'
7373
],
7474
'media' => 'https://upload.twitter.com/1.1/',
75+
'publish' => 'https://publish.twitter.com/',
7576
'oauth' => 'https://api.twitter.com/',
7677
'rest' => 'https://api.twitter.com/1.1/',
7778
'streaming' => [
@@ -392,6 +393,7 @@ class Codebird
392393
'collections/update',
393394
'direct_messages/destroy',
394395
'direct_messages/new',
396+
'dm/new',
395397
'favorites/create',
396398
'favorites/destroy',
397399
'friendships/create',
@@ -508,7 +510,7 @@ class Codebird
508510
/**
509511
* The current Codebird version
510512
*/
511-
protected static $_version = '3.1.0';
513+
protected static $_version = '3.2.0-dev';
512514

513515
/**
514516
* The Request or access token. Used to sign requests
@@ -1971,6 +1973,8 @@ protected function _getEndpoint($method, $method_template)
19711973
$url = self::$_endpoints['oauth'] . $method;
19721974
} elseif ($this->_detectMedia($method_template)) {
19731975
$url = self::$_endpoints['media'] . $method . '.json';
1976+
} elseif ($method_template === 'statuses/oembed') {
1977+
$url = self::$_endpoints['publish'] . 'oembed';
19741978
} elseif ($variant = $this->_detectStreaming($method_template)) {
19751979
$url = self::$_endpoints['streaming'][$variant] . $method . '.json';
19761980
} elseif ($this->_detectBinaryBody($method_template)) {

test/detection_tests.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,11 @@ public function testGetEndpoint()
244244
$cb->call('_getEndpoint', ['media/upload', 'media/upload']),
245245
'media/upload'
246246
);
247+
$this->assertEquals(
248+
'https://publish.twitter.com/oembed',
249+
$cb->call('_getEndpoint', ['statuses/oembed', 'statuses/oembed']),
250+
'statuses/oembed'
251+
);
247252
$this->assertEquals(
248253
'https://stream.twitter.com/1.1/statuses/filter.json',
249254
$cb->call('_getEndpoint', ['statuses/filter', 'statuses/filter']),

0 commit comments

Comments
 (0)
0