We now use the master branch of codebird

This commit is contained in:
Michael 2019-08-04 12:16:56 +00:00
parent 2e776253e0
commit 20ed3495b2
25 changed files with 992 additions and 1464 deletions

View File

@ -22,7 +22,7 @@
], ],
"require": { "require": {
"abraham/twitteroauth": "^0.7.4", "abraham/twitteroauth": "^0.7.4",
"jublonet/codebird-php": "^3.1" "jublonet/codebird-php": "dev-master"
}, },
"license": "3-clause BSD license", "license": "3-clause BSD license",
"minimum-stability": "stable", "minimum-stability": "stable",

22
twitter/composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "256ff0f85c92d09c729ecce09a4c0884", "content-hash": "eaeac282537509fd7d0bc4f92f01bc04",
"packages": [ "packages": [
{ {
"name": "abraham/twitteroauth", "name": "abraham/twitteroauth",
@ -182,16 +182,16 @@
}, },
{ {
"name": "jublonet/codebird-php", "name": "jublonet/codebird-php",
"version": "3.1.0", "version": "dev-master",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/jublonet/codebird-php.git", "url": "https://github.com/jublonet/codebird-php.git",
"reference": "100a8e8f1928a5738b4476f0caf83f2c2ba6da5b" "reference": "df362d8ad629aad6c4c7dbf36a440e569ec41368"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/jublonet/codebird-php/zipball/100a8e8f1928a5738b4476f0caf83f2c2ba6da5b", "url": "https://api.github.com/repos/jublonet/codebird-php/zipball/df362d8ad629aad6c4c7dbf36a440e569ec41368",
"reference": "100a8e8f1928a5738b4476f0caf83f2c2ba6da5b", "reference": "df362d8ad629aad6c4c7dbf36a440e569ec41368",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -202,8 +202,8 @@
"php": ">=5.5.0" "php": ">=5.5.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": ">=3.7", "php-coveralls/php-coveralls": ">=0.6",
"satooshi/php-coveralls": ">=0.6", "phpunit/phpunit": ">=7.3",
"squizlabs/php_codesniffer": "2.*" "squizlabs/php_codesniffer": "2.*"
}, },
"type": "library", "type": "library",
@ -230,20 +230,22 @@
"homepage": "http://mynetx.net/" "homepage": "http://mynetx.net/"
} }
], ],
"description": "Easy access to the Twitter REST API, Collections API, Streaming API, TON (Object Nest) API and Twitter Ads API — all from one PHP library.", "description": "Easy access to the Twitter REST API, Direct Messages API, Account Activity API, TON (Object Nest) API and Twitter Ads API — all from one PHP library.",
"homepage": "https://www.jublo.net/projects/codebird/php", "homepage": "https://www.jublo.net/projects/codebird/php",
"keywords": [ "keywords": [
"api", "api",
"networking", "networking",
"twitter" "twitter"
], ],
"time": "2016-02-15T18:38:55+00:00" "time": "2018-08-16T00:07:08+00:00"
} }
], ],
"packages-dev": [], "packages-dev": [],
"aliases": [], "aliases": [],
"minimum-stability": "stable", "minimum-stability": "stable",
"stability-flags": [], "stability-flags": {
"jublonet/codebird-php": 20
},
"prefer-stable": false, "prefer-stable": false,
"prefer-lowest": false, "prefer-lowest": false,
"platform": [], "platform": [],

View File

@ -64,6 +64,7 @@
use Abraham\TwitterOAuth\TwitterOAuth; use Abraham\TwitterOAuth\TwitterOAuth;
use Abraham\TwitterOAuth\TwitterOAuthException; use Abraham\TwitterOAuth\TwitterOAuthException;
use Codebird\Codebird;
use Friendica\App; use Friendica\App;
use Friendica\Content\OEmbed; use Friendica\Content\OEmbed;
use Friendica\Content\Text\BBCode; use Friendica\Content\Text\BBCode;
@ -591,6 +592,10 @@ function twitter_post_hook(App $a, array &$b)
return; return;
} }
Codebird::setConsumerKey($ckey, $csecret);
$cb = Codebird::getInstance();
$cb->setToken($otoken, $osecret);
$connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret); $connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret);
// Set the timeout for upload to 30 seconds // Set the timeout for upload to 30 seconds
@ -649,6 +654,7 @@ function twitter_post_hook(App $a, array &$b)
if (isset($media->media_id_string)) { if (isset($media->media_id_string)) {
$post['media_ids'] = $media->media_id_string; $post['media_ids'] = $media->media_id_string;
//$details = $cb->account_verifyCredentials();
} else { } else {
throw new Exception('Failed upload of ' . $image); throw new Exception('Failed upload of ' . $image);
} }

View File

@ -7,4 +7,8 @@ $baseDir = dirname($vendorDir);
return array( return array(
'Codebird\\Codebird' => $vendorDir . '/jublonet/codebird-php/src/codebird.php', 'Codebird\\Codebird' => $vendorDir . '/jublonet/codebird-php/src/codebird.php',
'Codebird\\CodebirdAuthException' => $vendorDir . '/jublonet/codebird-php/src/codebird.php',
'Codebird\\CodebirdCredentialsException' => $vendorDir . '/jublonet/codebird-php/src/codebird.php',
'Codebird\\CodebirdEndpointException' => $vendorDir . '/jublonet/codebird-php/src/codebird.php',
'Codebird\\CodebirdMediaException' => $vendorDir . '/jublonet/codebird-php/src/codebird.php',
); );

View File

@ -30,6 +30,10 @@ class ComposerStaticInitTwitterAddon
public static $classMap = array ( public static $classMap = array (
'Codebird\\Codebird' => __DIR__ . '/..' . '/jublonet/codebird-php/src/codebird.php', 'Codebird\\Codebird' => __DIR__ . '/..' . '/jublonet/codebird-php/src/codebird.php',
'Codebird\\CodebirdAuthException' => __DIR__ . '/..' . '/jublonet/codebird-php/src/codebird.php',
'Codebird\\CodebirdCredentialsException' => __DIR__ . '/..' . '/jublonet/codebird-php/src/codebird.php',
'Codebird\\CodebirdEndpointException' => __DIR__ . '/..' . '/jublonet/codebird-php/src/codebird.php',
'Codebird\\CodebirdMediaException' => __DIR__ . '/..' . '/jublonet/codebird-php/src/codebird.php',
); );
public static function getInitializer(ClassLoader $loader) public static function getInitializer(ClassLoader $loader)

View File

@ -179,17 +179,17 @@
}, },
{ {
"name": "jublonet/codebird-php", "name": "jublonet/codebird-php",
"version": "3.1.0", "version": "dev-master",
"version_normalized": "3.1.0.0", "version_normalized": "9999999-dev",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/jublonet/codebird-php.git", "url": "https://github.com/jublonet/codebird-php.git",
"reference": "100a8e8f1928a5738b4476f0caf83f2c2ba6da5b" "reference": "df362d8ad629aad6c4c7dbf36a440e569ec41368"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/jublonet/codebird-php/zipball/100a8e8f1928a5738b4476f0caf83f2c2ba6da5b", "url": "https://api.github.com/repos/jublonet/codebird-php/zipball/df362d8ad629aad6c4c7dbf36a440e569ec41368",
"reference": "100a8e8f1928a5738b4476f0caf83f2c2ba6da5b", "reference": "df362d8ad629aad6c4c7dbf36a440e569ec41368",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -200,13 +200,13 @@
"php": ">=5.5.0" "php": ">=5.5.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": ">=3.7", "php-coveralls/php-coveralls": ">=0.6",
"satooshi/php-coveralls": ">=0.6", "phpunit/phpunit": ">=7.3",
"squizlabs/php_codesniffer": "2.*" "squizlabs/php_codesniffer": "2.*"
}, },
"time": "2016-02-15T18:38:55+00:00", "time": "2018-08-16T00:07:08+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "source",
"autoload": { "autoload": {
"classmap": [ "classmap": [
"src/" "src/"
@ -230,7 +230,7 @@
"homepage": "http://mynetx.net/" "homepage": "http://mynetx.net/"
} }
], ],
"description": "Easy access to the Twitter REST API, Collections API, Streaming API, TON (Object Nest) API and Twitter Ads API — all from one PHP library.", "description": "Easy access to the Twitter REST API, Direct Messages API, Account Activity API, TON (Object Nest) API and Twitter Ads API — all from one PHP library.",
"homepage": "https://www.jublo.net/projects/codebird/php", "homepage": "https://www.jublo.net/projects/codebird/php",
"keywords": [ "keywords": [
"api", "api",

View File

@ -6,9 +6,8 @@ language: php
sudo: false sudo: false
php: php:
- "7.0" - "7.2"
- "5.6" - "7.1"
- "5.5"
- hhvm - hhvm
- nightly - nightly

View File

@ -1,6 +1,29 @@
codebird-php - changelog codebird-php - changelog
======================== ========================
4.0.0 (not yet released)
+ #161 Update oembed API method endpoint
+ Update to Twitter Ads API Version 1
+ Add Ads API POST tailored_audience_memberships method
+ Add Ads Sandbox API POST accounts method
+ Add Ads Sandbox API POST accounts/:account_id/features method
+ Add Ads Sandbox API POST accounts/:account_id/funding_instruments method
+ Update more Ads API methods
- Fix Ads API batch methods to send JSON body
+ Update Ads API Analytics methods (stats)
+ #177 Add async media/upload calls status by GET
+ Add POST media/metadata/create method
- Fix TON API upload - add additional header parsing
+ Add custom Codebird Exception classes
+ Add Account Activity API methods
+ Add new Direct Messages API
+ Update cacert.pem file
- Remove sunsetting Direct Messages API
- Remove sunsetting Streaming API
- Remove contributor API methods
- Remove deprecated statuses/update_with_media method
- Remove deprecated statuses/update_profile_background_image method
3.1.0 (2016-02-15) 3.1.0 (2016-02-15)
+ #143 Add support for proxy types + #143 Add support for proxy types
+ #152 Throw Exception on failed remote media download + #152 Throw Exception on failed remote media download

View File

@ -1,8 +1,8 @@
codebird-php codebird-php
============ ============
*Easy access to the Twitter REST API, Collections API, Streaming API, TON (Object Nest) API and Twitter Ads API — all from one PHP library.* *Easy access to the Twitter REST API, Direct Messages API, Account Activity API, TON (Object Nest) API and Twitter Ads API — all from one PHP library.*
Copyright (C) 2010-2016 Jublo Solutions <support@jublo.net> Copyright (C) 2010-2018 Jublo Limited <support@jublo.net>
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -17,12 +17,13 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/3cd81a521d334648b9958327621a3070)](https://www.codacy.com/app/jublonet/codebird-php?utm_source=github.com&utm_medium=referral&utm_content=jublonet/codebird-php&utm_campaign=badger)
[![Coverage Status](https://img.shields.io/coveralls/jublonet/codebird-php/develop.svg)](https://coveralls.io/github/jublonet/codebird-php?branch=develop) [![Coverage Status](https://img.shields.io/coveralls/jublonet/codebird-php/develop.svg)](https://coveralls.io/github/jublonet/codebird-php?branch=develop)
[![Travis Status](https://img.shields.io/travis/jublonet/codebird-php/develop.svg)](https://travis-ci.org/jublonet/codebird-php/branches) [![Travis Status](https://img.shields.io/travis/jublonet/codebird-php/develop.svg)](https://travis-ci.org/jublonet/codebird-php/branches)
### Requirements ### Requirements
- PHP 5.5.0 or higher - PHP 7.1.0 or higher
- OpenSSL extension - OpenSSL extension
@ -131,6 +132,13 @@ In this case, you don't need to set the consumer key and secret.
For sending an API request with app-only auth, see the Usage examples section. For sending an API request with app-only auth, see the Usage examples section.
### A word on your callback URL
Twitter is very restrictive about which URLs may be used for your callback URL.
For example, even the presence of the www subdomain must match with the domain
that you specified in the settings of your app at https://developer.twitter.com/en/apps.
Mapping API methods to Codebird function calls Mapping API methods to Codebird function calls
---------------------------------------------- ----------------------------------------------
@ -240,7 +248,7 @@ The library returns the response HTTP status code, so you can detect rate limits
I suggest you to check if the ```$reply->httpstatus``` property is ```400``` I suggest you to check if the ```$reply->httpstatus``` property is ```400```
and check with the Twitter API to find out if you are currently being and check with the Twitter API to find out if you are currently being
rate-limited. rate-limited.
See the [Rate Limiting FAQ](https://dev.twitter.com/rest/public/rate-limiting) See the [Rate Limiting FAQ](https://developer.twitter.com/en/docs/basics/rate-limiting)
for more information. for more information.
Unless your return format is JSON, you will receive rate-limiting details Unless your return format is JSON, you will receive rate-limiting details
@ -325,7 +333,7 @@ print_r($reply);
Here is a [sample Tweet](https://twitter.com/LarryMcTweet/status/475276535386365952) Here is a [sample Tweet](https://twitter.com/LarryMcTweet/status/475276535386365952)
sent with the code above. sent with the code above.
More [documentation for uploading media](https://dev.twitter.com/rest/public/uploading-media) is available on the Twitter Developer site. More [documentation for uploading media](https://developer.twitter.com/en/docs/media/upload-media/overview) is available on the Twitter Developer site.
### Remote files ### Remote files
@ -404,6 +412,9 @@ if ($reply->httpstatus < 200 || $reply->httpstatus > 299) {
die(); die();
} }
// if you have a field `processing_info` in the reply,
// use the STATUS command to check if the video has finished processing.
// Now use the media_id in a Tweet // Now use the media_id in a Tweet
$reply = $cb->statuses_update([ $reply = $cb->statuses_update([
'status' => 'Twitter now accepts video uploads.', 'status' => 'Twitter now accepts video uploads.',
@ -412,7 +423,7 @@ $reply = $cb->statuses_update([
``` ```
**Find more information about [accepted video formats](https://dev.twitter.com/rest/public/uploading-media#videorecs) in the Twitter Developer docs.** **Find more information about [accepted media formats](https://developer.twitter.com/en/docs/media/upload-media/uploading-media/media-best-practices) in the Twitter Developer docs.**
:warning: When uploading a video in multiple chunks, you may run into an error `The validation of media ids failed.` even though the `media_id` is correct. This is known. Please check back in the [Twitter community forums](https://twittercommunity.com/tags/video). :warning: When uploading a video in multiple chunks, you may run into an error `The validation of media ids failed.` even though the `media_id` is correct. This is known. Please check back in the [Twitter community forums](https://twittercommunity.com/tags/video).
@ -469,18 +480,22 @@ $cb->setStreamingCallback('some_callback');
$GLOBALS['time_start'] = time(); $GLOBALS['time_start'] = time();
// Second, start consuming the stream: // Second, start consuming the stream:
$reply = $cb->user(); $reply = $cb->statuses_filter();
// See the *Mapping API methods to Codebird function calls* section for method names. // See the *Mapping API methods to Codebird function calls* section for method names.
// $reply = $cb->statuses_filter('track=Windows'); // $reply = $cb->statuses_filter('track=Windows');
``` ```
Find more information on the [Streaming API](https://dev.twitter.com/streaming/overview) You should be able to set a timeout for the streaming API using `setTimeout`.
In addition, your callback will receive empty messages if no events occur,
and you should make your function `return true;` in order to cancel the stream.
Find more information on the [Streaming API](https://developer.twitter.com/en/docs/tweets/filter-realtime/overview)
in the developer documentation website. in the developer documentation website.
Twitter Collections API Twitter Collections, Direct Messages and Account Activity APIs
----------------------- --------------------------------------------------------------
Collections are a type of timeline that you control and can be hand curated Collections are a type of timeline that you control and can be hand curated
and/or programmed using an API. and/or programmed using an API.
@ -490,12 +505,13 @@ often they will be decomposed, efficient objects with information about users,
Tweets, and timelines grouped, simplified, and stripped of unnecessary repetition. Tweets, and timelines grouped, simplified, and stripped of unnecessary repetition.
Never care about the OAuth signing specialities and the JSON POST body Never care about the OAuth signing specialities and the JSON POST body
for POST collections/entries/curate.json. Codebird takes off the work for you for POST and PUT calls to these special APIs. Codebird takes off the work for you
and will always send the correct Content-Type automatically. and will always send the correct Content-Type automatically.
Find out more about the [Collections API](https://dev.twitter.com/rest/collections/about) in the Twitter API docs. Find out more about the [Collections API](https://developer.twitter.com/en/docs/tweets/curate-a-collection/overview/about_collections) in the Twitter API docs.
More information on the [Direct Messages API](https://developer.twitter.com/en/docs/direct-messages/api-features) and the [Account Activity API](https://developer.twitter.com/en/docs/accounts-and-users/subscribe-account-activity/overview) is available there as well.
Heres a sample for adding a Tweet using that API method: Heres a sample for adding a Tweet using the Collections API:
```php ```php
$reply = $cb->collections_entries_curate([ $reply = $cb->collections_entries_curate([
@ -511,7 +527,7 @@ var_dump($reply);
TON (Twitter Object Nest) API TON (Twitter Object Nest) API
----------------------------- -----------------------------
The [TON (Twitter Object Nest) API](https://dev.twitter.com/rest/ton) allows implementers to upload media and various assets to Twitter. The [TON (Twitter Object Nest) API](https://developer.twitter.com/en/docs/ads/audiences/overview/ton-upload.html) allows implementers to upload media and various assets to Twitter.
The TON API supports non-resumable and resumable upload methods based on the size of the file. The TON API supports non-resumable and resumable upload methods based on the size of the file.
For files less than 64MB, non-resumable may be used. For files greater than or equal to 64MB, For files less than 64MB, non-resumable may be used. For files greater than or equal to 64MB,
resumable must be used. Resumable uploads require chunk sizes of less than 64MB. resumable must be used. Resumable uploads require chunk sizes of less than 64MB.
@ -597,7 +613,7 @@ fclose($fp);
Twitter Ads API Twitter Ads API
--------------- ---------------
The [Twitter Ads API](https://dev.twitter.com/ads/overview) allows partners to The [Twitter Ads API](https://developer.twitter.com/en/docs/ads/general/overview) allows partners to
integrate with the Twitter advertising platform in their own advertising solutions. integrate with the Twitter advertising platform in their own advertising solutions.
Selected partners have the ability to create custom tools to manage and execute Selected partners have the ability to create custom tools to manage and execute
Twitter Ad campaigns. Twitter Ad campaigns.

View File

@ -6,7 +6,7 @@
"Joshua Atkins <joshua.atkins@jublo.net>", "Joshua Atkins <joshua.atkins@jublo.net>",
"J.M. <jm@jublo.net>" "J.M. <jm@jublo.net>"
], ],
"description": "Easy access to the Twitter REST API, Collections API, Streaming API, TON (Object Nest) API and Twitter Ads API — all from one PHP library.", "description": "Easy access to the Twitter REST, Direct Messages, Account Activity, TON (Object Nest) and Twitter Ads API — all from one PHP library.",
"main": "src/codebird.php", "main": "src/codebird.php",
"moduleType": [], "moduleType": [],
"keywords": [ "keywords": [

View File

@ -1,6 +1,6 @@
{ {
"name": "jublonet/codebird-php", "name": "jublonet/codebird-php",
"description" : "Easy access to the Twitter REST API, Collections API, Streaming API, TON (Object Nest) API and Twitter Ads API — all from one PHP library.", "description" : "Easy access to the Twitter REST API, Direct Messages API, Account Activity API, TON (Object Nest) API and Twitter Ads API — all from one PHP library.",
"keywords": [ "keywords": [
"Twitter", "Twitter",
"API", "API",
@ -38,8 +38,8 @@
"classmap": ["src/"] "classmap": ["src/"]
}, },
"require-dev": { "require-dev": {
"satooshi/php-coveralls": ">=0.6", "php-coveralls/php-coveralls": ">=0.6",
"phpunit/phpunit": ">=3.7", "phpunit/phpunit": ">=7.3",
"squizlabs/php_codesniffer": "2.*" "squizlabs/php_codesniffer": "2.*"
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -6,9 +6,9 @@ namespace Codebird;
* A Twitter library in PHP. * A Twitter library in PHP.
* *
* @package codebird * @package codebird
* @version 3.1.0 * @version 4.0.0-beta.1
* @author Jublo Solutions <support@jublo.net> * @author Jublo Limited <support@jublo.net>
* @copyright 2010-2016 Jublo Solutions <support@jublo.net> * @copyright 2010-2018 Jublo Limited <support@jublo.net>
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License 3.0 * @license https://opensource.org/licenses/GPL-3.0 GNU General Public License 3.0
* @link https://github.com/jublonet/codebird-php * @link https://github.com/jublonet/codebird-php
*/ */
@ -40,6 +40,7 @@ unset($id);
* *
* @package codebird * @package codebird
* @subpackage codebird-php * @subpackage codebird-php
* @method bool curl_setopt (resource $ch, int $option, mixed $value)
*/ */
class Codebird class Codebird
{ {
@ -68,16 +69,15 @@ class Codebird
*/ */
protected static $_endpoints = [ protected static $_endpoints = [
'ads' => [ 'ads' => [
'production' => 'https://ads-api.twitter.com/0/', 'production' => 'https://ads-api.twitter.com/2/',
'sandbox' => 'https://ads-api-sandbox.twitter.com/0/' 'sandbox' => 'https://ads-api-sandbox.twitter.com/2/'
], ],
'media' => 'https://upload.twitter.com/1.1/', 'media' => 'https://upload.twitter.com/1.1/',
'publish' => 'https://publish.twitter.com/',
'oauth' => 'https://api.twitter.com/', 'oauth' => 'https://api.twitter.com/',
'rest' => 'https://api.twitter.com/1.1/', 'rest' => 'https://api.twitter.com/1.1/',
'streaming' => [ 'streaming' => [
'public' => 'https://stream.twitter.com/1.1/', 'public' => 'https://stream.twitter.com/1.1/'
'user' => 'https://userstream.twitter.com/1.1/',
'site' => 'https://sitestream.twitter.com/1.1/'
], ],
'ton' => 'https://ton.twitter.com/1.1/' 'ton' => 'https://ton.twitter.com/1.1/'
]; ];
@ -89,6 +89,14 @@ class Codebird
'GET' => [ 'GET' => [
'account/settings', 'account/settings',
'account/verify_credentials', 'account/verify_credentials',
'account_activity/all/:env_name/subscriptions',
'account_activity/all/:env_name/subscriptions/list',
'account_activity/all/:env_name/webhooks',
'account_activity/all/webhooks',
'account_activity/subscriptions/count',
'account_activity/webhooks',
'account_activity/webhooks/:webhook_id/subscriptions/all',
'account_activity/webhooks/:webhook_id/subscriptions/all/list',
'ads/accounts', 'ads/accounts',
'ads/accounts/:account_id', 'ads/accounts/:account_id',
'ads/accounts/:account_id/account_media', 'ads/accounts/:account_id/account_media',
@ -97,6 +105,7 @@ class Codebird
'ads/accounts/:account_id/app_event_tags', 'ads/accounts/:account_id/app_event_tags',
'ads/accounts/:account_id/app_event_tags/:id', 'ads/accounts/:account_id/app_event_tags/:id',
'ads/accounts/:account_id/app_lists', 'ads/accounts/:account_id/app_lists',
'ads/accounts/:account_id/auction_insights',
'ads/accounts/:account_id/authenticated_user_access', 'ads/accounts/:account_id/authenticated_user_access',
'ads/accounts/:account_id/campaigns', 'ads/accounts/:account_id/campaigns',
'ads/accounts/:account_id/campaigns/:campaign_id', 'ads/accounts/:account_id/campaigns/:campaign_id',
@ -121,15 +130,20 @@ class Codebird
'ads/accounts/:account_id/line_items/:line_item_id', 'ads/accounts/:account_id/line_items/:line_item_id',
'ads/accounts/:account_id/media_creatives', 'ads/accounts/:account_id/media_creatives',
'ads/accounts/:account_id/media_creatives/:id', 'ads/accounts/:account_id/media_creatives/:id',
'ads/accounts/:account_id/preroll_call_to_actions',
'ads/accounts/:account_id/preroll_call_to_actions/:preroll_call_to_action_id',
'ads/accounts/:account_id/promotable_users', 'ads/accounts/:account_id/promotable_users',
'ads/accounts/:account_id/promoted_accounts', 'ads/accounts/:account_id/promoted_accounts',
'ads/accounts/:account_id/promoted_tweets', 'ads/accounts/:account_id/promoted_tweets',
'ads/accounts/:account_id/reach_estimate', 'ads/accounts/:account_id/reach_estimate',
'ads/accounts/:account_id/recommendations',
'ads/accounts/:account_id/recommendations/:recommendation_id',
'ads/accounts/:account_id/scoped_timeline', 'ads/accounts/:account_id/scoped_timeline',
'ads/accounts/:account_id/tailored_audience_changes', 'ads/accounts/:account_id/tailored_audience_changes',
'ads/accounts/:account_id/tailored_audience_changes/:id', 'ads/accounts/:account_id/tailored_audience_changes/:id',
'ads/accounts/:account_id/tailored_audiences', 'ads/accounts/:account_id/tailored_audiences',
'ads/accounts/:account_id/tailored_audiences/:id', 'ads/accounts/:account_id/tailored_audiences/:id',
'ads/accounts/:account_id/tailored_audiences/:id/permissions',
'ads/accounts/:account_id/targeting_criteria', 'ads/accounts/:account_id/targeting_criteria',
'ads/accounts/:account_id/targeting_criteria/:id', 'ads/accounts/:account_id/targeting_criteria/:id',
'ads/accounts/:account_id/targeting_suggestions', 'ads/accounts/:account_id/targeting_suggestions',
@ -140,6 +154,7 @@ class Codebird
'ads/accounts/:account_id/web_event_tags', 'ads/accounts/:account_id/web_event_tags',
'ads/accounts/:account_id/web_event_tags/:web_event_tag_id', 'ads/accounts/:account_id/web_event_tags/:web_event_tag_id',
'ads/bidding_rules', 'ads/bidding_rules',
'ads/conversion_attribution',
'ads/iab_categories', 'ads/iab_categories',
'ads/insights/accounts/:account_id', 'ads/insights/accounts/:account_id',
'ads/insights/accounts/:account_id/available_audiences', 'ads/insights/accounts/:account_id/available_audiences',
@ -153,6 +168,7 @@ class Codebird
'ads/sandbox/accounts/:account_id/app_event_tags', 'ads/sandbox/accounts/:account_id/app_event_tags',
'ads/sandbox/accounts/:account_id/app_event_tags/:id', 'ads/sandbox/accounts/:account_id/app_event_tags/:id',
'ads/sandbox/accounts/:account_id/app_lists', 'ads/sandbox/accounts/:account_id/app_lists',
'ads/sandbox/accounts/:account_id/auction_insights',
'ads/sandbox/accounts/:account_id/authenticated_user_access', 'ads/sandbox/accounts/:account_id/authenticated_user_access',
'ads/sandbox/accounts/:account_id/campaigns', 'ads/sandbox/accounts/:account_id/campaigns',
'ads/sandbox/accounts/:account_id/campaigns/:campaign_id', 'ads/sandbox/accounts/:account_id/campaigns/:campaign_id',
@ -177,15 +193,20 @@ class Codebird
'ads/sandbox/accounts/:account_id/line_items/:line_item_id', 'ads/sandbox/accounts/:account_id/line_items/:line_item_id',
'ads/sandbox/accounts/:account_id/media_creatives', 'ads/sandbox/accounts/:account_id/media_creatives',
'ads/sandbox/accounts/:account_id/media_creatives/:id', 'ads/sandbox/accounts/:account_id/media_creatives/:id',
'ads/sandbox/accounts/:account_id/preroll_call_to_actions',
'ads/sandbox/accounts/:account_id/preroll_call_to_actions/:preroll_call_to_action_id',
'ads/sandbox/accounts/:account_id/promotable_users', 'ads/sandbox/accounts/:account_id/promotable_users',
'ads/sandbox/accounts/:account_id/promoted_accounts', 'ads/sandbox/accounts/:account_id/promoted_accounts',
'ads/sandbox/accounts/:account_id/promoted_tweets', 'ads/sandbox/accounts/:account_id/promoted_tweets',
'ads/sandbox/accounts/:account_id/reach_estimate', 'ads/sandbox/accounts/:account_id/reach_estimate',
'ads/sandbox/accounts/:account_id/recommendations',
'ads/sandbox/accounts/:account_id/recommendations/:recommendation_id',
'ads/sandbox/accounts/:account_id/scoped_timeline', 'ads/sandbox/accounts/:account_id/scoped_timeline',
'ads/sandbox/accounts/:account_id/tailored_audience_changes', 'ads/sandbox/accounts/:account_id/tailored_audience_changes',
'ads/sandbox/accounts/:account_id/tailored_audience_changes/:id', 'ads/sandbox/accounts/:account_id/tailored_audience_changes/:id',
'ads/sandbox/accounts/:account_id/tailored_audiences', 'ads/sandbox/accounts/:account_id/tailored_audiences',
'ads/sandbox/accounts/:account_id/tailored_audiences/:id', 'ads/sandbox/accounts/:account_id/tailored_audiences/:id',
'ads/sandbox/accounts/:account_id/tailored_audiences/:id/permissions',
'ads/sandbox/accounts/:account_id/targeting_criteria', 'ads/sandbox/accounts/:account_id/targeting_criteria',
'ads/sandbox/accounts/:account_id/targeting_criteria/:id', 'ads/sandbox/accounts/:account_id/targeting_criteria/:id',
'ads/sandbox/accounts/:account_id/targeting_suggestions', 'ads/sandbox/accounts/:account_id/targeting_suggestions',
@ -196,23 +217,15 @@ class Codebird
'ads/sandbox/accounts/:account_id/web_event_tags', 'ads/sandbox/accounts/:account_id/web_event_tags',
'ads/sandbox/accounts/:account_id/web_event_tags/:web_event_tag_id', 'ads/sandbox/accounts/:account_id/web_event_tags/:web_event_tag_id',
'ads/sandbox/bidding_rules', 'ads/sandbox/bidding_rules',
'ads/sandbox/conversion_attribution',
'ads/sandbox/iab_categories', 'ads/sandbox/iab_categories',
'ads/sandbox/insights/accounts/:account_id', 'ads/sandbox/insights/accounts/:account_id',
'ads/sandbox/insights/accounts/:account_id/available_audiences', 'ads/sandbox/insights/accounts/:account_id/available_audiences',
'ads/sandbox/insights/keywords/search', 'ads/sandbox/insights/keywords/search',
'ads/sandbox/line_items/placements', 'ads/sandbox/line_items/placements',
'ads/sandbox/stats/accounts/:account_id', 'ads/sandbox/stats/accounts/:account_id',
'ads/sandbox/stats/accounts/:account_id/campaigns',
'ads/sandbox/stats/accounts/:account_id/campaigns/:id',
'ads/sandbox/stats/accounts/:account_id/funding_instruments',
'ads/sandbox/stats/accounts/:account_id/funding_instruments/:id',
'ads/sandbox/stats/accounts/:account_id/line_items',
'ads/sandbox/stats/accounts/:account_id/line_items/:id',
'ads/sandbox/stats/accounts/:account_id/promoted_accounts',
'ads/sandbox/stats/accounts/:account_id/promoted_accounts/:id',
'ads/sandbox/stats/accounts/:account_id/promoted_tweets',
'ads/sandbox/stats/accounts/:account_id/promoted_tweets/:id',
'ads/sandbox/stats/accounts/:account_id/reach/campaigns', 'ads/sandbox/stats/accounts/:account_id/reach/campaigns',
'ads/sandbox/stats/accounts/:account_id/reach/funding_instruments',
'ads/sandbox/targeting_criteria/app_store_categories', 'ads/sandbox/targeting_criteria/app_store_categories',
'ads/sandbox/targeting_criteria/behavior_taxonomies', 'ads/sandbox/targeting_criteria/behavior_taxonomies',
'ads/sandbox/targeting_criteria/behaviors', 'ads/sandbox/targeting_criteria/behaviors',
@ -229,17 +242,8 @@ class Codebird
'ads/sandbox/targeting_criteria/tv_markets', 'ads/sandbox/targeting_criteria/tv_markets',
'ads/sandbox/targeting_criteria/tv_shows', 'ads/sandbox/targeting_criteria/tv_shows',
'ads/stats/accounts/:account_id', 'ads/stats/accounts/:account_id',
'ads/stats/accounts/:account_id/campaigns',
'ads/stats/accounts/:account_id/campaigns/:id',
'ads/stats/accounts/:account_id/funding_instruments',
'ads/stats/accounts/:account_id/funding_instruments/:id',
'ads/stats/accounts/:account_id/line_items',
'ads/stats/accounts/:account_id/line_items/:id',
'ads/stats/accounts/:account_id/promoted_accounts',
'ads/stats/accounts/:account_id/promoted_accounts/:id',
'ads/stats/accounts/:account_id/promoted_tweets',
'ads/stats/accounts/:account_id/promoted_tweets/:id',
'ads/stats/accounts/:account_id/reach/campaigns', 'ads/stats/accounts/:account_id/reach/campaigns',
'ads/stats/accounts/:account_id/reach/funding_instruments',
'ads/targeting_criteria/app_store_categories', 'ads/targeting_criteria/app_store_categories',
'ads/targeting_criteria/behavior_taxonomies', 'ads/targeting_criteria/behavior_taxonomies',
'ads/targeting_criteria/behaviors', 'ads/targeting_criteria/behaviors',
@ -261,24 +265,29 @@ class Codebird
'collections/entries', 'collections/entries',
'collections/list', 'collections/list',
'collections/show', 'collections/show',
'direct_messages', 'custom_profiles/:id',
'direct_messages/sent', 'custom_profiles/list',
'direct_messages/show', 'direct_messages/events/list',
'direct_messages/events/show',
'direct_messages/welcome_messages/list',
'direct_messages/welcome_messages/rules/list',
'direct_messages/welcome_messages/rules/show',
'direct_messages/welcome_messages/show',
'favorites/list', 'favorites/list',
'feedback/events',
'feedback/show/:id',
'followers/ids', 'followers/ids',
'followers/list', 'followers/list',
'friends/ids', 'friends/ids',
'friends/list', 'friends/list',
'friendships/incoming', 'friendships/incoming',
'friendships/lookup', 'friendships/lookup',
'friendships/lookup',
'friendships/no_retweets/ids', 'friendships/no_retweets/ids',
'friendships/outgoing', 'friendships/outgoing',
'friendships/show', 'friendships/show',
'geo/id/:place_id', 'geo/id/:place_id',
'geo/reverse_geocode', 'geo/reverse_geocode',
'geo/search', 'geo/search',
'geo/similar_places',
'help/configuration', 'help/configuration',
'help/languages', 'help/languages',
'help/privacy', 'help/privacy',
@ -300,7 +309,6 @@ class Codebird
'saved_searches/list', 'saved_searches/list',
'saved_searches/show/:id', 'saved_searches/show/:id',
'search/tweets', 'search/tweets',
'site',
'statuses/firehose', 'statuses/firehose',
'statuses/home_timeline', 'statuses/home_timeline',
'statuses/mentions_timeline', 'statuses/mentions_timeline',
@ -314,9 +322,6 @@ class Codebird
'trends/available', 'trends/available',
'trends/closest', 'trends/closest',
'trends/place', 'trends/place',
'user',
'users/contributees',
'users/contributors',
'users/profile_banner', 'users/profile_banner',
'users/search', 'users/search',
'users/show', 'users/show',
@ -327,12 +332,13 @@ class Codebird
'POST' => [ 'POST' => [
'account/remove_profile_banner', 'account/remove_profile_banner',
'account/settings', 'account/settings',
'account/update_delivery_device',
'account/update_profile', 'account/update_profile',
'account/update_profile_background_image',
'account/update_profile_banner', 'account/update_profile_banner',
'account/update_profile_colors',
'account/update_profile_image', 'account/update_profile_image',
'account_activity/all/:env_name/subscriptions',
'account_activity/all/:env_name/webhooks',
'account_activity/webhooks',
'account_activity/webhooks/:webhook_id/subscriptions/all',
'ads/accounts/:account_id/account_media', 'ads/accounts/:account_id/account_media',
'ads/accounts/:account_id/app_lists', 'ads/accounts/:account_id/app_lists',
'ads/accounts/:account_id/campaigns', 'ads/accounts/:account_id/campaigns',
@ -349,6 +355,7 @@ class Codebird
'ads/accounts/:account_id/promoted_tweets', 'ads/accounts/:account_id/promoted_tweets',
'ads/accounts/:account_id/tailored_audience_changes', 'ads/accounts/:account_id/tailored_audience_changes',
'ads/accounts/:account_id/tailored_audiences', 'ads/accounts/:account_id/tailored_audiences',
'ads/accounts/:account_id/tailored_audiences/:id/permissions',
'ads/accounts/:account_id/targeting_criteria', 'ads/accounts/:account_id/targeting_criteria',
'ads/accounts/:account_id/tweet', 'ads/accounts/:account_id/tweet',
'ads/accounts/:account_id/videos', 'ads/accounts/:account_id/videos',
@ -357,6 +364,8 @@ class Codebird
'ads/batch/accounts/:account_id/line_items', 'ads/batch/accounts/:account_id/line_items',
'ads/batch/accounts/:account_id/tailored_audiences', 'ads/batch/accounts/:account_id/tailored_audiences',
'ads/batch/accounts/:account_id/targeting_criteria', 'ads/batch/accounts/:account_id/targeting_criteria',
'ads/conversion_event',
'ads/sandbox/accounts',
'ads/sandbox/accounts/:account_id/account_media', 'ads/sandbox/accounts/:account_id/account_media',
'ads/sandbox/accounts/:account_id/app_lists', 'ads/sandbox/accounts/:account_id/app_lists',
'ads/sandbox/accounts/:account_id/campaigns', 'ads/sandbox/accounts/:account_id/campaigns',
@ -367,12 +376,15 @@ class Codebird
'ads/sandbox/accounts/:account_id/cards/video_app_download', 'ads/sandbox/accounts/:account_id/cards/video_app_download',
'ads/sandbox/accounts/:account_id/cards/video_conversation', 'ads/sandbox/accounts/:account_id/cards/video_conversation',
'ads/sandbox/accounts/:account_id/cards/website', 'ads/sandbox/accounts/:account_id/cards/website',
'ads/sandbox/accounts/:account_id/features',
'ads/sandbox/accounts/:account_id/funding_instruments',
'ads/sandbox/accounts/:account_id/line_items', 'ads/sandbox/accounts/:account_id/line_items',
'ads/sandbox/accounts/:account_id/media_creatives', 'ads/sandbox/accounts/:account_id/media_creatives',
'ads/sandbox/accounts/:account_id/promoted_accounts', 'ads/sandbox/accounts/:account_id/promoted_accounts',
'ads/sandbox/accounts/:account_id/promoted_tweets', 'ads/sandbox/accounts/:account_id/promoted_tweets',
'ads/sandbox/accounts/:account_id/tailored_audience_changes', 'ads/sandbox/accounts/:account_id/tailored_audience_changes',
'ads/sandbox/accounts/:account_id/tailored_audiences', 'ads/sandbox/accounts/:account_id/tailored_audiences',
'ads/sandbox/accounts/:account_id/tailored_audiences/:id/permissions',
'ads/sandbox/accounts/:account_id/targeting_criteria', 'ads/sandbox/accounts/:account_id/targeting_criteria',
'ads/sandbox/accounts/:account_id/tweet', 'ads/sandbox/accounts/:account_id/tweet',
'ads/sandbox/accounts/:account_id/videos', 'ads/sandbox/accounts/:account_id/videos',
@ -381,6 +393,11 @@ class Codebird
'ads/sandbox/batch/accounts/:account_id/line_items', 'ads/sandbox/batch/accounts/:account_id/line_items',
'ads/sandbox/batch/accounts/:account_id/tailored_audiences', 'ads/sandbox/batch/accounts/:account_id/tailored_audiences',
'ads/sandbox/batch/accounts/:account_id/targeting_criteria', 'ads/sandbox/batch/accounts/:account_id/targeting_criteria',
'ads/sandbox/conversion_event',
'ads/sandbox/stats/jobs/accounts/:account_id',
'ads/sandbox/tailored_audience_memberships',
'ads/stats/jobs/accounts/:account_id',
'ads/tailored_audience_memberships',
'blocks/create', 'blocks/create',
'blocks/destroy', 'blocks/destroy',
'collections/create', 'collections/create',
@ -390,10 +407,15 @@ class Codebird
'collections/entries/move', 'collections/entries/move',
'collections/entries/remove', 'collections/entries/remove',
'collections/update', 'collections/update',
'direct_messages/destroy', 'custom_profiles/new',
'direct_messages/new', 'direct_messages/events/new',
'direct_messages/indicate_typing',
'direct_messages/mark_read',
'direct_messages/welcome_messages/new',
'direct_messages/welcome_messages/rules/new',
'favorites/create', 'favorites/create',
'favorites/destroy', 'favorites/destroy',
'feedback/create',
'friendships/create', 'friendships/create',
'friendships/destroy', 'friendships/destroy',
'friendships/update', 'friendships/update',
@ -406,6 +428,7 @@ class Codebird
'lists/subscribers/create', 'lists/subscribers/create',
'lists/subscribers/destroy', 'lists/subscribers/destroy',
'lists/update', 'lists/update',
'media/metadata/create',
'media/upload', 'media/upload',
'mutes/users/create', 'mutes/users/create',
'mutes/users/destroy', 'mutes/users/destroy',
@ -421,13 +444,18 @@ class Codebird
'statuses/retweet/:id', 'statuses/retweet/:id',
'statuses/unretweet/:id', 'statuses/unretweet/:id',
'statuses/update', 'statuses/update',
'statuses/update_with_media', // deprecated, use media/upload
'ton/bucket/:bucket', 'ton/bucket/:bucket',
'ton/bucket/:bucket?resumable=true', 'ton/bucket/:bucket?resumable=true',
'tweets/search/30day/:env',
'tweets/search/30day/:env/counts',
'tweets/search/fullarchive/:env',
'tweets/search/fullarchive/:env/counts',
'users/lookup', 'users/lookup',
'users/report_spam' 'users/report_spam'
], ],
'PUT' => [ 'PUT' => [
'account_activity/all/:env_name/webhooks/:webhook_id',
'account_activity/webhooks/:webhook_id',
'ads/accounts/:account_id/campaigns/:campaign_id', 'ads/accounts/:account_id/campaigns/:campaign_id',
'ads/accounts/:account_id/cards/app_download/:card_id', 'ads/accounts/:account_id/cards/app_download/:card_id',
'ads/accounts/:account_id/cards/image_app_download/:card_id', 'ads/accounts/:account_id/cards/image_app_download/:card_id',
@ -437,6 +465,7 @@ class Codebird
'ads/accounts/:account_id/cards/video_conversation/:card_id', 'ads/accounts/:account_id/cards/video_conversation/:card_id',
'ads/accounts/:account_id/cards/website/:card_id', 'ads/accounts/:account_id/cards/website/:card_id',
'ads/accounts/:account_id/line_items/:line_item_id', 'ads/accounts/:account_id/line_items/:line_item_id',
'ads/accounts/:account_id/preroll_call_to_actions/:preroll_call_to_action_id',
'ads/accounts/:account_id/promoted_tweets/:id', 'ads/accounts/:account_id/promoted_tweets/:id',
'ads/accounts/:account_id/tailored_audiences/global_opt_out', 'ads/accounts/:account_id/tailored_audiences/global_opt_out',
'ads/accounts/:account_id/targeting_criteria', 'ads/accounts/:account_id/targeting_criteria',
@ -451,14 +480,20 @@ class Codebird
'ads/sandbox/accounts/:account_id/cards/video_conversation/:card_id', 'ads/sandbox/accounts/:account_id/cards/video_conversation/:card_id',
'ads/sandbox/accounts/:account_id/cards/website/:card_id', 'ads/sandbox/accounts/:account_id/cards/website/:card_id',
'ads/sandbox/accounts/:account_id/line_items/:line_item_id', 'ads/sandbox/accounts/:account_id/line_items/:line_item_id',
'ads/sandbox/accounts/:account_id/preroll_call_to_actions/:preroll_call_to_action_id',
'ads/sandbox/accounts/:account_id/promoted_tweets/:id', 'ads/sandbox/accounts/:account_id/promoted_tweets/:id',
'ads/sandbox/accounts/:account_id/tailored_audiences/global_opt_out', 'ads/sandbox/accounts/:account_id/tailored_audiences/global_opt_out',
'ads/sandbox/accounts/:account_id/targeting_criteria', 'ads/sandbox/accounts/:account_id/targeting_criteria',
'ads/sandbox/accounts/:account_id/videos/:id', 'ads/sandbox/accounts/:account_id/videos/:id',
'ads/sandbox/accounts/:account_id/web_event_tags/:web_event_tag_id', 'ads/sandbox/accounts/:account_id/web_event_tags/:web_event_tag_id',
'direct_messages/welcome_messages/update',
'ton/bucket/:bucket/:file?resumable=true&resumeId=:resumeId' 'ton/bucket/:bucket/:file?resumable=true&resumeId=:resumeId'
], ],
'DELETE' => [ 'DELETE' => [
'account_activity/all/:env_name/subscriptions',
'account_activity/all/:env_name/webhooks/:webhook_id',
'account_activity/webhooks/:webhook_id',
'account_activity/webhooks/:webhook_id/subscriptions/all',
'ads/accounts/:account_id/campaigns/:campaign_id', 'ads/accounts/:account_id/campaigns/:campaign_id',
'ads/accounts/:account_id/cards/app_download/:card_id', 'ads/accounts/:account_id/cards/app_download/:card_id',
'ads/accounts/:account_id/cards/image_app_download/:card_id', 'ads/accounts/:account_id/cards/image_app_download/:card_id',
@ -469,6 +504,7 @@ class Codebird
'ads/accounts/:account_id/cards/website/:card_id', 'ads/accounts/:account_id/cards/website/:card_id',
'ads/accounts/:account_id/line_items/:line_item_id', 'ads/accounts/:account_id/line_items/:line_item_id',
'ads/accounts/:account_id/media_creatives/:id', 'ads/accounts/:account_id/media_creatives/:id',
'ads/accounts/:account_id/preroll_call_to_actions/:preroll_call_to_action_id',
'ads/accounts/:account_id/promoted_tweets/:id', 'ads/accounts/:account_id/promoted_tweets/:id',
'ads/accounts/:account_id/tailored_audiences/:id', 'ads/accounts/:account_id/tailored_audiences/:id',
'ads/accounts/:account_id/targeting_criteria/:id', 'ads/accounts/:account_id/targeting_criteria/:id',
@ -484,11 +520,16 @@ class Codebird
'ads/sandbox/accounts/:account_id/cards/website/:card_id', 'ads/sandbox/accounts/:account_id/cards/website/:card_id',
'ads/sandbox/accounts/:account_id/line_items/:line_item_id', 'ads/sandbox/accounts/:account_id/line_items/:line_item_id',
'ads/sandbox/accounts/:account_id/media_creatives/:id', 'ads/sandbox/accounts/:account_id/media_creatives/:id',
'ads/sandbox/accounts/:account_id/preroll_call_to_actions/:preroll_call_to_action_id',
'ads/sandbox/accounts/:account_id/promoted_tweets/:id', 'ads/sandbox/accounts/:account_id/promoted_tweets/:id',
'ads/sandbox/accounts/:account_id/tailored_audiences/:id', 'ads/sandbox/accounts/:account_id/tailored_audiences/:id',
'ads/sandbox/accounts/:account_id/targeting_criteria/:id', 'ads/sandbox/accounts/:account_id/targeting_criteria/:id',
'ads/sandbox/accounts/:account_id/videos/:id', 'ads/sandbox/accounts/:account_id/videos/:id',
'ads/sandbox/accounts/:account_id/web_event_tags/:web_event_tag_id' 'ads/sandbox/accounts/:account_id/web_event_tags/:web_event_tag_id',
'custom_profiles/destroy',
'direct_messages/events/destroy',
'direct_messages/welcome_messages/destroy',
'direct_messages/welcome_messages/rules/destroy'
] ]
]; ];
@ -497,10 +538,8 @@ class Codebird
*/ */
protected static $_possible_files = [ protected static $_possible_files = [
// Tweets // Tweets
'statuses/update_with_media' => ['media[]'],
'media/upload' => ['media'], 'media/upload' => ['media'],
// Accounts // Accounts
'account/update_profile_background_image' => ['image'],
'account/update_profile_image' => ['image'], 'account/update_profile_image' => ['image'],
'account/update_profile_banner' => ['banner'] 'account/update_profile_banner' => ['banner']
]; ];
@ -508,7 +547,7 @@ class Codebird
/** /**
* The current Codebird version * The current Codebird version
*/ */
protected static $_version = '3.1.0'; protected static $_version = '4.0.0-beta.1';
/** /**
* The Request or access token. Used to sign requests * The Request or access token. Used to sign requests
@ -1035,7 +1074,7 @@ class Codebird
throw new \Exception('To get the ' . $type . ' URL, use the correct third parameter, or omit it.'); throw new \Exception('To get the ' . $type . ' URL, use the correct third parameter, or omit it.');
} }
if ($this->_oauth_token === null) { if ($this->_oauth_token === null) {
throw new \Exception('To get the ' . $type . ' URL, the OAuth token must be set.'); throw new CodebirdCredentialsException('To get the ' . $type . ' URL, the OAuth token must be set.');
} }
$url = self::$_endpoints['oauth'] . 'oauth/' . $type . '?oauth_token=' . $this->_url($this->_oauth_token); $url = self::$_endpoints['oauth'] . 'oauth/' . $type . '?oauth_token=' . $this->_url($this->_oauth_token);
if ($force_login) { if ($force_login) {
@ -1230,7 +1269,7 @@ class Codebird
protected function _oauth2TokenCurl() protected function _oauth2TokenCurl()
{ {
if (self::$_consumer_key === null) { if (self::$_consumer_key === null) {
throw new \Exception('To obtain a bearer token, the consumer key must be set.'); throw new CodebirdCredentialsException('To obtain a bearer token, the consumer key must be set.');
} }
$post_fields = [ $post_fields = [
'grant_type' => 'client_credentials' 'grant_type' => 'client_credentials'
@ -1248,7 +1287,7 @@ class Codebird
// catch request errors // catch request errors
if ($result === false) { if ($result === false) {
throw new \Exception('Request error for bearer token: ' . $this->_curl_error($connection)); throw new CodebirdAuthException('Request error for bearer token: ' . $this->_curl_error($connection));
} }
// certificate validation results // certificate validation results
@ -1270,14 +1309,14 @@ class Codebird
protected function _oauth2TokenNoCurl() protected function _oauth2TokenNoCurl()
{ {
if (self::$_consumer_key == null) { if (self::$_consumer_key == null) {
throw new \Exception('To obtain a bearer token, the consumer key must be set.'); throw new CodebirdCredentialsException('To obtain a bearer token, the consumer key must be set.');
} }
$url = self::$_endpoints['oauth'] . 'oauth2/token'; $url = self::$_endpoints['oauth'] . 'oauth2/token';
$hostname = parse_url($url, PHP_URL_HOST); $hostname = parse_url($url, PHP_URL_HOST);
if ($hostname === false) { if ($hostname === false) {
throw new \Exception('Incorrect API endpoint host.'); throw new CodebirdEndpointException('Incorrect API endpoint host.');
} }
$contextOptions = [ $contextOptions = [
@ -1469,7 +1508,7 @@ class Codebird
protected function _sha1($data) protected function _sha1($data)
{ {
if (self::$_consumer_secret === null) { if (self::$_consumer_secret === null) {
throw new \Exception('To generate a hash, the consumer secret must be set.'); throw new CodebirdCredentialsException('To generate a hash, the consumer secret must be set.');
} }
if (!function_exists('hash_hmac')) { if (!function_exists('hash_hmac')) {
throw new \Exception('To generate a hash, the PHP hash extension must be available.'); throw new \Exception('To generate a hash, the PHP hash extension must be available.');
@ -1544,7 +1583,7 @@ class Codebird
protected function _sign($httpmethod, $method, $params = []) protected function _sign($httpmethod, $method, $params = [])
{ {
if (self::$_consumer_key === null) { if (self::$_consumer_key === null) {
throw new \Exception('To generate a signature, the consumer key must be set.'); throw new CodebirdCredentialsException('To generate a signature, the consumer key must be set.');
} }
$sign_base_params = array_map( $sign_base_params = array_map(
[$this, '_url'], [$this, '_url'],
@ -1634,6 +1673,10 @@ class Codebird
'ads/sandbox/accounts/:account_id/tailored_audiences', 'ads/sandbox/accounts/:account_id/tailored_audiences',
'ads/sandbox/accounts/:account_id/web_event_tags' 'ads/sandbox/accounts/:account_id/web_event_tags'
], ],
'permission_level' => [
'ads/accounts/:account_id/tailored_audiences/:id/permissions',
'ads/sandbox/accounts/:account_id/tailored_audiences/:id/permissions'
],
'tailored_audience_id' => [ 'tailored_audience_id' => [
'ads/accounts/:account_id/tailored_audience_changes', 'ads/accounts/:account_id/tailored_audience_changes',
'ads/sandbox/accounts/:account_id/tailored_audience_changes' 'ads/sandbox/accounts/:account_id/tailored_audience_changes'
@ -1646,6 +1689,13 @@ class Codebird
'ads/accounts/:account_id/promoted_tweets', 'ads/accounts/:account_id/promoted_tweets',
'ads/sandbox/accounts/:account_id/promoted_tweets' 'ads/sandbox/accounts/:account_id/promoted_tweets'
], ],
'type' => [
'ads/sandbox/accounts/:account_id/features',
'ads/sandbox/accounts/:account_id/funding_instruments'
],
'url' => [
'account_activity/webhooks'
],
'user_id' => [ 'user_id' => [
'ads/accounts/:account_id/promoted_accounts', 'ads/accounts/:account_id/promoted_accounts',
'ads/sandbox/accounts/:account_id/promoted_accounts' 'ads/sandbox/accounts/:account_id/promoted_accounts'
@ -1674,6 +1724,14 @@ class Codebird
} }
} }
// async media/upload calls may request a status by GET
if ($method === 'media/upload'
&& isset($params['command'])
&& $params['command'] === 'STATUS'
) {
return 'GET';
}
// prefer POST and PUT if parameters are set // prefer POST and PUT if parameters are set
if (count($params) > 0) { if (count($params) > 0) {
if (in_array($method, $apimethods['POST'])) { if (in_array($method, $apimethods['POST'])) {
@ -1703,12 +1761,10 @@ class Codebird
{ {
$multiparts = [ $multiparts = [
// Tweets // Tweets
'statuses/update_with_media',
'media/upload', 'media/upload',
// Users // Users
// no multipart for these, for now: // no multipart for these, for now:
//'account/update_profile_background_image',
//'account/update_profile_image', //'account/update_profile_image',
//'account/update_profile_banner' //'account/update_profile_banner'
]; ];
@ -1731,7 +1787,7 @@ class Codebird
foreach ($params as $key => $value) { foreach ($params as $key => $value) {
// is it an array? // is it an array?
if (is_array($value)) { if (is_array($value)) {
throw new \Exception('Using URL-encoded parameters is not supported for uploading media.'); throw new CodebirdMediaException('Using URL-encoded parameters is not supported for uploading media.');
} }
$request .= $request .=
'--' . $border . "\r\n" '--' . $border . "\r\n"
@ -1862,7 +1918,7 @@ class Codebird
) { ) {
return $result; return $result;
} }
throw new \Exception('Downloading a remote media file failed.'); throw new CodebirdMediaException('Downloading a remote media file failed.');
return false; return false;
} }
// no cURL // no cURL
@ -1882,7 +1938,7 @@ class Codebird
) { ) {
return $result; return $result;
} }
throw new \Exception('Downloading a remote media file failed.'); throw new CodebirdMediaException('Downloading a remote media file failed.');
return false; return false;
} }
@ -1895,6 +1951,7 @@ class Codebird
*/ */
protected function _detectMedia($method) { protected function _detectMedia($method) {
$medias = [ $medias = [
'media/metadata/create',
'media/upload' 'media/upload'
]; ];
return in_array($method, $medias); return in_array($method, $medias);
@ -1903,15 +1960,31 @@ class Codebird
/** /**
* Detects if API call should use JSON body * Detects if API call should use JSON body
* *
* @param string $method The API method to call * @param string $method_template The API method to call
* *
* @return bool Whether the method is defined as accepting JSON body * @return bool Whether the method is defined as accepting JSON body
*/ */
protected function _detectJsonBody($method) { protected function _detectJsonBody($method_template) {
$json_bodies = [ $json_bodies = [
'collections/entries/curate' 'ads/batch/accounts/:account_id/campaigns',
'ads/batch/accounts/:account_id/line_items',
'ads/batch/accounts/:account_id/targeting_criteria',
'ads/sandbox/batch/accounts/:account_id/campaigns',
'ads/sandbox/batch/accounts/:account_id/line_items',
'ads/sandbox/batch/accounts/:account_id/targeting_criteria',
'collections/entries/curate',
'custom_profiles/new',
'direct_messages/events/new',
'direct_messages/indicate_typing',
'direct_messages/mark_read',
'direct_messages/welcome_messages/new',
'direct_messages/welcome_messages/rules/new',
'direct_messages/welcome_messages/update',
'media/metadata/create',
'tweets/search/30day/:env',
'tweets/search/fullarchive/:env'
]; ];
return in_array($method, $json_bodies); return in_array($method_template, $json_bodies);
} }
/** /**
@ -1941,11 +2014,8 @@ class Codebird
$streamings = [ $streamings = [
'public' => [ 'public' => [
'statuses/sample', 'statuses/sample',
'statuses/filter', 'statuses/filter'
'statuses/firehose' ]
],
'user' => ['user'],
'site' => ['site']
]; ];
foreach ($streamings as $key => $values) { foreach ($streamings as $key => $values) {
if (in_array($method, $values)) { if (in_array($method, $values)) {
@ -1971,6 +2041,8 @@ class Codebird
$url = self::$_endpoints['oauth'] . $method; $url = self::$_endpoints['oauth'] . $method;
} elseif ($this->_detectMedia($method_template)) { } elseif ($this->_detectMedia($method_template)) {
$url = self::$_endpoints['media'] . $method . '.json'; $url = self::$_endpoints['media'] . $method . '.json';
} elseif ($method_template === 'statuses/oembed') {
$url = self::$_endpoints['publish'] . 'oembed';
} elseif ($variant = $this->_detectStreaming($method_template)) { } elseif ($variant = $this->_detectStreaming($method_template)) {
$url = self::$_endpoints['streaming'][$variant] . $method . '.json'; $url = self::$_endpoints['streaming'][$variant] . $method . '.json';
} elseif ($this->_detectBinaryBody($method_template)) { } elseif ($this->_detectBinaryBody($method_template)) {
@ -2003,7 +2075,7 @@ class Codebird
&& $this->_oauth_token === null && $this->_oauth_token === null
&& substr($method, 0, 5) !== 'oauth' && substr($method, 0, 5) !== 'oauth'
) { ) {
throw new \Exception('To call this API, the OAuth access token must be set.'); throw new CodebirdCredentialsException('To call this API, the OAuth access token must be set.');
} }
// use separate API access for streaming API // use separate API access for streaming API
if ($this->_detectStreaming($method) !== false) { if ($this->_detectStreaming($method) !== false) {
@ -2102,7 +2174,7 @@ class Codebird
$hostname = parse_url($url, PHP_URL_HOST); $hostname = parse_url($url, PHP_URL_HOST);
if ($hostname === false) { if ($hostname === false) {
throw new \Exception('Incorrect API endpoint host.'); throw new CodebirdEndpointException('Incorrect API endpoint host.');
} }
$request_headers[] = 'Authorization: ' . $authorization; $request_headers[] = 'Authorization: ' . $authorization;
@ -2188,15 +2260,19 @@ class Codebird
$multipart_boundary = substr($params, 2, $first_newline - 2); $multipart_boundary = substr($params, 2, $first_newline - 2);
$request_headers[] = 'Content-Type: multipart/form-data; boundary=' $request_headers[] = 'Content-Type: multipart/form-data; boundary='
. $multipart_boundary; . $multipart_boundary;
} elseif ($this->_detectJsonBody($method)) { } elseif ($this->_detectJsonBody($method_template)) {
$authorization = $this->_sign($httpmethod, $url, []); $authorization = $this->_sign($httpmethod, $url, []);
$params = json_encode($params); $params = json_encode($params);
$request_headers[] = 'Content-Type: application/json'; $request_headers[] = 'Content-Type: application/json';
} elseif ($this->_detectBinaryBody($method_template)) { } elseif ($this->_detectBinaryBody($method_template)) {
// transform parametric headers to real headers // transform parametric headers to real headers
foreach ([ foreach ([
'Content-Type', 'X-TON-Content-Type', 'Content-Length',
'X-TON-Content-Length', 'Content-Range' 'Content-Range',
'Content-Type',
'X-TON-Content-Type',
'X-TON-Content-Length',
'X-TON-Expires'
] as $key) { ] as $key) {
if (isset($params[$key])) { if (isset($params[$key])) {
$request_headers[] = $key . ': ' . $params[$key]; $request_headers[] = $key . ': ' . $params[$key];
@ -2270,7 +2346,7 @@ class Codebird
if (self::$_consumer_key === null if (self::$_consumer_key === null
&& self::$_bearer_token === null && self::$_bearer_token === null
) { ) {
throw new \Exception('To make an app-only auth API request, consumer key or bearer token must be set.'); throw new CodebirdCredentialsException('To make an app-only auth API request, consumer key or bearer token must be set.');
} }
// automatically fetch bearer token, if necessary // automatically fetch bearer token, if necessary
if (self::$_bearer_token === null) { if (self::$_bearer_token === null) {
@ -2347,7 +2423,7 @@ class Codebird
$path = parse_url($url, PHP_URL_PATH); $path = parse_url($url, PHP_URL_PATH);
$query = parse_url($url, PHP_URL_QUERY); $query = parse_url($url, PHP_URL_QUERY);
if ($hostname === false) { if ($hostname === false) {
throw new \Exception('Incorrect API endpoint host.'); throw new CodebirdEndpointException('Incorrect API endpoint host.');
} }
$request_headers[] = 'Authorization: ' . $authorization; $request_headers[] = 'Authorization: ' . $authorization;
@ -2546,9 +2622,9 @@ class Codebird
*/ */
protected function _parseApiReplyPrefillHeaders($headers, $reply) protected function _parseApiReplyPrefillHeaders($headers, $reply)
{ {
if ($reply === '' && (isset($headers['Location']))) { if ($reply === '' && (isset($headers['Location']) || isset($headers['location']))) {
$reply = [ $reply = [
'Location' => $headers['Location'] 'Location' => isset($headers['Location']) ? $headers['Location'] : $headers['location']
]; ];
if (isset($headers['X-TON-Min-Chunk-Size'])) { if (isset($headers['X-TON-Min-Chunk-Size'])) {
$reply['X-TON-Min-Chunk-Size'] = $headers['X-TON-Min-Chunk-Size']; $reply['X-TON-Min-Chunk-Size'] = $headers['X-TON-Min-Chunk-Size'];
@ -2609,4 +2685,36 @@ class Codebird
} }
return $parsed; return $parsed;
} }
} }
/**
* Catch errors when authtoken is expired
*/
class CodebirdAuthException extends \Exception {
}
/**
* Catch error when credentials are not set correclty
*/
class CodebirdCredentialsException extends \Exception {
}
/**
* Catch errors r elated to bad endpoi ts
*/
class CodebirdEndpointException extends \Exception {
}
/*
* Catch errors relatedto media
*/
class CodebirdMediaException extends \Exception {
}

View File

@ -7,8 +7,8 @@ require_once ('test/codebirdt.php');
* A Twitter library in PHP. * A Twitter library in PHP.
* *
* @package codebird-test * @package codebird-test
* @author Jublo Solutions <support@jublo.net> * @author Jublo Limited <support@jublo.net>
* @copyright 2010-2016 Jublo Solutions <support@jublo.net> * @copyright 2010-2018 Jublo Limited <support@jublo.net>
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License 3.0 * @license https://opensource.org/licenses/GPL-3.0 GNU General Public License 3.0
* @link https://github.com/jublonet/codebird-php * @link https://github.com/jublonet/codebird-php
*/ */
@ -18,7 +18,7 @@ require_once ('test/codebirdt.php');
* *
* @package codebird-test * @package codebird-test
*/ */
class Constant_Test extends \PHPUnit_Framework_TestCase class Constant_Test extends \PHPUnit\Framework\TestCase
{ {
/** /**
* Tests if constants defined * Tests if constants defined

View File

@ -7,8 +7,8 @@ require_once ('test/codebirdm.php');
* A Twitter library in PHP. * A Twitter library in PHP.
* *
* @package codebird-test * @package codebird-test
* @author Jublo Solutions <support@jublo.net> * @author Jublo Limited <support@jublo.net>
* @copyright 2010-2016 Jublo Solutions <support@jublo.net> * @copyright 2010-2018 Jublo Limited <support@jublo.net>
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License 3.0 * @license https://opensource.org/licenses/GPL-3.0 GNU General Public License 3.0
* @link https://github.com/jublonet/codebird-php * @link https://github.com/jublonet/codebird-php
*/ */
@ -18,7 +18,7 @@ require_once ('test/codebirdm.php');
* *
* @package codebird-test * @package codebird-test
*/ */
class Curl_Test extends \PHPUnit_Framework_TestCase class Curl_Test extends \PHPUnit\Framework\TestCase
{ {
/** /**
* Initialise Codebird class * Initialise Codebird class

View File

@ -7,8 +7,8 @@ require_once ('test/codebirdm.php');
* A Twitter library in PHP. * A Twitter library in PHP.
* *
* @package codebird-test * @package codebird-test
* @author Jublo Solutions <support@jublo.net> * @author Jublo Limited <support@jublo.net>
* @copyright 2010-2016 Jublo Solutions <support@jublo.net> * @copyright 2010-2018 Jublo Limited <support@jublo.net>
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License 3.0 * @license https://opensource.org/licenses/GPL-3.0 GNU General Public License 3.0
* @link https://github.com/jublonet/codebird-php * @link https://github.com/jublonet/codebird-php
*/ */
@ -18,7 +18,7 @@ require_once ('test/codebirdm.php');
* *
* @package codebird-test * @package codebird-test
*/ */
class Detection_Test extends \PHPUnit_Framework_TestCase class Detection_Test extends \PHPUnit\Framework\TestCase
{ {
/** /**
* Initialise Codebird class * Initialise Codebird class
@ -60,8 +60,10 @@ class Detection_Test extends \PHPUnit_Framework_TestCase
// normal detection // normal detection
$params = []; $params = [];
$post = ['httpmethod' => 'POST'];
$this->assertEquals('GET', $cb->call('_detectMethod', 'search/tweets', $params)); $this->assertEquals('GET', $cb->call('_detectMethod', 'search/tweets', $params));
$this->assertEquals('POST', $cb->call('_detectMethod', 'statuses/update', $params)); $this->assertEquals('POST', $cb->call('_detectMethod', 'statuses/update', $params));
$this->assertEquals('POST', $cb->call('_detectMethod', 'ads/sandbox/accounts', $post));
$this->assertEquals( $this->assertEquals(
'PUT', 'PUT',
$cb->call( $cb->call(
@ -76,6 +78,11 @@ class Detection_Test extends \PHPUnit_Framework_TestCase
$params = ['test' => 12]; $params = ['test' => 12];
$this->assertEquals('POST', $cb->call('_detectMethod', 'account/settings', $params)); $this->assertEquals('POST', $cb->call('_detectMethod', 'account/settings', $params));
$params = [];
$this->assertEquals('POST', $cb->call('_detectMethod', 'media/upload', $params));
$params = ['command' => 'STATUS'];
$this->assertEquals('GET', $cb->call('_detectMethod', 'media/upload', $params));
$httpmethods_by_param = [ $httpmethods_by_param = [
'POST' => [ 'POST' => [
'campaign_id' => [ 'campaign_id' => [
@ -165,7 +172,6 @@ class Detection_Test extends \PHPUnit_Framework_TestCase
{ {
$cb = $this->getCB(); $cb = $this->getCB();
$this->assertFalse($cb->call('_detectMultipart', ['statuses/update'])); $this->assertFalse($cb->call('_detectMultipart', ['statuses/update']));
$this->assertTrue($cb->call('_detectMultipart', ['statuses/update_with_media']));
$this->assertTrue($cb->call('_detectMultipart', ['media/upload'])); $this->assertTrue($cb->call('_detectMultipart', ['media/upload']));
} }
@ -187,6 +193,7 @@ class Detection_Test extends \PHPUnit_Framework_TestCase
$cb = $this->getCB(); $cb = $this->getCB();
$this->assertFalse($cb->call('_detectJsonBody', ['statuses/update'])); $this->assertFalse($cb->call('_detectJsonBody', ['statuses/update']));
$this->assertTrue($cb->call('_detectJsonBody', ['collections/entries/curate'])); $this->assertTrue($cb->call('_detectJsonBody', ['collections/entries/curate']));
$this->assertTrue($cb->call('_detectJsonBody', ['ads/batch/accounts/:account_id/targeting_criteria']));
} }
/** /**
@ -213,9 +220,6 @@ class Detection_Test extends \PHPUnit_Framework_TestCase
$this->assertFalse($cb->call('_detectStreaming', ['statuses/update'])); $this->assertFalse($cb->call('_detectStreaming', ['statuses/update']));
$this->assertEquals('public', $cb->call('_detectStreaming', ['statuses/sample'])); $this->assertEquals('public', $cb->call('_detectStreaming', ['statuses/sample']));
$this->assertEquals('public', $cb->call('_detectStreaming', ['statuses/filter'])); $this->assertEquals('public', $cb->call('_detectStreaming', ['statuses/filter']));
$this->assertEquals('public', $cb->call('_detectStreaming', ['statuses/firehose']));
$this->assertEquals('user', $cb->call('_detectStreaming', ['user']));
$this->assertEquals('site', $cb->call('_detectStreaming', ['site']));
} }
/** /**
@ -244,28 +248,28 @@ class Detection_Test extends \PHPUnit_Framework_TestCase
$cb->call('_getEndpoint', ['media/upload', 'media/upload']), $cb->call('_getEndpoint', ['media/upload', 'media/upload']),
'media/upload' 'media/upload'
); );
$this->assertEquals(
'https://upload.twitter.com/1.1/media/metadata/create.json',
$cb->call('_getEndpoint', ['media/metadata/create', 'media/metadata/create']),
'media/metadata/create'
);
$this->assertEquals(
'https://publish.twitter.com/oembed',
$cb->call('_getEndpoint', ['statuses/oembed', 'statuses/oembed']),
'statuses/oembed'
);
$this->assertEquals( $this->assertEquals(
'https://stream.twitter.com/1.1/statuses/filter.json', 'https://stream.twitter.com/1.1/statuses/filter.json',
$cb->call('_getEndpoint', ['statuses/filter', 'statuses/filter']), $cb->call('_getEndpoint', ['statuses/filter', 'statuses/filter']),
'statuses/filter' 'statuses/filter'
); );
$this->assertEquals(
'https://sitestream.twitter.com/1.1/site.json',
$cb->call('_getEndpoint', ['site', 'site']),
'site'
);
$this->assertEquals(
'https://userstream.twitter.com/1.1/user.json',
$cb->call('_getEndpoint', ['user', 'user']),
'user'
);
$this->assertEquals( $this->assertEquals(
'https://ton.twitter.com/1.1/ton/bucket/ta_partner', 'https://ton.twitter.com/1.1/ton/bucket/ta_partner',
$cb->call('_getEndpoint', ['ton/bucket/ta_partner', 'ton/bucket/:bucket']), $cb->call('_getEndpoint', ['ton/bucket/ta_partner', 'ton/bucket/:bucket']),
'ton/bucket/:bucket' 'ton/bucket/:bucket'
); );
$this->assertEquals( $this->assertEquals(
'https://ads-api.twitter.com/0/accounts/1234/campaigns', 'https://ads-api.twitter.com/2/accounts/1234/campaigns',
$cb->call( $cb->call(
'_getEndpoint', '_getEndpoint',
['ads/accounts/1234/campaigns', 'ads/accounts/:account_id/campaigns'] ['ads/accounts/1234/campaigns', 'ads/accounts/:account_id/campaigns']
@ -273,7 +277,7 @@ class Detection_Test extends \PHPUnit_Framework_TestCase
'ads/accounts/:account_id/campaigns' 'ads/accounts/:account_id/campaigns'
); );
$this->assertEquals( $this->assertEquals(
'https://ads-api-sandbox.twitter.com/0/accounts/1234/campaigns', 'https://ads-api-sandbox.twitter.com/2/accounts/1234/campaigns',
$cb->call( $cb->call(
'_getEndpoint', '_getEndpoint',
['ads/sandbox/accounts/1234/campaigns', 'ads/sandbox/accounts/:account_id/campaigns'] ['ads/sandbox/accounts/1234/campaigns', 'ads/sandbox/accounts/:account_id/campaigns']

View File

@ -6,8 +6,8 @@ namespace Codebird;
* A Twitter library in PHP. * A Twitter library in PHP.
* *
* @package codebird-test * @package codebird-test
* @author Jublo Solutions <support@jublo.net> * @author Jublo Limited <support@jublo.net>
* @copyright 2010-2016 Jublo Solutions <support@jublo.net> * @copyright 2010-2018 Jublo Limited <support@jublo.net>
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License 3.0 * @license https://opensource.org/licenses/GPL-3.0 GNU General Public License 3.0
* @link https://github.com/jublonet/codebird-php * @link https://github.com/jublonet/codebird-php
*/ */
@ -17,7 +17,7 @@ namespace Codebird;
* *
* @package codebird-test * @package codebird-test
*/ */
class Environment_Test extends \PHPUnit_Framework_TestCase class Environment_Test extends \PHPUnit\Framework\TestCase
{ {
/** /**
* Tests PHP version * Tests PHP version
@ -25,8 +25,8 @@ class Environment_Test extends \PHPUnit_Framework_TestCase
public function testPhpVersion() public function testPhpVersion()
{ {
$this->assertTrue( $this->assertTrue(
version_compare('5.5', phpversion(), '<='), version_compare('7.1', phpversion(), '<='),
'Codebird requires PHP 5.5 or above' 'Codebird requires PHP 7.1 or above'
); );
} }

View File

@ -7,8 +7,8 @@ require_once ('test/codebirdm.php');
* A Twitter library in PHP. * A Twitter library in PHP.
* *
* @package codebird-test * @package codebird-test
* @author Jublo Solutions <support@jublo.net> * @author Jublo Limited <support@jublo.net>
* @copyright 2010-2016 Jublo Solutions <support@jublo.net> * @copyright 2010-2018 Jublo Limited <support@jublo.net>
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License 3.0 * @license https://opensource.org/licenses/GPL-3.0 GNU General Public License 3.0
* @link https://github.com/jublonet/codebird-php * @link https://github.com/jublonet/codebird-php
*/ */
@ -18,7 +18,7 @@ require_once ('test/codebirdm.php');
* *
* @package codebird-test * @package codebird-test
*/ */
class Media_Test extends \PHPUnit_Framework_TestCase class Media_Test extends \PHPUnit\Framework\TestCase
{ {
/** /**
* Initialise Codebird class * Initialise Codebird class

View File

@ -7,8 +7,8 @@ require_once ('test/codebirdm.php');
* A Twitter library in PHP. * A Twitter library in PHP.
* *
* @package codebird-test * @package codebird-test
* @author Jublo Solutions <support@jublo.net> * @author Jublo Limited <support@jublo.net>
* @copyright 2010-2016 Jublo Solutions <support@jublo.net> * @copyright 2010-2018 Jublo Limited <support@jublo.net>
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License 3.0 * @license https://opensource.org/licenses/GPL-3.0 GNU General Public License 3.0
* @link https://github.com/jublonet/codebird-php * @link https://github.com/jublonet/codebird-php
*/ */
@ -18,7 +18,7 @@ require_once ('test/codebirdm.php');
* *
* @package codebird-test * @package codebird-test
*/ */
class Oauth_Test extends \PHPUnit_Framework_TestCase class Oauth_Test extends \PHPUnit\Framework\TestCase
{ {
/** /**
* Initialise Codebird class * Initialise Codebird class

View File

@ -7,8 +7,8 @@ require_once ('test/codebirdm.php');
* A Twitter library in PHP. * A Twitter library in PHP.
* *
* @package codebird-test * @package codebird-test
* @author Jublo Solutions <support@jublo.net> * @author Jublo Limited <support@jublo.net>
* @copyright 2010-2016 Jublo Solutions <support@jublo.net> * @copyright 2010-2018 Jublo Limited <support@jublo.net>
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License 3.0 * @license https://opensource.org/licenses/GPL-3.0 GNU General Public License 3.0
* @link https://github.com/jublonet/codebird-php * @link https://github.com/jublonet/codebird-php
*/ */
@ -18,7 +18,7 @@ require_once ('test/codebirdm.php');
* *
* @package codebird-test * @package codebird-test
*/ */
class Replyparse_Test extends \PHPUnit_Framework_TestCase class Replyparse_Test extends \PHPUnit\Framework\TestCase
{ {
/** /**
* Initialise Codebird class * Initialise Codebird class

View File

@ -7,8 +7,8 @@ require_once ('test/codebirdm.php');
* A Twitter library in PHP. * A Twitter library in PHP.
* *
* @package codebird-test * @package codebird-test
* @author Jublo Solutions <support@jublo.net> * @author Jublo Limited <support@jublo.net>
* @copyright 2010-2016 Jublo Solutions <support@jublo.net> * @copyright 2010-2018 Jublo Limited <support@jublo.net>
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License 3.0 * @license https://opensource.org/licenses/GPL-3.0 GNU General Public License 3.0
* @link https://github.com/jublonet/codebird-php * @link https://github.com/jublonet/codebird-php
*/ */
@ -18,7 +18,7 @@ require_once ('test/codebirdm.php');
* *
* @package codebird-test * @package codebird-test
*/ */
class Requestparse_Test extends \PHPUnit_Framework_TestCase class Requestparse_Test extends \PHPUnit\Framework\TestCase
{ {
/** /**
* Initialise Codebird class * Initialise Codebird class

View File

@ -7,8 +7,8 @@ require_once ('test/codebirdm.php');
* A Twitter library in PHP. * A Twitter library in PHP.
* *
* @package codebird-test * @package codebird-test
* @author Jublo Solutions <support@jublo.net> * @author Jublo Limited <support@jublo.net>
* @copyright 2010-2016 Jublo Solutions <support@jublo.net> * @copyright 2010-2018 Jublo Limited <support@jublo.net>
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License 3.0 * @license https://opensource.org/licenses/GPL-3.0 GNU General Public License 3.0
* @link https://github.com/jublonet/codebird-php * @link https://github.com/jublonet/codebird-php
*/ */
@ -18,7 +18,7 @@ require_once ('test/codebirdm.php');
* *
* @package codebird-test * @package codebird-test
*/ */
class Returnformat_Test extends \PHPUnit_Framework_TestCase class Returnformat_Test extends \PHPUnit\Framework\TestCase
{ {
/** /**
* Initialise Codebird class * Initialise Codebird class

View File

@ -7,8 +7,8 @@ require_once ('test/codebirdt.php');
* A Twitter library in PHP. * A Twitter library in PHP.
* *
* @package codebird-test * @package codebird-test
* @author Jublo Solutions <support@jublo.net> * @author Jublo Limited <support@jublo.net>
* @copyright 2010-2016 Jublo Solutions <support@jublo.net> * @copyright 2010-2018 Jublo Limited <support@jublo.net>
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License 3.0 * @license https://opensource.org/licenses/GPL-3.0 GNU General Public License 3.0
* @link https://github.com/jublonet/codebird-php * @link https://github.com/jublonet/codebird-php
*/ */
@ -18,7 +18,7 @@ require_once ('test/codebirdt.php');
* *
* @package codebird-test * @package codebird-test
*/ */
class Setter_Test extends \PHPUnit_Framework_TestCase class Setter_Test extends \PHPUnit\Framework\TestCase
{ {
/** /**
* Tests setConsumerKey * Tests setConsumerKey

View File

@ -7,8 +7,8 @@ require_once ('test/codebirdm.php');
* A Twitter library in PHP. * A Twitter library in PHP.
* *
* @package codebird-test * @package codebird-test
* @author Jublo Solutions <support@jublo.net> * @author Jublo Limited <support@jublo.net>
* @copyright 2010-2016 Jublo Solutions <support@jublo.net> * @copyright 2010-2018 Jublo Limited <support@jublo.net>
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License 3.0 * @license https://opensource.org/licenses/GPL-3.0 GNU General Public License 3.0
* @link https://github.com/jublonet/codebird-php * @link https://github.com/jublonet/codebird-php
*/ */
@ -18,7 +18,7 @@ require_once ('test/codebirdm.php');
* *
* @package codebird-test * @package codebird-test
*/ */
class Signing_Test extends \PHPUnit_Framework_TestCase class Signing_Test extends \PHPUnit\Framework\TestCase
{ {
/** /**
* Initialise Codebird class * Initialise Codebird class

View File

@ -7,8 +7,8 @@ require_once ('test/codebirdt.php');
* A Twitter library in PHP. * A Twitter library in PHP.
* *
* @package codebird-test * @package codebird-test
* @author Jublo Solutions <support@jublo.net> * @author Jublo Limited <support@jublo.net>
* @copyright 2010-2016 Jublo Solutions <support@jublo.net> * @copyright 2010-2018 Jublo Limited <support@jublo.net>
* @license https://opensource.org/licenses/GPL-3.0 GNU General Public License 3.0 * @license https://opensource.org/licenses/GPL-3.0 GNU General Public License 3.0
* @link https://github.com/jublonet/codebird-php * @link https://github.com/jublonet/codebird-php
*/ */
@ -18,7 +18,7 @@ require_once ('test/codebirdt.php');
* *
* @package codebird-test * @package codebird-test
*/ */
class Singleton_Test extends \PHPUnit_Framework_TestCase class Singleton_Test extends \PHPUnit\Framework\TestCase
{ {
/** /**
* Tests getInstance * Tests getInstance