Class: Twitter::Base
- Inherits:
-
Object
- Object
- Twitter::Base
- Extended by:
- Forwardable
- Defined in:
- lib/twitter/base.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #block(id) ⇒ Object
- #direct_message_create(user, text) ⇒ Object
- #direct_message_destroy(id) ⇒ Object
-
#direct_messages(query = {}) ⇒ Object
Options: since, since_id, page.
-
#direct_messages_sent(query = {}) ⇒ Object
Options: since, since_id, page.
- #disable_notifications(id) ⇒ Object
- #enable_notifications(id) ⇒ Object
- #favorite_create(id) ⇒ Object
- #favorite_destroy(id) ⇒ Object
-
#favorites(query = {}) ⇒ Object
Options: id, page.
-
#follower_ids(query = {}) ⇒ Object
Options: id, user_id, screen_name.
-
#followers(query = {}) ⇒ Object
Options: id, user_id, screen_name, page.
-
#friend_ids(query = {}) ⇒ Object
Options: id, user_id, screen_name.
-
#friends(query = {}) ⇒ Object
Options: id, user_id, screen_name, page.
-
#friends_timeline(query = {}) ⇒ Object
Options: since_id, max_id, count, page, since.
- #friendship_create(id, follow = false) ⇒ Object
- #friendship_destroy(id) ⇒ Object
- #friendship_exists?(a, b) ⇒ Boolean
- #help ⇒ Object
-
#initialize(client = Twitter::NoAuth.new) ⇒ Base
constructor
A new instance of Base.
- #rate_limit_status ⇒ Object
-
#replies(query = {}) ⇒ Object
Options: since_id, max_id, since, page.
- #status(id) ⇒ Object
- #status_destroy(id) ⇒ Object
- #unblock(id) ⇒ Object
-
#update(status, query = {}) ⇒ Object
Options: in_reply_to_status_id.
-
#update_delivery_device(device) ⇒ Object
Device must be sms, im or none.
-
#update_profile(body = {}) ⇒ Object
One or more of the following must be present: name, email, url, location, description.
-
#update_profile_colors(colors = {}) ⇒ Object
One or more of the following must be present: profile_background_color, profile_text_color, profile_link_color, profile_sidebar_fill_color, profile_sidebar_border_color.
- #user(id = nil) ⇒ Object
-
#user_timeline(query = {}) ⇒ Object
Options: id, user_id, screen_name, since_id, max_id, page, since.
- #verify_credentials ⇒ Object
Constructor Details
#initialize(client = Twitter::NoAuth.new) ⇒ Base
Returns a new instance of Base.
9 10 11 |
# File 'lib/twitter/base.rb', line 9 def initialize(client=Twitter::NoAuth.new) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
7 8 9 |
# File 'lib/twitter/base.rb', line 7 def client @client end |
Instance Method Details
#block(id) ⇒ Object
144 145 146 |
# File 'lib/twitter/base.rb', line 144 def block(id) perform_post("/blocks/create/#{id}.json") end |
#direct_message_create(user, text) ⇒ Object
65 66 67 |
# File 'lib/twitter/base.rb', line 65 def (user, text) perform_post("/direct_messages/new.json", :body => {:user => user, :text => text}) end |
#direct_message_destroy(id) ⇒ Object
69 70 71 |
# File 'lib/twitter/base.rb', line 69 def (id) perform_post("/direct_messages/destroy/#{id}.json") end |
#direct_messages(query = {}) ⇒ Object
Options: since, since_id, page
56 57 58 |
# File 'lib/twitter/base.rb', line 56 def (query={}) perform_get("/direct_messages.json", :query => query) end |
#direct_messages_sent(query = {}) ⇒ Object
Options: since, since_id, page
61 62 63 |
# File 'lib/twitter/base.rb', line 61 def (query={}) perform_get("/direct_messages/sent.json", :query => query) end |
#disable_notifications(id) ⇒ Object
140 141 142 |
# File 'lib/twitter/base.rb', line 140 def disable_notifications(id) perform_post("/notifications/leave/#{id}.json") end |
#enable_notifications(id) ⇒ Object
136 137 138 |
# File 'lib/twitter/base.rb', line 136 def enable_notifications(id) perform_post("/notifications/follow/#{id}.json") end |
#favorite_create(id) ⇒ Object
128 129 130 |
# File 'lib/twitter/base.rb', line 128 def favorite_create(id) perform_post("/favorites/create/#{id}.json") end |
#favorite_destroy(id) ⇒ Object
132 133 134 |
# File 'lib/twitter/base.rb', line 132 def favorite_destroy(id) perform_post("/favorites/destroy/#{id}.json") end |
#favorites(query = {}) ⇒ Object
Options: id, page
124 125 126 |
# File 'lib/twitter/base.rb', line 124 def favorites(query={}) perform_get('/favorites.json', :query => query) end |
#follower_ids(query = {}) ⇒ Object
Options: id, user_id, screen_name
93 94 95 |
# File 'lib/twitter/base.rb', line 93 def follower_ids(query={}) perform_get("/followers/ids.json", :query => query, :mash => false) end |
#followers(query = {}) ⇒ Object
Options: id, user_id, screen_name, page
47 48 49 |
# File 'lib/twitter/base.rb', line 47 def followers(query={}) perform_get('/statuses/followers.json', :query => query) end |
#friend_ids(query = {}) ⇒ Object
Options: id, user_id, screen_name
88 89 90 |
# File 'lib/twitter/base.rb', line 88 def friend_ids(query={}) perform_get("/friends/ids.json", :query => query, :mash => false) end |
#friends(query = {}) ⇒ Object
Options: id, user_id, screen_name, page
42 43 44 |
# File 'lib/twitter/base.rb', line 42 def friends(query={}) perform_get('/statuses/friends.json', :query => query) end |
#friends_timeline(query = {}) ⇒ Object
Options: since_id, max_id, count, page, since
14 15 16 |
# File 'lib/twitter/base.rb', line 14 def friends_timeline(query={}) perform_get('/statuses/friends_timeline.json', :query => query) end |
#friendship_create(id, follow = false) ⇒ Object
73 74 75 76 77 |
# File 'lib/twitter/base.rb', line 73 def friendship_create(id, follow=false) body = {} body.merge!(:follow => follow) if follow perform_post("/friendships/create/#{id}.json", :body => body) end |
#friendship_destroy(id) ⇒ Object
79 80 81 |
# File 'lib/twitter/base.rb', line 79 def friendship_destroy(id) perform_post("/friendships/destroy/#{id}.json") end |
#friendship_exists?(a, b) ⇒ Boolean
83 84 85 |
# File 'lib/twitter/base.rb', line 83 def friendship_exists?(a, b) perform_get("/friendships/exists.json", :query => {:user_a => a, :user_b => b}) end |
#help ⇒ Object
152 153 154 |
# File 'lib/twitter/base.rb', line 152 def help perform_get('/help/test.json') end |
#rate_limit_status ⇒ Object
113 114 115 |
# File 'lib/twitter/base.rb', line 113 def rate_limit_status perform_get('/account/rate_limit_status.json') end |
#replies(query = {}) ⇒ Object
Options: since_id, max_id, since, page
33 34 35 |
# File 'lib/twitter/base.rb', line 33 def replies(query={}) perform_get('/statuses/replies.json', :query => query) end |
#status(id) ⇒ Object
23 24 25 |
# File 'lib/twitter/base.rb', line 23 def status(id) perform_get("/statuses/show/#{id}.json") end |
#status_destroy(id) ⇒ Object
37 38 39 |
# File 'lib/twitter/base.rb', line 37 def status_destroy(id) perform_post("/statuses/destroy/#{id}.json") end |
#unblock(id) ⇒ Object
148 149 150 |
# File 'lib/twitter/base.rb', line 148 def unblock(id) perform_post("/blocks/destroy/#{id}.json") end |
#update(status, query = {}) ⇒ Object
Options: in_reply_to_status_id
28 29 30 |
# File 'lib/twitter/base.rb', line 28 def update(status, query={}) perform_post("/statuses/update.json", :body => {:status => status}.merge(query)) end |
#update_delivery_device(device) ⇒ Object
Device must be sms, im or none
102 103 104 |
# File 'lib/twitter/base.rb', line 102 def update_delivery_device(device) perform_post('/account/update_delivery_device.json', :body => {:device => device}) end |
#update_profile(body = {}) ⇒ Object
One or more of the following must be present:
name, email, url, location, description
119 120 121 |
# File 'lib/twitter/base.rb', line 119 def update_profile(body={}) perform_post('/account/update_profile.json', :body => body) end |
#update_profile_colors(colors = {}) ⇒ Object
One or more of the following must be present:
profile_background_color, profile_text_color, profile_link_color,
profile_sidebar_fill_color, profile_sidebar_border_color
109 110 111 |
# File 'lib/twitter/base.rb', line 109 def update_profile_colors(colors={}) perform_post('/account/update_profile_colors.json', :body => colors) end |
#user(id = nil) ⇒ Object
51 52 53 |
# File 'lib/twitter/base.rb', line 51 def user(id=nil) id ? perform_get("/users/show/#{id}.json") : verify_credentials end |
#user_timeline(query = {}) ⇒ Object
Options: id, user_id, screen_name, since_id, max_id, page, since
19 20 21 |
# File 'lib/twitter/base.rb', line 19 def user_timeline(query={}) perform_get('/statuses/user_timeline.json', :query => query) end |
#verify_credentials ⇒ Object
97 98 99 |
# File 'lib/twitter/base.rb', line 97 def verify_credentials perform_get("/account/verify_credentials.json") end |