Facebook-OpenGraph

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

    interface. Default is equivalent to Furl::HTTP->new(capture\_request => 1).
    You **SHOULD** install 2.10 or later version of Furl to enable capture\_request
    option. Or you can specify keep\_request option for same purpose if you have Furl
    2.09. Setting capture\_request option is **strongly** recommended since it gives
    you the request headers and content when `request()` fails.

        my $fb = Facebook::OpenGraph->new;
        $fb->post('/me/feed', +{message => 'Hello, world!'});
        #2500:- OAuthException:An active access token must be used to query information about the current user.
        #POST /me/feed HTTP/1.1
        #Connection: keep-alive
        #User-Agent: Furl::HTTP/2.15
        #Content-Type: application/x-www-form-urlencoded
        #Content-Length: 27
        #Host: graph.facebook.com
        #
        #message=Hello%2C%20world%21

- namespace

    Facebook application namespace. This is used when you publish Open Graph Action

lib/Facebook/OpenGraph.pm  view on Meta::CPAN

interface. Default is equivalent to Furl::HTTP->new(capture_request => 1).
You B<SHOULD> install 2.10 or later version of Furl to enable capture_request
option. Or you can specify keep_request option for same purpose if you have Furl
2.09. Setting capture_request option is B<strongly> recommended since it gives
you the request headers and content when C<request()> fails.

  my $fb = Facebook::OpenGraph->new;
  $fb->post('/me/feed', +{message => 'Hello, world!'});
  #2500:- OAuthException:An active access token must be used to query information about the current user.
  #POST /me/feed HTTP/1.1
  #Connection: keep-alive
  #User-Agent: Furl::HTTP/2.15
  #Content-Type: application/x-www-form-urlencoded
  #Content-Length: 27
  #Host: graph.facebook.com
  #
  #message=Hello%2C%20world%21

=item * namespace

Facebook application namespace. This is used when you publish Open Graph Action

t/004_response/01_basic.t  view on Meta::CPAN

        '1220390',
        'cache-control',
        'private, no-cache, no-store, must-revalidate',
        'expires',
        'Sat, 01 Jan 2000 00:00:00 GMT',
        'x-fb-debug',
        'oyi19Zu1f4q0fcjowQrrmu8Lby+AgrNcmfLfpMBWcuQ=',
        'date',
        'Thu, 24 Apr 2014 13:15:31 GMT',
        'connection',
        'keep-alive',
        'content-length',
        '185',
        'facebook-api-version',
        'v2.3',
    ];
    my $req_headers = qq{GET /go.hagiwara HTTP/1.1\n}
                    . qq{Connection: keep-alive\n}
                    . qq{User-Agent: Facebook::OpenGraph/1.13\n}
                    . qq{Content-Length: 0\n}
                    . qq{Host: graph.facebook.com\n}
                    . qq{\n};
    my $content = '{"id":"12345"}';

    my $res = Facebook::OpenGraph::Response->new(+{
        code        => 200,
        message     => 'OK',
        headers     => $headers,

t/004_response/01_basic.t  view on Meta::CPAN

    isa_ok($res->json, 'JSON');
    is_deeply($res->headers, $headers);
};

subtest 'is_api_version_eq_or_older_than' => sub {
    my $headers = [
        'facebook-api-version',
        'v2.3',
    ];
    my $req_headers = qq{GET /go.hagiwara HTTP/1.1\n}
                    . qq{Connection: keep-alive\n}
                    . qq{User-Agent: Facebook::OpenGraph/1.13\n}
                    . qq{Content-Length: 0\n}
                    . qq{Host: graph.facebook.com\n}
                    . qq{\n};
    my $content = '{"id":"12345"}';

    my $res = Facebook::OpenGraph::Response->new(+{
        code        => 200,
        message     => 'OK',
        headers     => $headers,

t/004_response/01_basic.t  view on Meta::CPAN

    ok($res->is_api_version_eq_or_older_than('v3.3'));
    ok($res->is_api_version_eq_or_older_than('v3.4'));
};

subtest 'is_api_version_eq_or_later_than' => sub {
    my $headers = [
        'facebook-api-version',
        'v2.3',
    ];
    my $req_headers = qq{GET /go.hagiwara HTTP/1.1\n}
                    . qq{Connection: keep-alive\n}
                    . qq{User-Agent: Facebook::OpenGraph/1.13\n}
                    . qq{Content-Length: 0\n}
                    . qq{Host: graph.facebook.com\n}
                    . qq{\n};
    my $content = '{"id":"12345"}';

    my $res = Facebook::OpenGraph::Response->new(+{
        code        => 200,
        message     => 'OK',
        headers     => $headers,



( run in 0.413 second using v1.01-cache-2.11-cpan-483215c6ad5 )