1: <?php
2: /**
3: * Horde_Service_Twitter_Account class for calling account methods
4: *
5: * Copyright 2009-2012 Horde LLC (http://www.horde.org/)
6: *
7: * @author Michael J. Rubinsky <mrubinsk@horde.org>
8: * @license http://www.horde.org/licenses/bsd BSD
9: * @category Horde
10: * @package Service_Twitter
11: */
12: class Horde_Service_Twitter_Account
13: {
14: /**
15: * Twitter endpoint for account api calls
16: *
17: * @var string
18: */
19: protected $_endpoint = 'https://api.twitter.com/1/account/';
20:
21: /**
22: * The request/response format to use, xml or json.
23: *
24: * @var string
25: */
26: protected $_format = 'json';
27:
28: /**
29: *
30: * @param Horde_Service_Twitter $twitter
31: */
32: public function __construct($twitter)
33: {
34: $this->_twitter = $twitter;
35: }
36:
37: /**
38: * Used to verify current credentials, and obtain some basic profile
39: * information about the current user.
40: *
41: * http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-account%C2%A0verify_credentials
42: *
43: * @return string JSON reprentation of profile.
44: * @throws Horde_Service_Twitter_Exception
45: */
46: public function verifyCredentials()
47: {
48: $url = $this->_endpoint . 'verify_credentials.' . $this->_format;
49: return $this->_twitter->request->get($url);
50: }
51:
52: /**
53: * Obtain the current user's (if authenticated) or IP address' (if not
54: * authenticated) remaining number of requests left for the hour.
55: *
56: * http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-account%C2%A0rate_limit_status
57: *
58: * @return string JSON representation of result object.
59: */
60: public function rateLimitStatus()
61: {
62: $url = $this->_endpoint . 'rate_limit_status.' . $this->_format;
63: return $this->_twitter->request->get($url);
64: }
65:
66: /**
67: * Ends the current session, invalidates the current auth token if using
68: * OAuth.
69: *
70: * @return string
71: */
72: public function endSession()
73: {
74: $url = $this->_endpoint . 'end_session.' . $this->_format;
75: return $this->_twitter->request->post($url);
76: }
77:
78: /**
79: * Update/reset where twitter sends automatic updates to
80: * (im/sms etc...)
81: *
82: * @TODO
83: * @param string $device
84: *
85: * @return void
86: */
87: public function updateDeliveryDevice($device = '')
88: {
89: }
90:
91: /**
92: * Update user's profile data.
93: *
94: * http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-account%C2%A0update_profile
95: *
96: * @TODO
97: * @param array $profile Profile data see API docs for key-values
98: *
99: * @return string JSON representation of user's updated profile data
100: */
101: public function updateProfile($profile)
102: {
103: }
104:
105: }
106: