1\name{directMessage-class}
2\Rdversion{1.1}
3\docType{class}
4\alias{directMessage-class}
5\alias{directMessage}
6\alias{dmFactory}
7\alias{show,directMessage-method}
8\title{Class "directMessage":  A class to represent Twitter Direct Messages }
9\description{ Provides a model representing direct messages (DMs) from Twitter}
10\section{Fields}{
11  \describe{
12     \item{\code{text}:}{Text of the DM}
13     \item{\code{recipient}:}{A \code{user} object representing the
14       recipient of the message}
15     \item{\code{recipientSN}:}{Screen name of the recipient}
16     \item{\code{recipientID}:}{ID number of the recipient}
17     \item{\code{sender}:}{A \code{user} object representing the sender
18       of the message}
19     \item{\code{senderSN}:}{Screen name of the sender}
20     \item{\code{senderID}:}{ID number of the sender}
21     \item{\code{created}:}{When the messages was created}
22  }
23}
24\section{Methods}{
25  \describe{
26     \item{\code{destroy}:}{Deletes this DM from Twitter.  A wrapper
27       around \code{\link{dmDestroy}}}
28     \item{\code{toDataFrame}:}{Converts this into a one row
29       \code{\link{data.frame}}, with each field representing a column.
30       This can also be accomplished by the S4 style
31       \code{as.data.frame(objectName)}.}
32  }
33}
34\details{
35  The \code{directMessage} class is implemented as a reference class.
36  As there should be no backwards compatibility issues, there are no S4
37  methods provided as with the \code{user} and \code{status} classes.
38  An instance of a generator for this class is provided as a convenience
39  to the user as it is configured to handle most standard cases.  To
40  access this generator, use the object \code{dmFactory}.  Accessor set
41  & get methods are provided for every field using reference class
42  \code{$accessors()} methodology (see \code{\link{setRefClass}} for
43  more details).  As an example, the \code{sender} field could be
44  accessed using \code{object$getSender()} and \code{object$setSender()}.
45
46  The constructor of this object assumes that the user is passing in a
47  JSON encoded Twitter Direct Message.  It is also possible to directly
48  pass in the arguments.
49}
50\author{ Jeff Gentry }
51\seealso{\code{\link{dmGet}}, \code{\link{dmSend}}, \code{\link{dmDestroy}}, \code{\link{setRefClass}}}
52\examples{
53  \dontrun{
54    dm <- dmFactory$new(text='foo', recipientSN='blah')
55    dm$getText()
56
57    ## assume 'json' is the return from a Twitter call
58    dm <- dmFactory$new(json)
59    dm$getSenderID()
60  }
61}
62\keyword{classes}
63