### Home Classes Methods

### In Files

- lib/twitter/rest/direct_messages.rb

### Methods

- #create_direct_message
- #d
- #destroy_direct_message
- #direct_message
- #direct_messages
- #direct_messages_received
- #direct_messages_sent
- #dm
- #m

### Included Modules

- Twitter::REST::Utils
- Twitter::Utils

### Class/Module Index

Quicksearch

- Twitter
- Twitter::Arguments
- Twitter::Base
- Twitter::BasicUser
- Twitter::Client
- Twitter::Configuration
- Twitter::Creatable
- Twitter::Cursor
- Twitter::DirectMessage
- Twitter::Entities
- Twitter::Entity
- Twitter::Entity::Hashtag
- Twitter::Entity::Symbol
- Twitter::Entity::URI
- Twitter::Entity::URL
- Twitter::Entity::UserMention
- Twitter::Enumerable
- Twitter::Error
- Twitter::Error::AlreadyFavorited
- Twitter::Error::AlreadyRetweeted
- Twitter::Error::BadGateway
- Twitter::Error::BadRequest
- Twitter::Error::ClientError
- Twitter::Error::Code
- Twitter::Error::ConfigurationError
- Twitter::Error::DuplicateStatus
- Twitter::Error::Forbidden
- Twitter::Error::GatewayTimeout
- Twitter::Error::InternalServerError
- Twitter::Error::NotAcceptable
- Twitter::Error::NotFound
- Twitter::Error::RequestTimeout
- Twitter::Error::ServerError
- Twitter::Error::ServiceUnavailable
- Twitter::Error::TooManyRequests
- Twitter::Error::UnacceptableIO
- Twitter::Error::Unauthorized
- Twitter::Error::UnprocessableEntity
- Twitter::Factory
- Twitter::Geo
- Twitter::Geo::Point
- Twitter::Geo::Polygon
- Twitter::GeoFactory
- Twitter::GeoResults
- Twitter::Identity
- Twitter::Language
- Twitter::List
- Twitter::Media
- Twitter::Media::Photo
- Twitter::MediaFactory
- Twitter::Metadata
- Twitter::OEmbed
- Twitter::Place
- Twitter::Profile
- Twitter::ProfileBanner
- Twitter::REST
- Twitter::REST::API
- Twitter::REST::Client
- Twitter::REST::DirectMessages
- Twitter::REST::Favorites
- Twitter::REST::FriendsAndFollowers
- Twitter::REST::Help
- Twitter::REST::Lists
- Twitter::REST::OAuth
- Twitter::REST::PlacesAndGeo
- Twitter::REST::Request
- Twitter::REST::Request::MultipartWithFile
- Twitter::REST::Response
- Twitter::REST::Response::ParseErrorJson
- Twitter::REST::Response::ParseJson
- Twitter::REST::Response::RaiseError
- Twitter::REST::SavedSearches
- Twitter::REST::Search
- Twitter::REST::SpamReporting
- Twitter::REST::SuggestedUsers
- Twitter::REST::Timelines
- Twitter::REST::Trends
- Twitter::REST::Tweets
- Twitter::REST::Undocumented
- Twitter::REST::Users
- Twitter::REST::Utils
- Twitter::RateLimit
- Twitter::Relationship
- Twitter::Request
- Twitter::SavedSearch
- Twitter::SearchResults
- Twitter::Settings
- Twitter::Size
- Twitter::SourceUser
- Twitter::Streaming
- Twitter::Streaming::Client
- Twitter::Streaming::Connection
- Twitter::Streaming::DeletedTweet
- Twitter::Streaming::Event
- Twitter::Streaming::FriendList
- Twitter::Streaming::MessageParser
- Twitter::Streaming::Response
- Twitter::Streaming::StallWarning
- Twitter::Suggestion
- Twitter::TargetUser
- Twitter::Token
- Twitter::Trend
- Twitter::TrendResults
- Twitter::Tweet
- Twitter::User
- Twitter::Utils
- Twitter::Utils::ClassMethods
- Twitter::Version

No matching classes.

# Twitter::REST::DirectMessages

### Public Instance Methods

create_direct_message(user, text, options = {}) click to toggle source

Sends a new direct message to the specified user from the authenticating user

@see dev.twitter.com/docs/api/1.1/post/direct_messages/new @rate_limited No @authentication Requires user context @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid. @return [Twitter::DirectMessage] The sent message. @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object. @param text [String] The text of your direct message, up to 140 characters. @param options [Hash] A customizable set of options.

    # File lib/twitter/rest/direct_messages.rb, line 127
    def create_direct_message(user, text, options = {})
      merge_user!(options, user)
      options[:text] = text
      perform_with_object(:post, '/1.1/direct_messages/new.json', options, Twitter::DirectMessage)
    end

Also aliased as: d, m, dm
d(user, text, options = {}) click to toggle source
Alias for: create_direct_message
destroy_direct_message(*args) click to toggle source

Destroys direct messages

@see dev.twitter.com/docs/api/1.1/post/direct_messages/destroy @note This method requires an access token with RWD (read, write & direct message) permissions. Consult The Application Permission Model for more information. @rate_limited No @authentication Requires user context @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid. @return [Array<Twitter::DirectMessage>] Deleted direct message. @overload destroy_direct_message(*ids)

    @param ids [Enumerable<Integer>] A collection of direct message IDs.

@overload destroy_direct_message(*ids, options)

    @param ids [Enumerable<Integer>] A collection of direct message IDs.
    @param options [Hash] A customizable set of options.

    # File lib/twitter/rest/direct_messages.rb, line 112
    def destroy_direct_message(*args)
      parallel_objects_from_response(Twitter::DirectMessage, :post, '/1.1/direct_messages/destroy.json', args)
    end

direct_message(id, options = {}) click to toggle source

Returns a direct message

@see dev.twitter.com/docs/api/1.1/get/direct_messages/show @note This method requires an access token with RWD (read, write & direct message) permissions. Consult The Application Permission Model for more information. @rate_limited Yes @authentication Requires user context @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid. @return [Twitter::DirectMessage] The requested messages. @param id [Integer] A direct message ID. @param options [Hash] A customizable set of options.

    # File lib/twitter/rest/direct_messages.rb, line 58
    def direct_message(id, options = {})
      options[:id] = id
      perform_with_object(:get, '/1.1/direct_messages/show.json', options, Twitter::DirectMessage)
    end

direct_messages(*args) click to toggle source

@note This method requires an access token with RWD (read, write & direct message) permissions. Consult The Application Permission Model for more information. @rate_limited Yes @authentication Requires user context @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid. @return [Array<Twitter::DirectMessage>] The requested messages. @overload direct_messages(options = {})

    Returns the 20 most recent direct messages sent to the authenticating user

    @see https://dev.twitter.com/docs/api/1.1/get/direct_messages
    @param options [Hash] A customizable set of options.
    @option options [Integer] :since_id Returns results with an ID greater than (that is, more recent than) the specified ID.
    @option options [Integer] :max_id Returns results with an ID less than (that is, older than) or equal to the specified ID.
    @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 200.
    @option options [Integer] :page Specifies the page of results to retrieve.

@overload direct_messages(*ids)

    Returns direct messages

    @see https://dev.twitter.com/docs/api/1.1/get/direct_messages/show
    @param ids [Enumerable<Integer>] A collection of direct message IDs.

@overload direct_messages(*ids, options)

    Returns direct messages

    @see https://dev.twitter.com/docs/api/1.1/get/direct_messages/show
    @param ids [Enumerable<Integer>] A collection of direct message IDs.
    @param options [Hash] A customizable set of options.

    # File lib/twitter/rest/direct_messages.rb, line 88
    def direct_messages(*args)
      arguments = Twitter::Arguments.new(args)
      if arguments.empty?
        direct_messages_received(arguments.options)
      else
        pmap(arguments) do |id|
          direct_message(id, arguments.options)
        end
      end
    end

direct_messages_received(options = {}) click to toggle source

Returns the 20 most recent direct messages sent to the authenticating user

@see dev.twitter.com/docs/api/1.1/get/direct_messages @note This method requires an access token with RWD (read, write & direct message) permissions. Consult The Application Permission Model for more information. @rate_limited Yes @authentication Requires user context @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid. @return [Array<Twitter::DirectMessage>] Direct messages sent to the authenticating user. @param options [Hash] A customizable set of options. @option options [Integer] :since_id Returns results with an ID greater than (that is, more recent than) the specified ID. @option options [Integer] :max_id Returns results with an ID less than (that is, older than) or equal to the specified ID. @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 200. @option options [Integer] :page Specifies the page of results to retrieve.

    # File lib/twitter/rest/direct_messages.rb, line 27
    def direct_messages_received(options = {})
      perform_with_objects(:get, '/1.1/direct_messages.json', options, Twitter::DirectMessage)
    end

direct_messages_sent(options = {}) click to toggle source

Returns the 20 most recent direct messages sent by the authenticating user

@see dev.twitter.com/docs/api/1.1/get/direct_messages/sent @note This method requires an access token with RWD (read, write & direct message) permissions. Consult The Application Permission Model for more information. @rate_limited Yes @authentication Requires user context @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid. @return [Array<Twitter::DirectMessage>] Direct messages sent by the authenticating user. @param options [Hash] A customizable set of options. @option options [Integer] :since_id Returns results with an ID greater than (that is, more recent than) the specified ID. @option options [Integer] :max_id Returns results with an ID less than (that is, older than) or equal to the specified ID. @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 200. @option options [Integer] :page Specifies the page of results to retrieve.

    # File lib/twitter/rest/direct_messages.rb, line 44
    def direct_messages_sent(options = {})
      perform_with_objects(:get, '/1.1/direct_messages/sent.json', options, Twitter::DirectMessage)
    end

dm(user, text, options = {}) click to toggle source
Alias for: create_direct_message
m(user, text, options = {}) click to toggle source
Alias for: create_direct_message

[Validate]

Generated with the Darkfish Rdoc Generator 2.