8000 Update to Twitter API 1.1 · codezninja/codebird-php@85c44e7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 85c44e7

Browse files
committed
Update to Twitter API 1.1
1 parent fec4faf commit 85c44e7

File tree

1 file changed

+6
-24
lines changed

1 file changed

+6
-24
lines changed

codebird.php

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class Codebird
5858
/**
5959
* The API endpoint to use
6060
*/
61-
private $_endpoint = 'https://api.twitter.com/1/';
61+
private $_endpoint = 'https://api.twitter.com/1.1/';
6262

6363
/**
6464
* The API endpoint to use for OAuth requests
@@ -69,7 +69,7 @@ class Codebird
6969
* The API endpoint to use for uploading tweets with media
7070
* see https://dev.twitter.com/discussions/1059
7171
*/
72-
private $_endpoint_upload = 'https://upload.twitter.com/1/';
72+
private $_endpoint_upload = 'https://upload.twitter.com/1.1/';
7373

7474
/**
7575
* The Request or access token. Used to sign requests
@@ -99,7 +99,7 @@ class Codebird
9999
/**
100100
* The current Codebird version
101101
*/
102-
private $_version = '2.2.0';
102+
private $_version = '2.2.1';
103103

104104
/**
105105
* Returns singleton class instance
@@ -235,13 +235,12 @@ public function __call($fn, $params)
235235
}
236236

237237
$httpmethod = $this->_detectMethod($method_template);
238-
$sign = $this->_detectSign($method_template);
239238
$multipart = $this->_detectMultipart($method_template);
240239

241240
// geek-geek: Now allowing to specify filenames as params
242241
$this->_detectFilenames($method_template, $apiparams);
243242

244-
return $this->_callApi($httpmethod, $method, $method_template, $apiparams, $sign, $multipart);
243+
return $this->_callApi($httpmethod, $method, $method_template, $apiparams, $multipart);
245244
}
246245

247246
/**
@@ -584,22 +583,6 @@ private function _detectMethod($method)
584583
throw new Exception('Can\'t find HTTP method to use for "' . $method . '".');
585584
}
586585

587-
/**
588-
* Detects if API call should be signed
589-
*
590-
* @param string $method The API method to call
591-
*
592-
* @return bool Whether the API call should be signed
593-
*/
594-
private function _detectSign($method)
595-
{
596-
$unsignedmethods = array(
597-
// OAuth
598-
'oauth/request_token'
599-
);
600-
return !in_array($method, $unsignedmethods);
601-
}
602-
603586
/**
604587
* Detects if API call should use multipart/form-data
605588
*
@@ -716,15 +699,14 @@ private function _getEndpoint($method)
716699
* @param string $method The API method to call
717700
* @param string $method_template The templated API method to call
718701
* @param array optional $params The parameters to send along
719-
* @param bool optional $sign Whether to sign the API call
720702
* @param bool optional $multipart Whether to use multipart/form-data
721703
*
722704
* @return mixed The API reply, encoded in the set return_format
723705
*/
724706

725-
private function _callApi($httpmethod, $method, $method_template, $params = array(), $sign = true, $multipart = false)
707+
private function _callApi($httpmethod, $method, $method_template, $params = array(), $multipart = false)
726708
{
727-
if ($sign && !isset($this->_oauth_token)) {
709+
if (!isset($this->_oauth_token)) {
728710
throw new Exception('To make a signed API request, the OAuth token must be set.');
729711
}
730712
if (! function_exists('curl_init')) {

0 commit comments

Comments
 (0)
0