ZF-9253: Change legacy Twitter API endpoint to the new versioned API endpoint

Description

Just recently Twitter created a versioned API endpoint. It is changeing from twitter.com to api.twitter.com/1. http://groups.google.com/group/… .

Comments

Patch is attached.

Christopher, I've applied your patch, but got the following failures:

{panel} 1) Zend_Service_TwitterTest::testUsersFeaturedStatusReturnsResults 404: 'GET /1/statuses/featured.xml HTTP/1.1 Host: api.twitter.com Connection: close Accept-encoding: gzip, deflate User-Agent: Zend_Http_Client Authorization: Basic emZ0ZXN0dXNlcjp6ZnRlc3R1c2Vy Accept-Charset: ISO-8859-1,utf-8

'\nHTTP/1.1 404 Not Found Date: Wed, 21 Apr 2010 16:53:00 GMT Server: hi Status: 404 Not Found X-transaction: 1271868780-80665-4305 X-ratelimit-limit: 20000 Last-modified: Wed, 21 Apr 2010 16:53:00 GMT X-ratelimit-remaining: 19898 Content-type: application/xml; charset=utf-8 Pragma: no-cache X-ratelimit-class: api_whitelisted X-revision: DEV Expires: Tue, 31 Mar 1981 05:00:00 GMT Cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0 X-ratelimit-reset: 1271871378 Set-cookie: guest_id=127186878041698454; path=/; expires=Fri, 21 May 2010 16:53:00 GMT Set-cookie: lang=en; path=/ Set-cookie: _twitter_sess=BAh7CToRdHJhbnNfcHJvbXB0MDoPY3JlYXRlZF9hdGwrCKFvSSEoAToHaWQi%250AJWIyM2U5ODFhODUwNjIxMDk2ZDM3NDRlY2ZjZjZiNWI0IgpmbGFzaElDOidB%250AY3Rpb25Db250cm9sbGVyO jpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA--7ec80f13f64e996d7c78dd93d975916270b0b38e; domain=.twitter.com; path=/ Vary: Accept-Encoding Content-encoding: gzip Content-length: 127 Connection: close

Failed asserting that is true.

/home/cawa/ZendFramework/svn/framework/trunk/tests/Zend/Service/TwitterTest.php:277

2) Zend_Service_TwitterTest::testFriendsTimelineWithCountReturnsResults 200: 'GET /1/statuses/friends_timeline.xml?count=2 HTTP/1.1 Host: api.twitter.com Connection: close Accept-encoding: gzip, deflate User-Agent: Zend_Http_Client Authorization: Basic emZ0ZXN0dXNlcjp6ZnRlc3R1c2Vy Accept-Charset: ISO-8859-1,utf-8

'\nHTTP/1.1 200 OK Date: Wed, 21 Apr 2010 16:53:22 GMT Server: hi Status: 200 OK X-transaction: 1271868802-42752-9460 X-ratelimit-limit: 20000 Etag: "a84d15e36e6c37eb4a63b03d6932eee8"-gzip Last-modified: Wed, 21 Apr 2010 16:53:22 GMT X-ratelimit-remaining: 19893 X-runtime: 0.06762 Content-type: application/xml; charset=utf-8 Pragma: no-cache X-ratelimit-class: api_whitelisted X-revision: DEV Expires: Tue, 31 Mar 1981 05:00:00 GMT Cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0 X-ratelimit-reset: 1271871378 Set-cookie: guest_id=127186880278964502; path=/; expires=Fri, 21 May 2010 16:53:22 GMT Set-cookie: lang=en; path=/ Set-cookie: _twitter_sess=BAh7CToPY3JlYXRlZF9hdGwrCALHSSEoAToRdHJhbnNfcHJvbXB0MDoHaWQi%250AJTc3MzAxZDhlZDU3YTk5MDQ4ZWVkOWQwODVhYWQ3MGJiIgpmbGFzaElDOidB%250AY3Rpb25Db250cm9sbGVyO jpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA--738d76040f710bdbd76263d9f8f83c99f8158ac8; domain=.twitter.com; path=/ Vary: Accept-Encoding Content-encoding: gzip Content-length: 755 Connection: close

Failed asserting that

If you revert the changes and run the unit test a couple of times, you will come up with the same failures. The first error has to do because the statuses/featured method doesn't exists in the Twitter API. I made a bug report, ZF-9254. I'm not sure why the other two failures happen. I figured since the same failures existed after the patch, there is no loss in functionality.

Fixed the OAUTH_BASE_URI constant in trunk (25264) and release-1.12(25265).

Made setUri() use the https URI in trunk (25266) and release-1.12(25267).

Well, I'm afraid this update is a little bit useless. As mentioned in ZF-12409, the Twitter API v1 (which is used in this "new" version) is going to be retired in 1 month (March 5th, 2013). And the new API also 1.1 doesn't include XML support, so whole Zend_Service_Twitter would require to be rewritten to keep it working.

See https://dev.twitter.com/blog/… for details.

So this issue does NOT "ensure that Zend_Service_Twitter will continue to work with the Twitter API going forward", I'm sorry :-(.