8000 Add async media/upload calls status by GET · dreamenemy/codebird-php@7fdac48 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7fdac48

Browse files
committed
Add async media/upload calls status by GET
Fix jublo#177.
1 parent ca8677d commit 7fdac48

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ codebird-php - changelog
1111
+ Update more Ads API methods
1212
- Fix Ads API batch methods to send JSON body
1313
+ Update Ads API Analytics methods (stats)
14+
+ #177 Add async media/upload calls status by GET
1415

1516
3.1.0 (2016-02-15)
1617
+ #143 Add support for proxy types

src/codebird.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1677,6 +1677,14 @@ protected function _detectMethod($method, &$params)
16771677
}
16781678
}
16791679

1680+
// async media/upload calls may request a status by GET
1681+
if ($method === 'media/upload'
1682+
&& isset($params['command'])
1683+
&& $params['command'] === 'STATUS'
1684+
) {
1685+
return 'GET';
1686+
}
1687+
16801688
// prefer POST and PUT if parameters are set
16811689
if (count($params) > 0) {
16821690
if (in_array($method, $apimethods['POST'])) {

test/detection_tests.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ public function testDetectMethod2()
7878
$params = ['test' => 12];
7979
$this->assertEquals('POST', $cb->call('_detectMethod', 'account/settings', $params));
8080

81+
$params = [];
82+
$this->assertEquals('POST', $cb->call('_detectMethod', 'media/upload', $params));
83+
$params = ['command' => 'STATUS'];
84+
$this->assertEquals('GET', $cb->call('_detectMethod', 'media/upload', $params));
85+
8186
$httpmethods_by_param = [
8287
'POST' => [
8388
'campaign_id' => [

0 commit comments

Comments
 (0)
0