File Coverage

blib/lib/Facebook/Graph/Publish.pm
Criterion Covered Total %
statement 12 24 50.0
branch 0 2 0.0
condition n/a
subroutine 4 7 57.1
pod 0 3 0.0
total 16 36 44.4


line stmt bran cond sub pod time code
1             package Facebook::Graph::Publish;
2             $Facebook::Graph::Publish::VERSION = '1.1203';
3 4     4   1589 use Moo;
  4         10  
  4         19  
4 4     4   1080 use Facebook::Graph::Request;
  4         8  
  4         93  
5             with 'Facebook::Graph::Role::Uri';
6 4     4   19 use LWP::UserAgent;
  4         6  
  4         74  
7 4     4   22 use URI::Escape;
  4         7  
  4         876  
8              
9             has secret => (
10             is => 'ro',
11             required => 0,
12             predicate => 'has_secret',
13             );
14              
15             has access_token => (
16             is => 'ro',
17             predicate => 'has_access_token',
18             );
19              
20             has object_name => (
21             is => 'rw',
22             default => 'me',
23             );
24              
25             sub to {
26 0     0 0   my ($self, $object_name) = @_;
27 0           $self->object_name($object_name);
28 0           return $self;
29             }
30              
31             sub get_post_params {
32 0     0 0   my $self = shift;
33 0           my @post;
34 0 0         if ($self->has_access_token) {
35 0           push @post, access_token => uri_unescape($self->access_token);
36             }
37 0           return \@post;
38             }
39              
40             sub publish {
41 0     0 0   my ($self) = @_;
42 0           my $uri = $self->uri;
43 0           $uri->path($self->generate_versioned_path($self->object_name.$self->object_path));
44 0           return Facebook::Graph::Request->new->post($uri, $self->get_post_params);
45             }
46              
47             1;
48              
49             =head1 NAME
50              
51             Facebook::Graph::Publish - A base class for publishing various things to facebook.
52              
53             =head1 VERSION
54              
55             version 1.1203
56              
57             =head1 DESCRIPTION
58              
59             This module shouldn't be used by you directly for any purpose.
60              
61             =head1 LEGAL
62              
63             Facebook::Graph is Copyright 2010 - 2012 Plain Black Corporation (L<http://www.plainblack.com>) and is licensed under the same terms as Perl itself.
64              
65             =cut