@@ -1,3 +1,9 @@
+1.0700 2014-05-30
+ - POD fixes thanks to dsteinbrunner
+ - fix typos thanks to dsteinbrunner
+ - Added request_extended_access_token thanks to srchulo
+ - Improved error message on access token expiration.
+
1.0600 2013-05-13
- Added the $fb->request() method.
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Komodo Project File - DO NOT EDIT -->
-<project id="299cdac4-c3bb-694f-81c5-8fda9340efb2" kpf_version="5" name="FacebookGraph.komodoproject">
-<preference-set idref="299cdac4-c3bb-694f-81c5-8fda9340efb2">
- <boolean id="import_live">1</boolean>
- <string relative="path" id="perlExtraPaths">lib</string>
- <boolean id="perl_lintOption_includeCurrentDirForLinter">1</boolean>
-</preference-set>
-</project>
@@ -22,7 +22,7 @@ This is free software, licensed under:
Version 1, February 1989
Copyright (C) 1989 Free Software Foundation, Inc.
- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ 51 Franklin St, Suite 500, Boston, MA 02110-1335 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -1,5 +1,5 @@
+# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.019.
Changes
-FacebookGraph.komodoproject
LICENSE
MANIFEST
META.yml
@@ -18,7 +18,6 @@ author.t/rsvp_attending.t
author.t/rsvp_declined.t
author.t/rsvp_maybe.t
dist.ini
-eg/logs/development.log
eg/recipe1.psgi
eg/recipe2/Makefile.PL
eg/recipe2/bin/app.pl
@@ -26,7 +25,6 @@ eg/recipe2/config.yml
eg/recipe2/environments/development.yml
eg/recipe2/environments/production.yml
eg/recipe2/lib/recipe2.pm
-eg/recipe2/logs/development.log
eg/recipe2/public/404.html
eg/recipe2/public/500.html
eg/recipe2/t/001_base.t
@@ -55,6 +53,7 @@ lib/Facebook/Graph/Publish/Event.pm
lib/Facebook/Graph/Publish/Like.pm
lib/Facebook/Graph/Publish/Link.pm
lib/Facebook/Graph/Publish/Note.pm
+lib/Facebook/Graph/Publish/PageTab.pm
lib/Facebook/Graph/Publish/Photo.pm
lib/Facebook/Graph/Publish/Post.pm
lib/Facebook/Graph/Publish/RSVPAttending.pm
@@ -6,7 +6,7 @@ build_requires: {}
configure_requires:
ExtUtils::MakeMaker: 6.30
dynamic_config: 0
-generated_by: 'Dist::Zilla version 4.300034, CPAN::Meta::Converter version 2.120921'
+generated_by: 'Dist::Zilla version 5.019, CPAN::Meta::Converter version 2.141170'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -30,11 +30,13 @@ requires:
resources:
bugtracker: http://github.com/rizen/Facebook-Graph/issues
repository: git://github.com/rizen/Facebook-Graph.git
-version: 1.0600
+version: 1.0700
x_contributors:
+ - 'Adam Hopkins <SirChickenHair@srchulo-aire.local>'
- 'Andrew Grangaard <granny-github@ofb.net>'
- - 'Chris Weyl <cweyl@alumni.drew.edu>'
+ - 'Chris Weyl <rsrchboy@cpan.org>'
- 'Daisuke Murase <typester@cpan.org>'
+ - 'David Steinbrunner <dsteinbrunner@pobox.com>'
- 'Fayland Lam <fayland@gmail.com>'
- 'James Wright <james2vegas@aim.com>'
- 'Jason Wieland <jwieland@gmail.com>'
@@ -1,4 +1,5 @@
+# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.019.
use strict;
use warnings;
@@ -11,7 +12,6 @@ use ExtUtils::MakeMaker 6.30;
my %WriteMakefileArgs = (
"ABSTRACT" => "A fast and easy way to integrate your apps with Facebook.",
"AUTHOR" => "JT Smith <jt\@plainblack.com>",
- "BUILD_REQUIRES" => {},
"CONFIGURE_REQUIRES" => {
"ExtUtils::MakeMaker" => "6.30"
},
@@ -31,38 +31,31 @@ my %WriteMakefileArgs = (
"Test::More" => 0,
"URI" => "1.54"
},
- "TEST_REQUIRES" => {},
- "VERSION" => "1.0600",
+ "VERSION" => "1.0700",
"test" => {
"TESTS" => "t/*.t"
}
);
-unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
- my $tr = delete $WriteMakefileArgs{TEST_REQUIRES};
- my $br = $WriteMakefileArgs{BUILD_REQUIRES};
- for my $mod ( keys %$tr ) {
- if ( exists $br->{$mod} ) {
- $br->{$mod} = $tr->{$mod} if $tr->{$mod} > $br->{$mod};
- }
- else {
- $br->{$mod} = $tr->{$mod};
- }
- }
-}
+my %FallbackPrereqs = (
+ "Any::Moose" => "0.13",
+ "AnyEvent::HTTP::LWP::UserAgent" => "0.08",
+ "AnyEvent::TLS" => 0,
+ "DateTime" => "0.61",
+ "DateTime::Format::Strptime" => "1.4000",
+ "JSON" => "2.16",
+ "MIME::Base64::URLSafe" => "0.01",
+ "Ouch" => "0.0400",
+ "Test::More" => 0,
+ "URI" => "1.54"
+);
-unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) {
- my $br = delete $WriteMakefileArgs{BUILD_REQUIRES};
- my $pp = $WriteMakefileArgs{PREREQ_PM};
- for my $mod ( keys %$br ) {
- if ( exists $pp->{$mod} ) {
- $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod};
- }
- else {
- $pp->{$mod} = $br->{$mod};
- }
- }
+
+unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
+ delete $WriteMakefileArgs{TEST_REQUIRES};
+ delete $WriteMakefileArgs{BUILD_REQUIRES};
+ $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs;
}
delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
@@ -1,7 +1,7 @@
This archive contains the distribution Facebook-Graph,
-version 1.0600:
+version 1.0700:
A fast and easy way to integrate your apps with Facebook.
@@ -11,3 +11,5 @@ This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
+This README file was generated by Dist::Zilla::Plugin::Readme v5.019.
+
@@ -3,7 +3,7 @@ author = JT Smith <jt@plainblack.com>
license = Perl_5
copyright_holder = Plain Black Corporation
copyright_year = 2013
-version = 1.0600
+version = 1.0700
[@Classic]
diff --git a/var/tmp/source/RIZEN/Facebook-Graph-1.0600/Facebook-Graph-1.0600/eg/logs/development.log b/var/tmp/source/RIZEN/Facebook-Graph-1.0600/Facebook-Graph-1.0600/eg/logs/development.log
deleted file mode 100644
index e69de29b..00000000
@@ -1 +0,0 @@
-[24972] core @0.000014> session_dir : /tmp/dancer-sessions in /usr/local/lib/perl5/site_perl/5.10.1/Dancer/Session/YAML.pm l. 31
@@ -1,12 +1,10 @@
package Facebook::Graph::AccessToken::Response;
-{
- $Facebook::Graph::AccessToken::Response::VERSION = '1.0600';
-}
-
+$Facebook::Graph::AccessToken::Response::VERSION = '1.0700';
use Any::Moose;
use URI;
use URI::QueryParam;
use Ouch;
+use JSON;
has response => (
is => 'ro',
@@ -23,7 +21,7 @@ has token => (
return URI->new('?'.$response->content)->query_param('access_token');
}
else {
- ouch $response->code, 'Could not fetch access token: '.$response->message, $response->request->uri->as_string;
+ ouch $response->code, 'Could not fetch access token: '._retrieve_error_message($response), $response->request->uri->as_string;
}
}
);
@@ -38,11 +36,22 @@ has expires => (
return URI->new('?'.$response->content)->query_param('expires');
}
else {
- ouch $response->code, 'Could not fetch access token: '.$response->message, $response->request->uri->as_string;
+ ouch $response->code, 'Could not fetch access token: '._retrieve_error_message($response), $response->request->uri->as_string;
}
}
);
+sub _retrieve_error_message {
+ my $response = shift;
+ my $content = eval { from_json($response->decoded_content) };
+ if ($@) {
+ return $response->message;
+ }
+ else {
+ return $content->{error}{message};
+ }
+}
+
no Any::Moose;
__PACKAGE__->meta->make_immutable;
@@ -52,7 +61,7 @@ Facebook::Graph::AccessToken::Response - The Facebook access token request respo
=head1 VERSION
-version 1.0600
+version 1.0700
=head1 Description
@@ -66,7 +75,7 @@ Returns the token string.
=head2 expires ()
-Returns the time alotted to this token. If undefined then the token is forever.
+Returns the time allotted to this token. If undefined then the token is forever.
=head2 response ()
@@ -1,8 +1,5 @@
package Facebook::Graph::AccessToken;
-{
- $Facebook::Graph::AccessToken::VERSION = '1.0600';
-}
-
+$Facebook::Graph::AccessToken::VERSION = '1.0700';
use Any::Moose;
use Facebook::Graph::AccessToken::Response;
use Facebook::Graph::Request;
@@ -25,19 +22,44 @@ has postback => (
has code => (
is => 'ro',
- required=> 1,
+ required=> 0,
+ predicate=> 'has_code',
+);
+
+has access_token => (
+ is => 'ro',
+ required => 0,
+ predicate => 'has_access_token',
);
+sub BUILD {
+ my $self = shift;
+ die "Either code or access_token is required" if not $self->has_code and not $self->has_access_token;
+}
+
sub uri_as_string {
my ($self) = @_;
my $uri = $self->uri;
$uri->path('oauth/access_token');
- $uri->query_form(
- client_id => $self->app_id,
- client_secret => $self->secret,
- redirect_uri => $self->postback,
- code => $self->code,
- );
+
+ if($self->has_code) {
+ $uri->query_form(
+ client_id => $self->app_id,
+ client_secret => $self->secret,
+ redirect_uri => $self->postback,
+ code => $self->code,
+ );
+ }
+ else {
+ $uri->query_form(
+ grant_type => 'fb_exchange_token',
+ client_id => $self->app_id,
+ client_secret => $self->secret,
+ redirect_uri => $self->postback,
+ fb_exchange_token => $self->access_token,
+ );
+ }
+
return $uri->as_string;
}
@@ -59,7 +81,7 @@ Facebook::Graph::AccessToken - Acquire an access token from Facebook.
=head1 VERSION
-version 1.0600
+version 1.0700
=head1 SYNOPSIS
@@ -1,8 +1,5 @@
package Facebook::Graph::Authorize;
-{
- $Facebook::Graph::Authorize::VERSION = '1.0600';
-}
-
+$Facebook::Graph::Authorize::VERSION = '1.0700';
use Any::Moose;
with 'Facebook::Graph::Role::Uri';
@@ -67,7 +64,7 @@ Facebook::Graph::Authorize - Authorizing an app with Facebook
=head1 VERSION
-version 1.0600
+version 1.0700
=head1 SYNOPSIS
@@ -1,8 +1,5 @@
package Facebook::Graph::BatchRequests;
-{
- $Facebook::Graph::BatchRequests::VERSION = '1.0600';
-}
-
+$Facebook::Graph::BatchRequests::VERSION = '1.0700';
use Any::Moose;
use Ouch;
use Facebook::Graph::Request;
@@ -68,7 +65,7 @@ Facebook::Graph::BatchRequests - Batch Requests
=head1 VERSION
-version 1.0600
+version 1.0700
=head1 SYNOPSIS
@@ -4,7 +4,7 @@ Facebook::Graph::Cookbook::Recipe1 - Building Privileged Applications
=head1 VERSION
-version 1.0600
+version 1.0700
=head1 DESCRIPTION
@@ -36,7 +36,7 @@ Go to L<http://www.facebook.com/developers/createapp.php> or click "Set Up New A
Fill in an application name. The only restriction is that it can't use a Facebook trademark or be similar to official Facebook application names.
-Agree to the terms of servce.
+Agree to the terms of service.
Click "Create Application".
@@ -4,7 +4,7 @@ Facebook::Graph::Cookbook::Recipe2 - Building a Full Web App
=head1 VERSION
-version 1.0600
+version 1.0700
=head1 DESCRIPTION
@@ -18,7 +18,7 @@ L<DateTime::Format::ICal> L<Dancer> L<Template> L<Data::ICal> L<XML::FeedPP>
=head2 Assumptions
-This recipe assumes that that you have a Facebook (L<http://www.facebook.com>) account.
+This recipe assumes that you have a Facebook (L<http://www.facebook.com>) account.
You'll also have to be able to point a domain name to a server that is accessible from the Internet. DNS and server configuration are way beyond the scope of this document.
@@ -38,7 +38,7 @@ Go to L<http://www.facebook.com/developers/createapp.php> or click "Set Up New A
Fill in an application name. The only restriction is that it can't use a Facebook trademark or be similar to official Facebook application names.
-Agree to the terms of servce.
+Agree to the terms of service.
Click "Create Application".
@@ -4,7 +4,7 @@ Facebook::Graph::Cookbook::Recipe3 - Impersonation
=head1 VERSION
-version 1.0600
+version 1.0700
=head1 DESCRIPTION
@@ -12,7 +12,7 @@ Building an application that can post as another page under my control.
=head2 Assumptions
-We're assuming you've already learned the basics of Facebook::Graph through the other recipies and have already set up your application access token.
+We're assuming you've already learned the basics of Facebook::Graph through the other recipes and have already set up your application access token.
=head1 RECIPE
@@ -4,13 +4,13 @@ Facebook::Graph::Cookbook - A cookbook for Facebook::Graph
=head1 VERSION
-version 1.0600
+version 1.0700
=head1 DESCRIPTION
-The goal of this document is to provide a set of common recipies for success. The L<Facebook::Graph> API is relatively easy to use, but there are just enough tricks to it that it can throw you off if you don't have a little insider information. Hopefully this document will help you overcome those hurdles.
+The goal of this document is to provide a set of common recipes for success. The L<Facebook::Graph> API is relatively easy to use, but there are just enough tricks to it that it can throw you off if you don't have a little insider information. Hopefully this document will help you overcome those hurdles.
-=head1 RECIPIES
+=head1 RECIPES
=over
@@ -20,7 +20,7 @@ Shows you how to set up a privileged application using nothing more than L<Plack
=item L<Facebook::Graph::Cookbook::Recipe2> - Working Example
-A fully functional Facebook::Graph app that publishes data to Facebook and reads data from it. Uses a full application server and lots of other modules. This is a working example, without a lot of explaination.
+A fully functional Facebook::Graph app that publishes data to Facebook and reads data from it. Uses a full application server and lots of other modules. This is a working example, without a lot of explanation.
=item L<Facebook::Graph::Cookbook::Recipe3> - Impersonation
@@ -1,8 +1,5 @@
package Facebook::Graph::Picture;
-{
- $Facebook::Graph::Picture::VERSION = '1.0600';
-}
-
+$Facebook::Graph::Picture::VERSION = '1.0700';
use Any::Moose;
with 'Facebook::Graph::Role::Uri';
@@ -57,7 +54,7 @@ Facebook::Graph::Picture - Get the URI for the picture of any object.
=head1 VERSION
-version 1.0600
+version 1.0700
=head1 SYNOPSIS
@@ -1,8 +1,5 @@
package Facebook::Graph::Publish::Checkin;
-{
- $Facebook::Graph::Publish::Checkin::VERSION = '1.0600';
-}
-
+$Facebook::Graph::Publish::Checkin::VERSION = '1.0700';
use Any::Moose;
extends 'Facebook::Graph::Publish';
@@ -98,7 +95,7 @@ Facebook::Graph::Publish::Checkin - Publish a location checkin.
=head1 VERSION
-version 1.0600
+version 1.0700
=head1 SYNOPSIS
@@ -150,7 +147,7 @@ The id of a page for a place. For example C<222047056390> is the id of Pete's Pi
=head2 set_latitude ( coord )
-Sets sets the coords of your location. See also C<set_longitude>
+Sets the coords of your location. See also C<set_longitude>
=head3 coord
@@ -159,7 +156,7 @@ The decimal latitude of your current location.
=head2 set_longitude ( coord )
-Sets sets the coords of your location. See also C<set_latitude>
+Sets the coords of your location. See also C<set_latitude>
=head3 coord
@@ -1,8 +1,5 @@
package Facebook::Graph::Publish::Comment;
-{
- $Facebook::Graph::Publish::Comment::VERSION = '1.0600';
-}
-
+$Facebook::Graph::Publish::Comment::VERSION = '1.0700';
use Any::Moose;
extends 'Facebook::Graph::Publish';
@@ -41,7 +38,7 @@ Facebook::Graph::Publish::Comment - Publish a comment on a post.
=head1 VERSION
-version 1.0600
+version 1.0700
=head1 SYNOPSIS
@@ -1,8 +1,5 @@
package Facebook::Graph::Publish::Event;
-{
- $Facebook::Graph::Publish::Event::VERSION = '1.0600';
-}
-
+$Facebook::Graph::Publish::Event::VERSION = '1.0700';
use Any::Moose;
extends 'Facebook::Graph::Publish';
use DateTime;
@@ -105,7 +102,7 @@ Facebook::Graph::Publish::Event - Add an event.
=head1 VERSION
-version 1.0600
+version 1.0700
=head1 SYNOPSIS
@@ -1,8 +1,5 @@
package Facebook::Graph::Publish::Like;
-{
- $Facebook::Graph::Publish::Like::VERSION = '1.0600';
-}
-
+$Facebook::Graph::Publish::Like::VERSION = '1.0700';
use Any::Moose;
extends 'Facebook::Graph::Publish';
@@ -18,7 +15,7 @@ Facebook::Graph::Publish::Like - Mark a post as something you like.
=head1 VERSION
-version 1.0600
+version 1.0700
=head1 SYNOPSIS
@@ -1,8 +1,5 @@
package Facebook::Graph::Publish::Link;
-{
- $Facebook::Graph::Publish::Link::VERSION = '1.0600';
-}
-
+$Facebook::Graph::Publish::Link::VERSION = '1.0700';
use Any::Moose;
extends 'Facebook::Graph::Publish';
@@ -55,7 +52,7 @@ Facebook::Graph::Publish::Link - Add a link.
=head1 VERSION
-version 1.0600
+version 1.0700
=head1 SYNOPSIS
@@ -95,7 +92,7 @@ Sets the URI to link to.
=head3 uri
-A a URI.
+A URI.
@@ -1,8 +1,5 @@
package Facebook::Graph::Publish::Note;
-{
- $Facebook::Graph::Publish::Note::VERSION = '1.0600';
-}
-
+$Facebook::Graph::Publish::Note::VERSION = '1.0700';
use Any::Moose;
extends 'Facebook::Graph::Publish';
@@ -55,7 +52,7 @@ Facebook::Graph::Publish::Note - Add a note to a user's list of notes.
=head1 VERSION
-version 1.0600
+version 1.0700
=head1 SYNOPSIS
@@ -0,0 +1,60 @@
+package Facebook::Graph::Publish::PageTab;
+$Facebook::Graph::Publish::PageTab::VERSION = '1.0700';
+use Any::Moose;
+extends 'Facebook::Graph::Publish';
+
+use constant object_path => '/tabs';
+
+has app_id => (
+ is => 'rw',
+ required => 1,
+);
+
+around get_post_params => sub {
+ my ($orig, $self) = @_;
+ my $post = $orig->($self);
+ push @$post, app_id => $self->app_id;
+ return $post;
+};
+
+no Any::Moose;
+__PACKAGE__->meta->make_immutable;
+
+
+=head1 NAME
+
+Facebook::Graph::Publish::PageTab - Add a page tab.
+
+=head1 VERSION
+
+version 1.0700
+
+=head1 SYNOPSIS
+
+ my $fb = Facebook::Graph->new;
+
+ $fb->add_page_tab($page_id, $app_id)->publish;
+
+=head1 DESCRIPTION
+
+This module gives you quick and easy access to publish an app as a page tab.
+
+B<ATTENTION:> You must have the C<manage_pages> privilege to use this module.
+
+=head1 METHODS
+
+=head2 app_id ( id )
+
+Specify an app id for the app to add as the page tab.
+
+=head2 publish ( )
+
+Posts the data and returns a L<Facebook::Graph::Response> object. The response object should contain the id:
+
+ {"id":"1647395831_130068550371568"}
+
+=head1 LEGAL
+
+Facebook::Graph is Copyright 2010 - 2012 Plain Black Corporation (L<http://www.plainblack.com>) and is licensed under the same terms as Perl itself.
+
+=cut
@@ -1,8 +1,5 @@
package Facebook::Graph::Publish::Photo;
-{
- $Facebook::Graph::Publish::Photo::VERSION = '1.0600';
-}
-
+$Facebook::Graph::Publish::Photo::VERSION = '1.0700';
use Any::Moose;
extends 'Facebook::Graph::Publish';
@@ -68,7 +65,7 @@ Facebook::Graph::Publish::Photo - Publish Photos
=head1 VERSION
-version 1.0600
+version 1.0700
=head1 SYNOPSIS
@@ -1,8 +1,5 @@
package Facebook::Graph::Publish::Post;
-{
- $Facebook::Graph::Publish::Post::VERSION = '1.0600';
-}
-
+$Facebook::Graph::Publish::Post::VERSION = '1.0700';
use Any::Moose;
extends 'Facebook::Graph::Publish';
@@ -248,7 +245,7 @@ Facebook::Graph::Publish::Post - Publish to a user's wall.
=head1 VERSION
-version 1.0600
+version 1.0700
=head1 SYNOPSIS
@@ -274,7 +271,7 @@ This module gives you quick and easy access to publish to a user's Facebook feed
B<ATTENTION:> You must have the C<publish_stream> privilege to use this module.
-B<TIP:> Facebook seems to use these terms interchangibly: Feed, Post, News, Wall. So if you want to publish to a user's wall, this is the mechanism you use to do that.
+B<TIP:> Facebook seems to use these terms interchangeably: Feed, Post, News, Wall. So if you want to publish to a user's wall, this is the mechanism you use to do that.
=head1 METHODS
@@ -1,8 +1,5 @@
package Facebook::Graph::Publish::RSVPAttending;
-{
- $Facebook::Graph::Publish::RSVPAttending::VERSION = '1.0600';
-}
-
+$Facebook::Graph::Publish::RSVPAttending::VERSION = '1.0700';
use Any::Moose;
extends 'Facebook::Graph::Publish';
@@ -18,7 +15,7 @@ Facebook::Graph::Publish::RSVPAttending - RSVP attending to an event.
=head1 VERSION
-version 1.0600
+version 1.0700
=head1 SYNOPSIS
@@ -1,8 +1,5 @@
package Facebook::Graph::Publish::RSVPDeclined;
-{
- $Facebook::Graph::Publish::RSVPDeclined::VERSION = '1.0600';
-}
-
+$Facebook::Graph::Publish::RSVPDeclined::VERSION = '1.0700';
use Any::Moose;
extends 'Facebook::Graph::Publish';
@@ -18,7 +15,7 @@ Facebook::Graph::Publish::RSVPDeclined - RSVP declined to an event.
=head1 VERSION
-version 1.0600
+version 1.0700
=head1 SYNOPSIS
@@ -1,8 +1,5 @@
package Facebook::Graph::Publish::RSVPMaybe;
-{
- $Facebook::Graph::Publish::RSVPMaybe::VERSION = '1.0600';
-}
-
+$Facebook::Graph::Publish::RSVPMaybe::VERSION = '1.0700';
use Any::Moose;
extends 'Facebook::Graph::Publish';
@@ -18,7 +15,7 @@ Facebook::Graph::Publish::RSVPMaybe - RSVP maybe to an event.
=head1 VERSION
-version 1.0600
+version 1.0700
=head1 SYNOPSIS
@@ -1,8 +1,5 @@
package Facebook::Graph::Publish;
-{
- $Facebook::Graph::Publish::VERSION = '1.0600';
-}
-
+$Facebook::Graph::Publish::VERSION = '1.0700';
use Any::Moose;
use Facebook::Graph::Request;
with 'Facebook::Graph::Role::Uri';
@@ -58,7 +55,7 @@ Facebook::Graph::Publish - A base class for publishing various things to faceboo
=head1 VERSION
-version 1.0600
+version 1.0700
=head1 DESCRIPTION
@@ -1,8 +1,5 @@
package Facebook::Graph::Query;
-{
- $Facebook::Graph::Query::VERSION = '1.0600';
-}
-
+$Facebook::Graph::Query::VERSION = '1.0700';
use Any::Moose;
use Facebook::Graph::Request;
with 'Facebook::Graph::Role::Uri';
@@ -209,18 +206,18 @@ Facebook::Graph::Query - Simple and fast searching and fetching of Facebook data
=head1 VERSION
-version 1.0600
+version 1.0700
=head1 SYNOPSIS
my $fb = Facebook::Graph->new;
- my $perl_page = $fb->find('16665510298')
+ my $perl_page = $fb->query->find('16665510298')
->include_metadata
->request
->as_hashref;
- my $sarah_bownds = $fb->find('sarahbownds')
+ my $sarah_bownds = $fb->query->find('sarahbownds')
->select_fields(qw(id name))
->request
->as_hashref;
@@ -309,6 +306,7 @@ All events.
All groups.
+=back
@@ -326,8 +324,6 @@ They keywords to search by.
See the C<context> param in the C<from> method.
-=back
-
=head2 limit_results ( amount )
@@ -336,7 +332,7 @@ The result set will only return a certain number of records when this is set. Us
=head2 date_format ( format )
-The result set dates will be formated in the defined formats. Specify the format by reference the PHP date format spec: L<http://php.net/manual/en/function.date.php>. (eg. ->date_format('U')->) Useful for getting epoch for datatime. Returns C<$self> for method chaining.
+The result set dates will be formatted in the defined formats. Specify the format by reference the PHP date format spec: L<http://php.net/manual/en/function.date.php>. (eg. ->date_format('U')->) Useful for getting epoch for datatime. Returns C<$self> for method chaining.
=head3 amount
@@ -1,8 +1,5 @@
package Facebook::Graph::Request;
-{
- $Facebook::Graph::Request::VERSION = '1.0600';
-}
-
+$Facebook::Graph::Request::VERSION = '1.0700';
use Any::Moose;
use JSON;
use Ouch;
@@ -49,7 +46,7 @@ Facebook::Graph::Request - Handling posts to Facebook Graph.
=head1 VERSION
-version 1.0600
+version 1.0700
=head1 DESCRIPTION
@@ -1,8 +1,5 @@
package Facebook::Graph::Response;
-{
- $Facebook::Graph::Response::VERSION = '1.0600';
-}
-
+$Facebook::Graph::Response::VERSION = '1.0700';
use Any::Moose;
use JSON;
use Ouch;
@@ -60,7 +57,7 @@ Facebook::Graph::Response - Handling of a Facebook::Graph response documents.
=head1 VERSION
-version 1.0600
+version 1.0700
=head1 DESCRIPTION
@@ -1,8 +1,5 @@
package Facebook::Graph::Role::Uri;
-{
- $Facebook::Graph::Role::Uri::VERSION = '1.0600';
-}
-
+$Facebook::Graph::Role::Uri::VERSION = '1.0700';
use Any::Moose 'Role';
use URI;
@@ -19,7 +16,7 @@ Facebook::Graph::Role::Uri - The base URI for the Facebook Graph API.
=head1 VERSION
-version 1.0600
+version 1.0700
=head1 DESCRIPTION
@@ -1,8 +1,5 @@
package Facebook::Graph::Session;
-{
- $Facebook::Graph::Session::VERSION = '1.0600';
-}
-
+$Facebook::Graph::Session::VERSION = '1.0700';
use Any::Moose;
use Facebook::Graph::Request;
with 'Facebook::Graph::Role::Uri';
@@ -51,7 +48,7 @@ Facebook::Graph::Session - Convert old API sessions into Graph API access_tokens
=head1 VERSION
-version 1.0600
+version 1.0700
=head1 SYNOPSIS
@@ -1,8 +1,5 @@
package Facebook::Graph;
-{
- $Facebook::Graph::VERSION = '1.0600';
-}
-
+$Facebook::Graph::VERSION = '1.0700';
use Any::Moose;
use MIME::Base64::URLSafe;
use JSON;
@@ -22,6 +19,7 @@ use Facebook::Graph::Publish::Event;
use Facebook::Graph::Publish::RSVPMaybe;
use Facebook::Graph::Publish::RSVPAttending;
use Facebook::Graph::Publish::RSVPDeclined;
+use Facebook::Graph::Publish::PageTab;
use Facebook::Graph::BatchRequests;
use Ouch;
@@ -35,7 +33,7 @@ has secret => (
);
has postback => (
- is => 'ro',
+ is => 'rw',
);
has access_token => (
@@ -74,6 +72,22 @@ sub request_access_token {
return $token;
}
+sub request_extended_access_token {
+ my ($self, $access_token) = @_;
+
+ die "request_extended_access_token requires an access_token" unless $access_token or $self->has_access_token;
+ $access_token = $access_token ? $access_token : $self->access_token;
+
+ my $token = Facebook::Graph::AccessToken->new(
+ access_token => $access_token,
+ postback => $self->postback,
+ secret => $self->secret,
+ app_id => $self->app_id,
+ )->request;
+ $self->access_token($token->token);
+ return $token;
+}
+
sub convert_sessions {
my ($self, $sessions) = @_;
return Facebook::Graph::Session->new(
@@ -243,6 +257,29 @@ sub add_event {
return Facebook::Graph::Publish::Event->new( %params );
}
+sub add_page_tab {
+ my ($self, $object_name, $app_id) = @_;
+
+ die "page_id and app_id are required" unless $object_name and $app_id;
+
+ my %params = ( );
+ $params{object_name} = $object_name;
+
+ if ($self->has_access_token) {
+ $params{access_token} = $self->access_token;
+ }
+
+ if ($self->has_secret) {
+ $params{secret} = $self->secret;
+ }
+
+ $params{app_id} = $app_id;
+
+ return Facebook::Graph::Publish::PageTab->new( %params );
+}
+
+
+
sub rsvp_maybe {
my ($self, $object_name) = @_;
my %params = (
@@ -296,7 +333,7 @@ Facebook::Graph - A fast and easy way to integrate your apps with Facebook.
=head1 VERSION
-version 1.0600
+version 1.0700
=head1 SYNOPSIS
@@ -349,9 +386,17 @@ Handle the Facebook authorization code postback:
my $q = Plack::Request->new($env);
$fb->request_access_token($q->query_param('code'));
+ #now retrieve extended access token
+ $fb->request_extended_access_token; #extended access token now in $fb->access_token
+
Or if you already had the access token:
$fb->access_token($token);
+ $fb->request_extended_access_token;
+
+Or simply:
+
+ $fb->request_extended_access_token($token);
Get some info:
@@ -410,6 +455,12 @@ Creates a L<Facebook::Graph::Authorize> object, which can be used to get permiss
Creates a L<Facebook::Graph::AccessToken> object and fetches an access token from Facebook, which will allow everything you do with Facebook::Graph to work within user privileges rather than through the public interface. Returns a L<Facebook::Graph::AccessToken::Response> object, and also sets the C<access_token> property in the Facebook::Graph object.
+=head2 request_extended_access_token ( access_token )
+
+Note: access_token is optional. Creates a L<Facebook::Graph::AccessToken> object and fetches an (https://developers.facebook.com/docs/facebook-login/access-tokens/#extending) extended access token from Facebook.
+This method accepts an optional access token. If you have called C<request_access_token> already on the Facebook::Graph object and C<access_token> is set, then you do not have to pass
+in an access token. However, if you have an access token stored from a previous object, you will need to pass it in.
+
=head3 code
An authorization code string that you should have gotten by going through the C<authorize> process.
@@ -504,6 +555,10 @@ Creates a L<Facebook::Graph::Publish::Link> object, which can be used to publish
Creates a L<Facebook::Graph::Publish::Event> object, which can be used to publish events.
+=head2 add_page_tab ( page_id, app_id )
+
+Creates a L<Facebook::Graph::Publish::PageTab> object, which can be used to publish an app as a page tab.
+
=head3 id
Optionally provide an object id to place it on. Requires that you have administrative access to that page/object.
@@ -7,15 +7,9 @@ BEGIN {
}
}
+# This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests.
-use Test::More;
-
-eval "use Test::Pod::Coverage 1.08";
-plan skip_all => "Test::Pod::Coverage 1.08 required for testing POD coverage"
- if $@;
-
-eval "use Pod::Coverage::TrustPod";
-plan skip_all => "Pod::Coverage::TrustPod required for testing POD coverage"
- if $@;
+use Test::Pod::Coverage 1.08;
+use Pod::Coverage::TrustPod;
all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' });
@@ -7,9 +7,8 @@ BEGIN {
}
}
+# This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests.
use Test::More;
-
-eval "use Test::Pod 1.41";
-plan skip_all => "Test::Pod 1.41 required for testing POD" if $@;
+use Test::Pod 1.41;
all_pod_files_ok();