source: perl/modules/Facebook/lib/Facebook/Graph/AccessToken/Response.pm

release-1.9
Last change on this file was 7777ac2, checked in by Edward Z. Yang <ezyang@mit.edu>, 10 years ago
Convert to async (both Facebook::Graph and us.) Work items: - Documentation is all out of date - Think more carefully about error handling (right now it's delayed into the response object) - Really bad HTTP POST hack in Publish.pm. Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
  • Property mode set to 100644
File size: 1.6 KB
RevLine 
[2a42248]1package Facebook::Graph::AccessToken::Response;
2BEGIN {
3  $Facebook::Graph::AccessToken::Response::VERSION = '1.0300';
4}
5
6use Any::Moose;
7use URI;
8use URI::QueryParam;
9use Ouch;
10
11has response => (
12    is      => 'ro',
13    required=> 1,
14);
15
16has token => (
17    is      => 'ro',
18    lazy    => 1,
19    default => sub {
[7777ac2]20        # LOL error handling
[2a42248]21        my $self = shift;
[7777ac2]22        return URI->new('?'.$self->response)->query_param('access_token');
23        #else {
24        #    ouch $response->code, 'Could not fetch access token: '.$response->message, $response->request->uri->as_string;
25        #}
[2a42248]26    }
27);
28
29has expires => (
30    is      => 'ro',
31    lazy    => 1,
32    default => sub {
[7777ac2]33        # LOL error handling
[2a42248]34        my $self = shift;
[7777ac2]35        return URI->new('?'.$self->response)->query_param('expires');
36        #else {
37        #    ouch $response->code, 'Could not fetch access token: '.$response->message, $response->request->uri->as_string;
38        #}
[2a42248]39    }
40);
41
42no Any::Moose;
43__PACKAGE__->meta->make_immutable;
44
45=head1 NAME
46
47Facebook::Graph::AccessToken::Response - The Facebook access token request response.
48
49=head1 VERSION
50
51version 1.0300
52
53=head1 Description
54
55You'll be given one of these as a result of calling the C<request> method from a L<Facebook::Graph::AccessToken> object.
56
57=head1 METHODS
58
59=head2 token ()
60
61Returns the token string.
62
63=head2 expires ()
64
65Returns the time alotted to this token. If undefined then the token is forever.
66
67=head2 response ()
68
69Direct access to the L<HTTP::Response> object.
70
71=head1 LEGAL
72
73Facebook::Graph is Copyright 2010 Plain Black Corporation (L<http://www.plainblack.com>) and is licensed under the same terms as Perl itself.
74
[7777ac2]75=cut
Note: See TracBrowser for help on using the repository browser.