Graph/Publish.pm

filter: Statementstmt 60.0% 18 / 30 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 57.1% 4 / 7 Podpod 0.0% 0 / 3 totaltotal 52.3% 22 / 42 CC 2 SCAR 9.2
CC
2
Cov
56%
get_post_params
6.0
to
2.0
publish
2.0
CRAP 2.5
« Graph/AccessToken/Response.pm ↑ Summary Graph/Request.pm »
1 package Facebook::Graph::Publish;
2 4 $Facebook::Graph::Publish::VERSION = '1.1205';
3 4 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use Facebook::Graph::Request;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 with 'Facebook::Graph::Role::Uri';
6 4 ▶use LWP::UserAgent;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 ▶use URI::Escape;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 4 has secret => (
10 is => 'ro',
11 required => 0,
12 predicate => 'has_secret',
13 );
14  
15 4 has access_token => (
16 is => 'ro',
17 predicate => 'has_access_token',
18 );
19  
20 4 has object_name => (
21 is => 'rw',
22 default => 'me',
23 );
24  
25 0 ▶sub to {
Subroutine to: not called CC=1 SCAR=6.9
Pod undocumented
26 0 my ($self, $object_name) = @_;
27 0 $self->object_name($object_name);
28 0 return $self;
29 }
30  
31 0 ▶sub get_post_params {
Subroutine get_post_params: not called CC=2 SCAR=17.9
Pod undocumented
32 0 my $self = shift;
33 0 my @post;
34 0 ▶ if ($self->has_access_token) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->has_access_token) 0 0 0
35 0 push @post, access_token => uri_unescape($self->access_token);
36 }
37 0 return \@post;
38 }
39  
40 0 ▶sub publish {
Subroutine publish: not called CC=1 SCAR=6.9
Pod undocumented
41 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 4 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.1205
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 - 2017 Plain Black Corporation (L<http://www.plainblack.com>) and is licensed under the same terms as Perl itself.
64  
65 =cut
« Graph/AccessToken/Response.pm ↑ Summary Graph/Request.pm »