Module: Twitter::Client::DirectMessages
- Included in:
- Twitter::Client
- Defined in:
- lib/twitter/client/direct_messages.rb
Overview
Defines methods related to direct messages
Instance Method Summary collapse
-
#direct_message(id, options = {}) ⇒ Twitter::DirectMessage
Returns a single direct message, specified by id.
-
#direct_message_create(user, text, options = {}) ⇒ Twitter::DirectMessage
(also: #d)
Sends a new direct message to the specified user from the authenticating user.
-
#direct_message_destroy(id, options = {}) ⇒ Twitter::DirectMessage
Destroys a direct message.
-
#direct_messages(options = {}) ⇒ Array<Twitter::DirectMessage>
Returns the 20 most recent direct messages sent to the authenticating user.
-
#direct_messages_sent(options = {}) ⇒ Array<Twitter::DirectMessage>
Returns the 20 most recent direct messages sent by the authenticating user.
Instance Method Details
#direct_message(id, options = {}) ⇒ Twitter::DirectMessage
This method requires an access token with RWD (read, write & direct message) permissions. Consult The Application Permission Model for more information.
Returns a single direct message, specified by id.
104 105 106 107 |
# File 'lib/twitter/client/direct_messages.rb', line 104 def (id, ={}) = get("/1/direct_messages/show/#{id}.json", ) Twitter::DirectMessage.new() end |
#direct_message_create(user, text, options = {}) ⇒ Twitter::DirectMessage Also known as: d
Sends a new direct message to the specified user from the authenticating user
85 86 87 88 89 |
# File 'lib/twitter/client/direct_messages.rb', line 85 def (user, text, ={}) .merge_user!(user) = post("/1/direct_messages/new.json", .merge(:text => text)) Twitter::DirectMessage.new() end |
#direct_message_destroy(id, options = {}) ⇒ Twitter::DirectMessage
This method requires an access token with RWD (read, write & direct message) permissions. Consult The Application Permission Model for more information.
Destroys a direct message
66 67 68 69 |
# File 'lib/twitter/client/direct_messages.rb', line 66 def (id, ={}) = delete("/1/direct_messages/destroy/#{id}.json", ) Twitter::DirectMessage.new() end |
#direct_messages(options = {}) ⇒ Array<Twitter::DirectMessage>
This method requires an access token with RWD (read, write & direct message) permissions. Consult The Application Permission Model for more information.
Returns the 20 most recent direct messages sent to the authenticating user
25 26 27 28 29 |
# File 'lib/twitter/client/direct_messages.rb', line 25 def (={}) get("/1/direct_messages.json", ).map do || Twitter::DirectMessage.new() end end |
#direct_messages_sent(options = {}) ⇒ Array<Twitter::DirectMessage>
This method requires an access token with RWD (read, write & direct message) permissions. Consult The Application Permission Model for more information.
Returns the 20 most recent direct messages sent by the authenticating user
47 48 49 50 51 |
# File 'lib/twitter/client/direct_messages.rb', line 47 def (={}) get("/1/direct_messages/sent.json", ).map do || Twitter::DirectMessage.new() end end |