גאבור סבו - Gábor Szabó > WebService-GData-0.06 > WebService::GData::YouTube::Feed::VideoMessage

Download:
WebService-GData-0.06.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  2
Open  0
View/Report Bugs
Module Version: 0.0101   Source  

NAME ^

WebService::GData::YouTube::Feed::VideoMessage - a video message (read/write) for data API v2.

SYNOPSIS ^

    #list the video messages sent
    #you must be logged in

    use WebService::GData::YouTube;
    use WebService::GData::ClientLogin;
    
    my $auth;

    eval {
        $auth = new WebService::GData::ClientLogin(
            email    => '...',
            password => '...',
            key      => '...'
        );
    };
    if(my $error = $@){
        #$error->code,$error->content...
    }
    
    my $yt = new WebService::GData::YouTube($auth);
     
    my $messages = $yt->get_user_inbox();   
    foreach my $message (@$messages) {
        say $message->subject;  
        say $message->summary;
        say $message->sent;
        say $message->from->name;
        say $message->title;     #video title
        if($message->subject()=~m/SPAM/){
            $message->delete();
        }
    }
    
    #send a video message

    my $message = $yt->message;
    $message->summary('look at that!');
    $message->id('video_id_goes_here');
    $message->send('channel_name');

DESCRIPTION ^

!WARNING! Documentation in progress.

!DEVELOPER RELEASE! API may change, program may break or be under optimized and I haven't done a full range of tests yet!

inherits from WebService::GData::YouTube::Feed::Video.

This package represents a Youtube Video message than can be sent by your friends only. Most of the time, you will retrieve a list of messages and from there you should be able to apply a delete.

You can not access other kind of messages.

Most of the time you will not instantiate this class directly but use the message method in the WebService::GData::YouTube class.

CONSTRUCTOR

new

Create a WebService::GData::YouTube::Feed::VideoMessage instance.

Parameters:

jsonc_video_entry_feed:Object (Optional)
authorization:Object (Optional)

or

authorization:Object (Optional)

If an authorization object is set (WebService::GData::ClientLogin),

it will allow you to insert new messages.

INHERITED METHODS

This class inherits from the Video class.

Therefore all the video methods can be used to retrieve information about the video shared such as the ->title method.

GENERAL GET METHODS

The following method wraps existing video methods used in the context of a video message.

subject

This returns the title tag which, in this context, is equal to the automaticly created mail title. It contains the author name and the shared video title.

You can not set the title when sending a message, only the content of the message.

from

This returns the Author of the message.

sent

This returns the published tag which, in this context, is equal to the date the mail was sent.

GENERAL SET/GET METHODS

summary

This is the message itself. The package does not encode,clean the data. YouTube replaces HTML with html entities.

video_id

The video id you which to share.

QUERY METHODS

This method actually query the service to save your data. You must be logged in programmaticly to be able to use them.

save / send

The save method will do an insert only if a video_id is set.

You must pass in the user name (several users name allowed)

    my $message = $yt->message;
       $message->summary('look at that!');
       $message->id('video_id_goes_here');
       $message->save('channel_name1','channel_name2');
       #or
       $message->send('channel_name1','channel_name2');       

delete

The delete method will actually erase a video message from the user inbox.

The method itself use internally the edit link found after retrieving a list of messages.

The usual flow is to get a list of all the messages

The user check the items to erase (the key should be an url:$message->links->rel('edit')->[0]->href)

You erase the message by passing the key:

    my $message = $yt->message;
       $message->delete($key); 
       
    #you can also retrieve a list of messages and erase them all, in which case,
    #you can loop other the result and call the delete() method:
       
    foreach my $message (@$messages) {
        $message->delete();
    }

CONFIGURATION AND ENVIRONMENT ^

none

INCOMPATIBILITIES ^

none

BUGS AND LIMITATIONS ^

If you do me the favor to _use_ this module and find a bug, please email me i will try to do my best to fix it (patches welcome)!

AUTHOR ^

shiriru <shirirulestheworld[arobas]gmail.com>

LICENSE AND COPYRIGHT ^

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: