Module: Twitter::Client::Accounts
- Included in:
- Twitter::Client
- Defined in:
- lib/twitter/client/accounts.rb
Overview
Defines methods related to a user's account
Instance Method Summary collapse
-
#end_session(options = {}) ⇒ Hash
Ends the session of the authenticating user.
-
#rate_limit_status(options = {}) ⇒ Twitter::RateLimitStatus
Returns the remaining number of API requests available to the requesting user.
-
#settings(options = {}) ⇒ Twitter::Settings
Updates the authenticating user's settings.
-
#update_delivery_device(device, options = {}) ⇒ Twitter::User
Sets which device Twitter delivers updates to for the authenticating user.
-
#update_profile(options = {}) ⇒ Twitter::User
Sets values that users are able to set under the "Account" tab of their settings page.
-
#update_profile_background_image(image, options = {}) ⇒ Twitter::User
Updates the authenticating user's profile background image.
-
#update_profile_colors(options = {}) ⇒ Twitter::User
Sets one or more hex values that control the color scheme of the authenticating user's profile.
-
#update_profile_image(image, options = {}) ⇒ Twitter::User
Updates the authenticating user's profile image.
-
#verify_credentials(options = {}) ⇒ Twitter::User
Returns the requesting user if authentication was successful, otherwise raises Error::Unauthorized.
Instance Method Details
#end_session(options = {}) ⇒ Hash
Ends the session of the authenticating user
52 53 54 |
# File 'lib/twitter/client/accounts.rb', line 52 def end_session(={}) post("/1/account/end_session.json", ) end |
#rate_limit_status(options = {}) ⇒ Twitter::RateLimitStatus
Returns the remaining number of API requests available to the requesting user
21 22 23 24 |
# File 'lib/twitter/client/accounts.rb', line 21 def rate_limit_status(={}) rate_limit_status = get("/1/account/rate_limit_status.json", ) Twitter::RateLimitStatus.new(rate_limit_status) end |
#settings(options = {}) ⇒ Twitter::Settings
Updates the authenticating user's settings. Or, if no options supplied, returns settings (including current trend, geo and sleep time information) for the authenticating user.
169 170 171 172 173 174 175 176 |
# File 'lib/twitter/client/accounts.rb', line 169 def settings(={}) settings = if .size.zero? get("/1/account/settings.json", ) else post("/1/account/settings.json", ) end Twitter::Settings.new(settings) end |
#update_delivery_device(device, options = {}) ⇒ Twitter::User
Sets which device Twitter delivers updates to for the authenticating user
68 69 70 71 |
# File 'lib/twitter/client/accounts.rb', line 68 def update_delivery_device(device, ={}) user = post("/1/account/update_delivery_device.json", .merge(:device => device)) Twitter::User.new(user) end |
#update_profile(options = {}) ⇒ Twitter::User
Only the options specified will be updated.
Sets values that users are able to set under the "Account" tab of their settings page
89 90 91 92 |
# File 'lib/twitter/client/accounts.rb', line 89 def update_profile(={}) user = post("/1/account/update_profile.json", ) Twitter::User.new(user) end |
#update_profile_background_image(image, options = {}) ⇒ Twitter::User
Updates the authenticating user's profile background image
107 108 109 110 |
# File 'lib/twitter/client/accounts.rb', line 107 def update_profile_background_image(image, ={}) user = post("/1/account/update_profile_background_image.json", .merge(:image => image)) Twitter::User.new(user) end |
#update_profile_colors(options = {}) ⇒ Twitter::User
Sets one or more hex values that control the color scheme of the authenticating user's profile
128 129 130 131 |
# File 'lib/twitter/client/accounts.rb', line 128 def update_profile_colors(={}) user = post("/1/account/update_profile_colors.json", ) Twitter::User.new(user) end |
#update_profile_image(image, options = {}) ⇒ Twitter::User
This method asynchronously processes the uploaded file before updating the user's profile image URL. You can either update your local cache the next time you request the user's information, or, at least 5 seconds after uploading the image, ask for the updated URL using User#profile_image.
Updates the authenticating user's profile image
146 147 148 149 |
# File 'lib/twitter/client/accounts.rb', line 146 def update_profile_image(image, ={}) user = post("/1/account/update_profile_image.json", .merge(:image => image)) Twitter::User.new(user) end |
#verify_credentials(options = {}) ⇒ Twitter::User
Returns the requesting user if authentication was successful, otherwise raises Error::Unauthorized
37 38 39 40 |
# File 'lib/twitter/client/accounts.rb', line 37 def verify_credentials(={}) user = get("/1/account/verify_credentials.json", ) Twitter::User.new(user) end |