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 | |
---|
1 | package Facebook::Graph::AccessToken::Response; |
---|
2 | BEGIN { |
---|
3 | $Facebook::Graph::AccessToken::Response::VERSION = '1.0300'; |
---|
4 | } |
---|
5 | |
---|
6 | use Any::Moose; |
---|
7 | use URI; |
---|
8 | use URI::QueryParam; |
---|
9 | use Ouch; |
---|
10 | |
---|
11 | has response => ( |
---|
12 | is => 'ro', |
---|
13 | required=> 1, |
---|
14 | ); |
---|
15 | |
---|
16 | has 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 | |
---|
29 | has 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 | |
---|
42 | no Any::Moose; |
---|
43 | __PACKAGE__->meta->make_immutable; |
---|
44 | |
---|
45 | =head1 NAME |
---|
46 | |
---|
47 | Facebook::Graph::AccessToken::Response - The Facebook access token request response. |
---|
48 | |
---|
49 | =head1 VERSION |
---|
50 | |
---|
51 | version 1.0300 |
---|
52 | |
---|
53 | =head1 Description |
---|
54 | |
---|
55 | You'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 | |
---|
61 | Returns the token string. |
---|
62 | |
---|
63 | =head2 expires () |
---|
64 | |
---|
65 | Returns the time alotted to this token. If undefined then the token is forever. |
---|
66 | |
---|
67 | =head2 response () |
---|
68 | |
---|
69 | Direct access to the L<HTTP::Response> object. |
---|
70 | |
---|
71 | =head1 LEGAL |
---|
72 | |
---|
73 | Facebook::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.