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

Last change on this file since 9820d55 was 9820d55, checked in by Edward Z. Yang <ezyang@mit.edu>, 13 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
Line 
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 {
20        # LOL error handling
21        my $self = shift;
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        #}
26    }
27);
28
29has expires => (
30    is      => 'ro',
31    lazy    => 1,
32    default => sub {
33        # LOL error handling
34        my $self = shift;
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        #}
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
75=cut
Note: See TracBrowser for help on using the repository browser.