directMessage-class {twitteR} | R Documentation |
Class "directMessage": A class to represent Twitter Direct Messages
Description
Provides a model representing direct messages (DMs) from Twitter
Details
The directMessage
class is implemented as a reference class.
As there should be no backwards compatibility issues, there are no S4
methods provided as with the user
and status
classes.
An instance of a generator for this class is provided as a convenience
to the user as it is configured to handle most standard cases. To
access this generator, use the object dmFactory
. Accessor set
& get methods are provided for every field using reference class
$accessors()
methodology (see setRefClass
for
more details). As an example, the sender
field could be
accessed using object$getSender()
and object$setSender()
.
The constructor of this object assumes that the user is passing in a JSON encoded Twitter Direct Message. It is also possible to directly pass in the arguments.
Fields
text
:Text of the DM
recipient
:A
user
object representing the recipient of the messagerecipientSN
:Screen name of the recipient
recipientID
:ID number of the recipient
sender
:A
user
object representing the sender of the messagesenderSN
:Screen name of the sender
senderID
:ID number of the sender
created
:When the messages was created
Methods
destroy
:Deletes this DM from Twitter. A wrapper around
dmDestroy
toDataFrame
:Converts this into a one row
data.frame
, with each field representing a column. This can also be accomplished by the S4 styleas.data.frame(objectName)
.
Author(s)
Jeff Gentry
See Also
dmGet
, dmSend
, dmDestroy
, setRefClass
Examples
## Not run:
dm <- dmFactory$new(text='foo', recipientSN='blah')
dm$getText()
## assume 'json' is the return from a Twitter call
dm <- dmFactory$new(json)
dm$getSenderID()
## End(Not run)