| 1 | package Facebook::Graph::Request; | ||||||||||
| 2 | 4 | $Facebook::Graph::Request::VERSION = '1.1205'; | |||||||||
| 3 | 4 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 4 | ▶ | use JSON; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 4 | ▶ | use Ouch; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 4 | ▶ | use LWP::UserAgent; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 4 | ▶ | use LWP::Protocol::https; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 4 | ▶ | use Facebook::Graph::Response; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | has ua => ( | ||||||||||
| 11 | is => 'rw', | ||||||||||
| 12 | 0 | ▶ | isa => sub {ouch(442,"$_[0] is not an LWP::UserAgent object") unless ref $_[0] eq 'LWP::UserAgent'}, | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||
| 13 | lazy => 1, | ||||||||||
| 14 | 0 | ▶ | default => sub { | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 15 | 0 | my $ua = LWP::UserAgent->new; | |||||||||
| 16 | 0 | $ua->timeout(30); | |||||||||
| 17 | 0 | return $ua; | |||||||||
| 18 | }, | ||||||||||
| 19 | 4 | ); | |||||||||
| 20 | |||||||||||
| 21 | 0 | ▶ | sub post { | ||||||||
|
Subroutine
post: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 22 | 0 | my ($self, $uri, @params) = @_; | |||||||||
| 23 | 0 | return Facebook::Graph::Response->new(response => $self->ua->post($uri, @params)); | |||||||||
| 24 | } | ||||||||||
| 25 | |||||||||||
| 26 | 0 | ▶ | sub get { | ||||||||
|
Subroutine
get: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 27 | 0 | my ($self, $uri) = @_; | |||||||||
| 28 | 0 | return Facebook::Graph::Response->new(response => $self->ua->get($uri)); | |||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | 4 | 1; | |||||||||
| 32 | |||||||||||
| 33 | =head1 NAME | ||||||||||
| 34 | |||||||||||
| 35 | Facebook::Graph::Request - Handling posts to Facebook Graph. | ||||||||||
| 36 | |||||||||||
| 37 | =head1 VERSION | ||||||||||
| 38 | |||||||||||
| 39 | version 1.1205 | ||||||||||
| 40 | |||||||||||
| 41 | =head1 DESCRIPTION | ||||||||||
| 42 | |||||||||||
| 43 | This is the standard interface to the Facebook Graph API that all other modules use. | ||||||||||
| 44 | |||||||||||
| 45 | =head1 METHODS | ||||||||||
| 46 | |||||||||||
| 47 | =head2 new(params) | ||||||||||
| 48 | |||||||||||
| 49 | =over | ||||||||||
| 50 | |||||||||||
| 51 | =item params | ||||||||||
| 52 | |||||||||||
| 53 | A hash or hashref of parameters to pass to the constructor. | ||||||||||
| 54 | |||||||||||
| 55 | =over | ||||||||||
| 56 | |||||||||||
| 57 | =item ua | ||||||||||
| 58 | |||||||||||
| 59 | An L<LWP::UserAgent> object. It will be created for you if you don't pass one in. | ||||||||||
| 60 | |||||||||||
| 61 | =back | ||||||||||
| 62 | |||||||||||
| 63 | =back | ||||||||||
| 64 | |||||||||||
| 65 | =head2 post ( uri, params ) | ||||||||||
| 66 | |||||||||||
| 67 | A POST request will be made. | ||||||||||
| 68 | |||||||||||
| 69 | =over | ||||||||||
| 70 | |||||||||||
| 71 | =item uri | ||||||||||
| 72 | |||||||||||
| 73 | A URI string to Facebook. | ||||||||||
| 74 | |||||||||||
| 75 | =item headers | ||||||||||
| 76 | |||||||||||
| 77 | A hash of headers to pass to L<LWP::UserAgent> when making the request. | ||||||||||
| 78 | |||||||||||
| 79 | =back | ||||||||||
| 80 | |||||||||||
| 81 | |||||||||||
| 82 | =head2 get ( uri, params ) | ||||||||||
| 83 | |||||||||||
| 84 | A GET request will be made. | ||||||||||
| 85 | |||||||||||
| 86 | =over | ||||||||||
| 87 | |||||||||||
| 88 | =item uri | ||||||||||
| 89 | |||||||||||
| 90 | A URI to fetch. | ||||||||||
| 91 | |||||||||||
| 92 | =back | ||||||||||
| 93 | |||||||||||
| 94 | |||||||||||
| 95 | |||||||||||
| 96 | =head1 LEGAL | ||||||||||
| 97 | |||||||||||
| 98 | Facebook::Graph is Copyright 2010 - 2017 Plain Black Corporation (L<http://www.plainblack.com>) and is licensed under the same terms as Perl itself. | ||||||||||
| 99 | |||||||||||
| 100 | =cut | ||||||||||