@@ -231,167 +231,6 @@ public function setReturnFormat($return_format)
231
231
$ this ->_return_format = $ return_format ;
232
232
}
233
233
234
- /**
235
- * Get allowed API methods, sorted by GET or POST
236
- * Watch out for multiple-method "account/settings"!
237
- *
238
- * @return array $apimethods
239
- */
240
- public function getApiMethods ()
241
- {
242
- static $ apimethods = array (
243
- 'GET ' => array (
244
- // Timelines
245
- 'statuses/mentions_timeline ' ,
246
- 'statuses/user_timeline ' ,
247
- 'statuses/home_timeline ' ,
248
- 'statuses/retweets_of_me ' ,
249
- 'statuses/retweeters/ids ' ,
250
-
251
- // Tweets
252
- 'statuses/retweets/:id ' ,
253
- 'statuses/show/:id ' ,
254
- 'statuses/oembed ' ,
255
-
256
- // Search
257
- 'search/tweets ' ,
258
-
259
- // Direct Messages
260
- 'direct_messages ' ,
261
- 'direct_messages/sent ' ,
262
- 'direct_messages/show ' ,
263
-
264
- // Friends & Followers
265
- 'friendships/no_retweets/ids ' ,
266
- 'friends/ids ' ,
267
- 'followers/ids ' ,
268
- 'friendships/lookup ' ,
269
- 'friendships/incoming ' ,
270
- 'friendships/outgoing ' ,
271
- 'friendships/show ' ,
272
- 'friends/list ' ,
273
- 'followers/list ' ,
274
-
275
- // Users
276
- 'account/settings ' ,
277
- 'account/verify_credentials ' ,
278
- 'blocks/list ' ,
279
- 'blocks/ids ' ,
280
- 'users/lookup ' ,
281
- 'users/show ' ,
282
- 'users/search ' ,
283
- 'users/contributees ' ,
284
- 'users/contributors ' ,
285
- 'users/profile_banner ' ,
286
-
287
- // Suggested Users
288
- 'users/suggestions/:slug ' ,
289
- 'users/suggestions ' ,
290
- 'users/suggestions/:slug/members ' ,
291
-
292
- // Favorites
293
- 'favorites/list ' ,
294
-
295
- // Lists
296
- 'lists/list ' ,
297
- 'lists/statuses ' ,
298
- 'lists/memberships ' ,
299
- 'lists/subscribers ' ,
300
- 'lists/subscribers/show ' ,
301
- 'lists/members/show ' ,
302
- 'lists/members ' ,
303
- 'lists/show ' ,
304
- 'lists/subscriptions ' ,
305
-
306
- // Saved searches
307
- 'saved_searches/list ' ,
308
- 'saved_searches/show/:id ' ,
309
-
310
- // Places & Geo
311
- 'geo/id/:place_id ' ,
312
- 'geo/reverse_geocode ' ,
313
- 'geo/search ' ,
314
- 'geo/similar_places ' ,
315
-
316
- // Trends
317
- 'trends/place ' ,
318
- 'trends/available ' ,
319
- 'trends/closest ' ,
320
-
321
- // OAuth
322
- 'oauth/authenticate ' ,
323
- 'oauth/authorize ' ,
324
-
325
- // Help
326
- 'help/configuration ' ,
327
- 'help/languages ' ,
328
- 'help/privacy ' ,
329
- 'help/tos ' ,
330
- 'application/rate_limit_status '
331
- ),
332
- 'POST ' => array (
333
- // Tweets
334
- 'statuses/destroy/:id ' ,
335
- 'statuses/update ' ,
336
- 'statuses/retweet/:id ' ,
337
- 'statuses/update_with_media ' ,
338
-
339
- // Direct Messages
340
- 'direct_messages/destroy ' ,
341
- 'direct_messages/new ' ,
342
-
343
- // Friends & Followers
344
- 'friendships/create ' ,
345
- 'friendships/destroy ' ,
346
- 'friendships/update ' ,
347
-
348
- // Users
349
- 'account/settings__post ' ,
350
- 'account/update_delivery_device ' ,
351
- 'account/update_profile ' ,
352
- 'account/update_profile_background_image ' ,
353
- 'account/update_profile_colors ' ,
354
- 'account/update_profile_image ' ,
355
- 'blocks/create ' ,
356
- 'blocks/destroy ' ,
357
- 'account/update_profile_banner ' ,
358
- 'account/remove_profile_banner ' ,
359
-
360
- // Favorites
361
- 'favorites/destroy ' ,
362
- 'favorites/create ' ,
363
-
364
- // Lists
365
- 'lists/members/destroy ' ,
366
- 'lists/subscribers/create ' ,
367
- 'lists/subscribers/destroy ' ,
368
- 'lists/members/create_all ' ,
369
- 'lists/members/create ' ,
370
- 'lists/destroy ' ,
371
- 'lists/update ' ,
372
- 'lists/create ' ,
373
- 'lists/members/destroy_all ' ,
374
-
375
- // Saved Searches
376
- 'saved_searches/create ' ,
377
- 'saved_searches/destroy/:id ' ,
378
-
379
- // Places & Geo
380
- 'geo/place ' ,
381
-
382
- // Spam Reporting
383
- 'users/report_spam ' ,
384
-
385
- // OAuth
386
- 'oauth/access_token ' ,
387
- 'oauth/request_token ' ,
388
- 'oauth2/token ' ,
389
- 'oauth2/invalidate_token '
390
- )
391
- );
392
- return $ apimethods ;
393
- }
394
-
395
234
/**
396
235
* Main API handler working on any requests you issue
397
236
*
@@ -756,14 +595,204 @@ protected function _sign($httpmethod, $method, $params = array())
756
595
protected function _detectMethod ($ method , $ params )
757
596
{
758
597
// multi-HTTP method endpoints
759
- switch ($ method ) {
598
+ switch ($ method ) {
760
599
case 'account/settings ' :
600
+ case 'account/login_verification_enrollment ' :
601
+ case 'account/login_verification_request ' :
761
602
$ method = count ($ params ) > 0 ? $ method . '__post ' : $ method ;
762
603
break ;
763
604
}
764
605
765
- $ apimethods = $ this ->getApiMethods ();
766
- foreach ($ apimethods as $ httpmethod => $ methods ) {
606
+ $ httpmethods = array ();
607
+ $ httpmethods ['GET ' ] = array (
608
+ // Timelines
609
+ 'statuses/mentions_timeline ' ,
610
+ 'statuses/user_timeline ' ,
611
+ 'statuses/home_timeline ' ,
612
+ 'statuses/retweets_of_me ' ,
613
+
614
+ // Tweets
615
+ 'statuses/retweets/:id ' ,
616
+ 'statuses/show/:id ' ,
617
+ 'statuses/oembed ' ,
618
+ 'statuses/retweeters/ids ' ,
619
+
620
+ // Search
621
+ 'search/tweets ' ,
622
+
623
+ // Direct Messages
624
+ 'direct_messages ' ,
625
+ 'direct_messages/sent ' ,
626
+ 'direct_messages/show ' ,
627
+
628
+ // Friends & Followers
629
+ 'friendships/no_retweets/ids ' ,
630
+ 'friends/ids ' ,
631
+ 'followers/ids ' ,
632
+ 'friendships/lookup ' ,
633
+ 'friendships/incoming ' ,
634
+ 'friendships/outgoing ' ,
635
+ 'friendships/show ' ,
636
+ 'friends/list ' ,
637
+ 'followers/list ' ,
638
+ 'friendships/lookup ' ,
639
+
640
+ // Users
641
+ 'account/settings ' ,
642
+ 'account/verify_credentials ' ,
643
+ 'blocks/list ' ,
644
+ 'blocks/ids ' ,
645
+ 'users/lookup ' ,
646
+ 'users/show ' ,
647
+ 'users/search ' ,
648
+ 'users/contributees ' ,
649
+ 'users/contributors ' ,
650
+ 'users/profile_banner ' ,
651
+ 'mutes/users/ids ' ,
652
+ 'mutes/users/list ' ,
653
+
654
+ // Suggested Users
655
+ 'users/suggestions/:slug ' ,
656
+ 'users/suggestions ' ,
657
+ 'users/suggestions/:slug/members ' ,
658
+
659
+ // Favorites
660
+ 'favorites/list ' ,
661
+
662
+ // Lists
663
+ 'lists/list ' ,
664
+ 'lists/statuses ' ,
665
+ 'lists/memberships ' ,
666
+ 'lists/subscribers ' ,
667
+ 'lists/subscribers/show ' ,
668
+ 'lists/members/show ' ,
669
+ 'lists/members ' ,
670
+ 'lists/show ' ,
671
+ 'lists/subscriptions ' ,
672
+ 'lists/ownerships ' ,
673
+
674
+ // Saved searches
675
+ 'saved_searches/list ' ,
676
+ 'saved_searches/show/:id ' ,
677
+
678
+ // Places & Geo
679
+ 'geo/id/:place_id ' ,
680
+ 'geo/reverse_geocode ' ,
681
+ 'geo/search ' ,
682
+ 'geo/similar_places ' ,
683
+
684
+ // Trends
685
+ 'trends/place ' ,
686
+ 'trends/available ' ,
687
+ 'trends/closest ' ,
688
+
689
+ // OAuth
690
+ 'oauth/authenticate ' ,
691
+ 'oauth/authorize ' ,
692
+
693
+ // Help
694
+ 'help/configuration ' ,
695
+ 'help/languages ' ,
696
+ 'help/privacy ' ,
697
+ 'help/tos ' ,
698
+ 'application/rate_limit_status ' ,
699
+
700
+ // Tweets
701
+ 'statuses/lookup ' ,
702
+
703
+ // Internal
704
+ 'users/recommendations ' ,
705
+ 'account/push_destinations/device ' ,
706
+ 'activity/about_me ' ,
707
+ 'activity/by_friends ' ,
708
+ 'statuses/media_timeline ' ,
709
+ 'timeline/home ' ,
710
+ 'help/experiments ' ,
711
+ 'search/typeahead ' ,
712
+ 'search/universal ' ,
713
+ 'discover/universal ' ,
714
+ 'conversation/show ' ,
715
+ 'statuses/:id/activity/summary ' ,
716
+ 'account/login_verification_enrollment ' ,
717
+ 'account/login_verification_request ' ,
718
+ 'prompts/suggest ' ,
719
+
720
+ 'beta/timelines/custom/list ' ,
721
+ 'beta/timelines/timeline ' ,
722
+ 'beta/timelines/custom/show '
723
+ );
724
+ $ httpmethods ['POST ' ] = array (
725
+ // Tweets
726
+ 'statuses/destroy/:id ' ,
727
+ 'statuses/update ' ,
728
+ 'statuses/retweet/:id ' ,
729
+ 'statuses/update_with_media ' ,
730
+ 'media/upload ' ,
731
+
732
+ // Direct Messages
733
+ 'direct_messages/destroy ' ,
734
+ 'direct_messages/new ' ,
735
+
736
+ // Friends & Followers
737
+ 'friendships/create ' ,
738
+ 'friendships/destroy ' ,
739
+ 'friendships/update ' ,
740
+
741
+ // Users
742
+ 'account/settings__post ' ,
743
+ 'account/update_delivery_device ' ,
744
+ 'account/update_profile ' ,
745
+ 'account/update_profile_background_image ' ,
746
+ 'account/update_profile_colors ' ,
747
+ 'account/update_profile_image ' ,
748
+ 'blocks/create ' ,
749
+ 'blocks/destroy ' ,
750
+ 'account/update_profile_banner ' ,
751
+ 'account/remove_profile_banner ' ,
752
+ 'mutes/users/create ' ,
753
+ 'mutes/users/destroy ' ,
754
+
755
+ // Favorites
756
+ 'favorites/destroy ' ,
757
+ 'favorites/create ' ,
758
+
759
+ // Lists
760
+ 'lists/members/destroy ' ,
761
+ 'lists/subscribers/create ' ,
762
+ 'lists/subscribers/destroy ' ,
763
+ 'lists/members/create_all ' ,
764
+ 'lists/members/create ' ,
765
+ 'lists/destroy ' ,
766
+ 'lists/update ' ,
767
+ 'lists/create ' ,
768
+ 'lists/members/destroy_all ' ,
769
+
770
+ // Saved Searches
771
+ 'saved_searches/create ' ,
772
+ 'saved_searches/destroy/:id ' ,
773
+
774
+ // Spam Reporting
775
+ 'users/report_spam ' ,
776
+
777
+ // OAuth
778
+ 'oauth/access_token ' ,
779
+ 'oauth/request_token ' ,
780
+ 'oauth2/token ' ,
781
+ 'oauth2/invalidate_token ' ,
782
+
783
+ // Internal
784
+ 'direct_messages/read ' ,
785
+ 'account/login_verification_enrollment__post ' ,
786
+ 'push_destinations/enable_login_verification ' ,
787
+ 'account/login_verification_request__post ' ,
788
+
789
+ 'beta/timelines/custom/create ' ,
790
+ 'beta/timelines/custom/update ' ,
791
+ 'beta/timelines/custom/destroy ' ,
792
+ 'beta/timelines/custom/add ' ,
793
+ 'beta/timelines/custom/remove '
794
+ );
795
+ foreach ($ httpmethods as $ httpmethod => $ methods ) {
767
796
if (in_array ($ method , $ methods )) {
768
797
return $ httpmethod ;
769
798
}
0 commit comments