root/trunk/ActionStreams/plugins/ActionStreams/lib/ActionStreams/Event/GoogleReader.pm @ 1310

Revision 1310, 1.3 kB (checked in by mpaschal, 12 months ago)

Reclass googlereader_shared actions as googlereader_links actions
BugzID: 85751

Line 
1
2package ActionStreams::Event::GoogleReader;
3
4use strict;
5use base qw( ActionStreams::Event );
6
7__PACKAGE__->install_properties({
8    class_type => 'googlereader_links',
9});
10
11__PACKAGE__->install_meta({
12    columns => [ qw(
13        summary
14        source_title
15        source_url
16        note
17    ) ],
18});
19
20sub update_events {
21    my $class = shift;
22    my %profile = @_;
23    my ($ident, $author) = @profile{qw( ident author )};
24
25    my $items = $class->fetch_xpath(
26        url => "http://www.google.com/reader/public/atom/user/$ident/state/com.google/broadcast",
27        foreach => '//entry',
28        get => {
29            title        => 'title/child::text()',
30            summary      => 'summary/child::text()',
31            url          => q(link[@rel='alternate']/@href),
32            enclosure    => q(link[@rel='enclosure']/@href),
33            source_title => 'source/title/child::text()',
34            source_url   => q(source/link[@rel='alternate']/@href),
35            note         => 'gr:annotation/content/child::text()',
36        },
37    );
38        return if !$items;
39
40    for my $item (@$items) {
41        my $enclosure = delete $item->{enclosure};
42        $item->{url} ||= $enclosure;
43        $item->{identifier} = $item->{url};
44    }
45
46    $class->build_results( author => $author, items => $items );
47}
48
491;
Note: See TracBrowser for help on using the browser.