Simon Wistow > Net-Gnip-0.3 > Net::Gnip::Activity

Download:
Net-Gnip-0.3.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

Net::Gnip::Activity - a single item of activity in Gnip

SYNOPSIS ^

    # Create a new activity
    # 'at' defaults to now
    my $activity = Net::Gnip::Activity->new($action, $actor, %opts);
    
    # ... or parse from xml
    my $activity = Net::Gnip::Activity->parse($xml);

    # at, uid and type are always present
    print "At: ".$activity->at;   # returns a DateTime objec
    $activity->at(DateTime->now); # Can take a string or a DateTime

    print "Actor: ".$activity->actor;
    print "Action: ".$activity->action;

    # These are optional
    print "Url: ".$activity->url;
    print "To: ".$activity->to."\n";
    print "Regarding: ".$activity->regarding."\n";
    print "Source: ".$activity->source."\n";
    print "Tags: ".$activity->tags."\n";

    my $payload = Net::Gnip::Activity::Payload->new($body);
    $activity->payload($payload);

    print $activity->as_xml;

METHODS ^

new <action> <actor> [option[s]]

Takes a action and a actor as mandatory parameters.

Options is a hash and can contain at, url, regarding, source and <tags>.

If at isn't passed in then the current time is used.

at [value]

Returns the current at value.

Optionally takes either a string or a DateTime object to set the at time.

actor [actor]

Gets or sets the current actor.

action [action]

Gets or sets the current action.

url [url]

Gets or sets the current url.

to [to]

Gets or sets the current to.

regarding [regarding]

Gets or sets the current regarding.

source [source]

Gets or sets the current source.

tags [tags]

Gets or sets the current tags.

The param either a list or comma separated string.

Returns a list.

payload [payload]

Get or sets the current payload.

parse <xml>

Parse some xml into an activity.

as_xml

Return the activity as xml

syntax highlighting: